This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][libcpp] Macros for unique named functions / identifiers
I opened a PR about the problem with the documentation:
http://gcc.gnu.org/PR43752
Cheers,
Manuel.
On 14 April 2010 12:30, Dave Edwards <dave@icerasemi.com> wrote:
>
> Thanks for your help!
>
> We got confused as the source of the cpp manual is in the gcc/doc directory, so ?assumed it would have been present in the GCC manual. Doh!
>
> I reckon just a reference in gcc.pdf's "3.11 Options Controlling the Preprocessor" to the fact there is a separate cpp manual would probably do the trick.
>
> Our problem with __LINE__ was that it wasn't unique across included files, but it sounds like __COUNTER__ would do indeed do the trick, and thus could remove the need for __CANON_BASE_FILE__ and __CANON_BASE_LINE__.
>
> Cheers,
>
> -----Original Message-----
> From: Manuel López-Ibáñez [mailto:lopezibanez@gmail.com]
> Sent: 14 April 2010 11:23
> To: Dave Edwards
> Cc: Paolo Bonzini; tromey@redhat.com; Rahul Kharche; GCC Patches; sdkteam-gnu
> Subject: Re: [PATCH][libcpp] Macros for unique named functions / identifiers
>
> CPP has its own manual. COUNTER was introduced in GCC 4.3, which is by
> now pretty old, so you are probably not looking at the CPP manual. If
> you have suggestions on how to avoid this confusion in the future, let
> us know.
>
> Thanks,
>
> Manuel.
>
> On 14 April 2010 12:16, Dave Edwards <dave@icerasemi.com> wrote:
>>
>> I just searched in the gcc.pdf which is built from the version of the sources we used - its not present in that version (maybe a merge problem on our part).
>>
>>
>>
>> -----Original Message-----
>> From: Manuel López-Ibáñez [mailto:lopezibanez@gmail.com]
>> Sent: 14 April 2010 11:14
>> To: Dave Edwards
>> Cc: Paolo Bonzini; tromey@redhat.com; Rahul Kharche; GCC Patches; sdkteam-gnu
>> Subject: Re: [PATCH][libcpp] Macros for unique named functions / identifiers
>>
>> You didn't look too well:
>>
>> http://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html#Common-Predefined-Macros
>>
>> On 14 April 2010 11:58, Dave Edwards <dave@icerasemi.com> wrote:
>>>
>>> I couldn't find any reference to __COUNTER__ in the GCC manual so didn't
>>> know it existed.
>>>
>>> -----Original Message-----
>>> From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of Paolo
>>> Bonzini
>>> Sent: 14 April 2010 10:45
>>> To: Dave Edwards
>>> Cc: tromey@redhat.com; Rahul Kharche; GCC Patches; sdkteam-gnu
>>> Subject: Re: [PATCH][libcpp] Macros for unique named functions /
>>> identifiers
>>>
>>> On 04/14/2010 11:38 AM, Dave Edwards wrote:
>>>> This wouldn't work - CANON_BASE_FILE is*different* ?for each included
>>>> file. With this approach we'd get the same string for each invokation
>>> of
>>>> the compiler, and thus we'd not get unique names.
>>>
>>> But you would join that with __COUNTER__, not __LINE__.
>>>
>>> Paolo
>>>
>>
>