Issue #941: fix "defined but not used" errors when building with a c++ compiler.

This commit is contained in:
Eric Hawicz
2026-07-11 09:28:49 -04:00
parent 324e5ca593
commit aab792578b
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -488,7 +488,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__) && (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && (defined(__cplusplus) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L))
#define json_object_object_foreach(obj, key, val) \
char *key = NULL; \
@@ -520,7 +520,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__) && (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) */
#endif
/** Iterate through all keys and values of an object (ANSI C Safe)
* @param obj the json_object instance