[glib] gmacros: fix unguarded use of __STDC_VERSION__



commit 7bc6f021d7b65fd61194f366077efb1faafa96dc
Author: Allison Ryan Lortie <desrt desrt ca>
Date:   Tue Nov 17 13:29:35 2015 -0500

    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.

 glib/gmacros.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/glib/gmacros.h b/glib/gmacros.h
index 741a77f..55af81f 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]