This is the mail archive of the gcc@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: Extension compatibility policy


On Wed, 2 Mar 2005, Bernardo Innocenti wrote:

> To move strings into program memory, there's a macro like this:
> 
> #define PSTR(s) ({ static const char __c[] PROGMEM = (s); &__c[0]; })
> 
> 
> But this wouldn't work because __func__ does not work like
> a string literal:
> 
> #define TRACEMSG(msg,...) __tracemsg(PSTR(__func__), msg, ## __VA_ARGS__)
> 
> C99's __func__ is supposed to work as if a "const char __func__[]".
> The __FUNCTION__ extension could instead be made to work like a
> string literal.   We could live without string pasting capabilities
> if it helps keeping the interface between cpp and the C frontend
> cleaner.

How about calling decl_attributes from fname_decl so a target 
insert_attributes hook can add attributes to __func__?  Would that suffice 
to solve your problem?

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)


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