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
- From: Tom Tromey <tromey at redhat dot com>
- To: "Rahul Kharche" <rahul at IceraSemi dot com>
- Cc: "GCC Patches" <gcc-patches at gcc dot gnu dot org>, "sdkteam-gnu" <sdkteam-gnu at IceraSemi dot com>
- Date: Tue, 13 Apr 2010 14:05:10 -0600
- Subject: Re: [PATCH][libcpp] Macros for unique named functions / identifiers
- References: <4D60B0700D1DB54A8C0C6E9BE69163700E572544@EXCHANGEVS.IceraSemi.local>
- Reply-to: tromey at redhat dot com
>>>>> "Rahul" == Rahul Kharche <rahul@IceraSemi.com> writes:
Rahul> The following patch adds macros CANON_BASE_FILE and CANON_LINE.
I'm sorry, but I don't think we want this in GCC.
Rahul> CANON_BASE_FILE is analogous to BASE_FILE, but not a string
Rahul> constant and only preserves characters valid as an identifiers.
I don't fully understand the need for this.
You could require users of your macro to #define CANON_BASE_FILE
themselves. Or you could just pick a name and make the objects static.
I think those are both fairly typical approaches in existing code.
E.g., GCC uses the latter for vec.h.
Rahul> CANON_LINE is analogous to the line number and occurance count in
Rahul> the preprocessed output.
Can't you use __COUNTER__ for this?
Tom