summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid McCann <mccannd@uk.ibm.com>2021-05-13 06:31:18 +0100
committerDavid McCann <mccannd@uk.ibm.com>2021-05-13 06:31:18 +0100
commit9b53c92ea398c479f59f77b2cbd24d2ccf1fc29a (patch)
treee701767d619949d08bba8d326f0e98b3a35fa913
parent5b15c7567d05a6ad834c96461766340c187dfcc9 (diff)
downloadjson-c-9b53c92ea398c479f59f77b2cbd24d2ccf1fc29a.tar.gz
Check __STDC_VERSION__ is defined before checking its value
Prevent an undef warning regarding __STDC_VERSION__ by checking whether it is defined before checking its value.
-rw-r--r--json_object.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/json_object.h b/json_object.h
index 7c0d1f2..be6919a 100644
--- a/json_object.h
+++ b/json_object.h
@@ -452,7 +452,7 @@ JSON_EXPORT void json_object_object_del(struct json_object *obj, const char *key
* @param val the local name for the json_object* object variable defined in
* the body
*/
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && __STDC_VERSION__ >= 199901L
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
#define json_object_object_foreach(obj, key, val) \
char *key = NULL; \
@@ -484,7 +484,7 @@ JSON_EXPORT void json_object_object_del(struct json_object *obj, const char *key
: 0); \
entry##key = entry_next##key)
-#endif /* defined(__GNUC__) && !defined(__STRICT_ANSI__) && __STDC_VERSION__ >= 199901L */
+#endif /* defined(__GNUC__) && !defined(__STRICT_ANSI__) && (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) */
/** Iterate through all keys and values of an object (ANSI C Safe)
* @param obj the json_object instance