summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Chalupa <mchqwerty@gmail.com>2015-02-13 02:39:23 -0500
committerDavid King <amigadave@amigadave.com>2015-02-16 08:23:33 +0000
commit9ccbe9df9df30341e2c92e2b1a8fada65832d6ca (patch)
treed28eae1fdf2e7ebd4c9680735a582e245ec20c71
parent65206ee9bc2d4ae3245cf7042bc3ac90437ace63 (diff)
downloadyelp-9ccbe9df9df30341e2c92e2b1a8fada65832d6ca.tar.gz
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
-rw-r--r--libyelp/yelp-debug.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/libyelp/yelp-debug.h b/libyelp/yelp-debug.h
index f41b43de..d7d8e7f3 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, ...)