[yelp] yelp-debug: check if __STDC_VERSION__ is defined



commit 9ccbe9df9df30341e2c92e2b1a8fada65832d6ca
Author: Marek Chalupa <mchqwerty gmail com>
Date:   Fri Feb 13 02:39:23 2015 -0500

    yelp-debug: check if __STDC_VERSION__ is defined
    
    __STDC_VERSION__ is defined only when switch -std=c99 (and newer
    standards) is defined. This can break the build with error:
    
    error: "__STDC_VERSION__" is not defined
    
    https://bugzilla.gnome.org/show_bug.cgi?id=744454

 libyelp/yelp-debug.h |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/libyelp/yelp-debug.h b/libyelp/yelp-debug.h
index f41b43d..d7d8e7f 100644
--- a/libyelp/yelp-debug.h
+++ b/libyelp/yelp-debug.h
@@ -21,6 +21,7 @@
 
 G_BEGIN_DECLS
 
+#include <unistd.h>
 #include <glib.h>
 
 typedef enum {
@@ -35,7 +36,7 @@ typedef enum {
        DB_ALL        = 1 << 8
 } YelpDebugEnums;
 
-#if __STDC_VERSION__ < 199901L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ < 199901L
 # if __GNUC__ >= 2
 #  define __func__ __FUNCTION__
 # else
@@ -46,13 +47,13 @@ typedef enum {
 /* __VA_ARGS__ is C99 compliant but may not work on older versions of cpp, 
  * so we provide a fallback */
 #ifdef YELP_DEBUG
-# if __STDC_VERSION__ < 199901L
+# if defined(__STDC_VERSION__) && __STDC_VERSION__ < 199901L
 #  define debug_print(format, args...) yelp_debug (__FILE__, __LINE__, __func__, format, args)
 # else
 #  define debug_print(format, ...) yelp_debug (__FILE__, __LINE__, __func__, format, __VA_ARGS__)
 # endif
 #else
-# if __STDC_VERSION__ < 199901L
+# if defined(__STDC_VERSION__) && __STDC_VERSION__ < 199901L
 #  define debug_print(format, args...)
 # else
 #  define debug_print(format, ...)


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