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: [PATCH][libcpp] Macros for unique named functions / identifiers


>>>>> "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


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