"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