http://gcc.gnu.org/ml/gcc/2005-04/msg01429.html
I do have three suggestions for you: > > 1) The current way to tell the compiler not to throw away > apparently-unused data is __attribute__((used)), like this: > > static const char __attribute__((used)) rcs_sccs_id[] = > "$Id: @(#)%M% %I% 20%E% %U% copyright 2005 %Q% string1\\ $"; On Mon, Oct 17, 2011 at 2:04 PM, Oleg Goldshmidt <p...@goldshmidt.org> wrote: > > "Nadav Har'El" <n...@math.technion.ac.il> writes: > > > #if (__GNUC__ >= 4) && (__GNUC_MINOR__ > 4) > > #define USED(x) x __attribute__((used)) > > #else > > #define USED(x) x > > #endif > > #define IDENT(x) static const char USED(foo_src_id[]) = x; > > > > and then in each file just do > > #include "ident.h" > > IDENT("$Id"); > > The proper contents of ident.h would actually be > > #ifndef _IDENT_H_ > #define _IDENT_H_ > > #if defined(__GNUC__) > #define USED(x) x __attribute__((used)) > #else > #define USED(x) x > #endif > > #define IDENT(s,x) static const char USED(s[]) = x > > #endif > > - this is because one would want to use different identifiers in every > file to avoid a) clashes when keywords are used in header files (very > useful: which versions of the headers was this file compiled with?) and > b) possible effects of -fmerge-constants and friends. > > -- > Oleg Goldshmidt | p...@goldshmidt.org > > _______________________________________________ > Linux-il mailing list > Linux-il@cs.huji.ac.il > http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il > -- Your time is limited, so don't waste it living someone else's life. Don't be trapped by dogma -- which is living with the results of other people's thinking. Don't let the noise of others' opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary. Steve Jobs
_______________________________________________ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il