gmacros: fix unguarded use of __STDC_VERSION__

According to the C spec, any undefined identifier used in a #if
expression is taken to have a numerical value of zero.

Commit db2367e8782d7a39fc3e93d13f6a16f10cad04c2 introduced an #i
statement which depended on this behaviour.

gcc has a -Wundef option which warns about depending on this behaviour,
and unfortunately there are projects that are using -Werror=undef in
builds that include our headers.

Adding a check for defined(__STDC_VERSION__) before using the macro is
enough to silence gcc.
This commit is contained in:
Allison Ryan Lortie 2015-11-17 13:29:35 -05:00
parent 1ee2db4a28
commit 7bc6f021d7

View File

@ -53,7 +53,7 @@
* the warning.
*/
#define G_CAN_INLINE
#if !(__STDC_VERSION__ > 199900)
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199900)
#undef inline
#define inline __inline
#endif