On Mon, 2023-09-11 at 13:54 +0200, Jakub Jelinek wrote:
> Hi!
>
> One question to David below, CCed.
>
> On Mon, Sep 11, 2023 at 01:44:07PM +0200, Tobias Burnus wrote:
[...]
>
> > +
> > + if (DECL_SOURCE_LOCATION (allocator) >
> > DECL_SOURCE_LOCATION (var))
> > + {
> > + error_at (OMP_CLAUSE_LOCATION (nl),
> > + "allocator variable %qD must be declared
> > before %qD",
> > + allocator, var);
> > + inform (DECL_SOURCE_LOCATION (allocator), "declared
> > here");
> > + inform (DECL_SOURCE_LOCATION (var), "declared here");
>
> I think this will be confusing to users when the inform is the same
> in both
> cases. I'd use "allocator declared here" in the first case.
>
> And, am really not sure if one can just simply compare location_t
> like that.
> Isn't there some function which determines what source location is
> before
> another one? David?
Indeed, the numerical ordering of location_t values doesn't fully
correspond to declaration order.
Please use
linemap_compare_locations
or
linemap_location_before_p
>
> > + if (EXPR_LOCATION (*l) < DECL_SOURCE_LOCATION
> > (var))
> > + break;
>
> Likewise.
>
Dave
>