This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ Patch] More location fixes to grokdeclarator


On Wed, Jun 27, 2018 at 5:11 AM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> Hi David,
>
> On 27/06/2018 01:52, David Malcolm wrote:
>>
>> On Tue, 2018-06-26 at 01:44 +0200, Paolo Carlini wrote:
>>>
>>> Hi,
>>>
>>> this includes straightforward tweaks to check_concept_fn and quite a
>>> bit
>>> of additional work on grokdeclarator: most of it is also rather
>>> straightforward. In a few places there is the subtlety that we want
>>> to
>>> handle together ds_storage_class and ds_thread, whichever location
>>> is
>>> the smallest but != UNKNOWN_LOCATION (UNKNWON_LOCATION meaning that
>>> the
>>> issue is with the other one) or use the biggest location when say
>>> ds_virtual and ds_storage_class conflict, because - I believe - we
>>> want
>>> to point to the place where we give up. Thus I added the
>>> min_location
>>> and max_location helpers.
>>
>> Note that directly comparing location_t values can be problematic: (one
>> value might be an ad-hoc location, and the other not; one might be a
>> macro expansion, etc).
>>
>> You might want to use linemap_compare_locations or
>> linemap_location_before_p for this.
>
> Thanks David, I was not aware of this issue. In the below I amended the new
> functions and the existing smallest_type_quals_location (which I wrote a
> while ago) to use linemap_location_before_p.

> +/* Returns the smallest location.  */

This should probably say "...that is not UNKNOWN_LOCATION."

Actually, the places you use min_location would seem to work fine with
max_location as well.  What are your criteria for choosing one or the
other?

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]