summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2022-12-07 11:44:42 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2022-12-07 13:01:51 +0800
commit07e2d0da910a6b7dd32cb1dba7d58db66d46c97d (patch)
tree369ab4bbb176bca74f52b1f42f239cee6a62e595
parent5970778a89f33352b59da689cdb7d088555b1d53 (diff)
downloadlibrest-07e2d0da910a6b7dd32cb1dba7d58db66d46c97d.tar.gz
rest-private.h: Use ISO varargs for REST_DEBUG
This way, the code won't be tied to GCC-compatible compilers. We do, however, need to enable the more C99-compliant preprocessor that is provided with Visual Studio 2019 16.8.x or later if we want to build the debugging logging code.
-rw-r--r--meson.build9
-rw-r--r--rest/rest-private.h4
2 files changed, 11 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index 5fb5956..b090c56 100644
--- a/meson.build
+++ b/meson.build
@@ -4,6 +4,15 @@ project('rest', 'c',
meson_version: '>= 0.56',
)
+cc = meson.get_compiler('c')
+check_cc_args = []
+
+if cc.get_id() == 'msvc'
+ check_cc_args += ['-Zc:preprocessor'] # Use the more C99-compliant preprocessor
+endif
+
+add_project_arguments(cc.get_supported_arguments(check_cc_args), language: ['c'])
+
# Versioning
librest_module_version = '0.0.0'
librest_soversion = '0'
diff --git a/rest/rest-private.h b/rest/rest-private.h
index 6e71322..6a1a716 100644
--- a/rest/rest-private.h
+++ b/rest/rest-private.h
@@ -47,9 +47,9 @@ extern guint rest_debug_flags;
#define REST_DEBUG_ENABLED(category) (rest_debug_flags & REST_DEBUG_##category)
-#define REST_DEBUG(category,x,a...) G_STMT_START { \
+#define REST_DEBUG(category,x,...) G_STMT_START { \
if (REST_DEBUG_ENABLED(category)) \
- { g_message ("[" #category "] " G_STRLOC ": " x, ##a); } \
+ { g_message ("[" #category "] " G_STRLOC ": " x, ##__VA_ARGS__); } \
} G_STMT_END
void _rest_setup_debugging (void);