I would like to print a macro value (expand the macro) in the #warning directive.
For example, for the code:
#define AAA 17
#warning AAA = ???
If you really want to emit a warning, the following will work, too. However, it depends on C99 being enabled (works with gcc 4.8.2 or later, not tested on earlier versions):
#define N 77
#define __STRINGIFY(TEXT) #TEXT
#define __WARNING(TEXT) __STRINGIFY(GCC warning TEXT)
#define WARNING(VALUE) __WARNING(__STRINGIFY(N = VALUE))
#if N == 77
_Pragma (WARNING(N))
#endif