[gnome-builder/wip/lantw/fix-various-things-for-freebsd-and-clang: 2/4] libide: don't use __VA_OPT__ when not compiled in C++ mode
- From: Ting-Wei Lan <lantw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/lantw/fix-various-things-for-freebsd-and-clang: 2/4] libide: don't use __VA_OPT__ when not compiled in C++ mode
- Date: Mon, 29 Jul 2019 15:37:54 +0000 (UTC)
commit eb63974807cdef9d337b1e669d93aefb94aad794
Author: Ting-Wei Lan <lantw src gnome org>
Date: Mon Jul 29 23:15:54 2019 +0800
libide: don't use __VA_OPT__ when not compiled in C++ mode
__VA_OPT__ is a C++2a feature which isn't supported in any version of C
standard. Therefore, we can't blame clang for not supporting it in C
mode, and we have to fallback to the GNU extension for C.
Fixes #980
src/libide/core/ide-context.h | 5 +++++
src/libide/core/ide-object.h | 5 +++++
src/libide/gui/ide-gui-global.h | 8 ++++++++
3 files changed, 18 insertions(+)
---
diff --git a/src/libide/core/ide-context.h b/src/libide/core/ide-context.h
index 065ac4563..dda1f63d2 100644
--- a/src/libide/core/ide-context.h
+++ b/src/libide/core/ide-context.h
@@ -85,7 +85,12 @@ void ide_context_log (IdeContext *self,
const gchar *domain,
const gchar *message);
+#ifdef __cplusplus
#define ide_context_warning(instance, format, ...) \
ide_object_log(instance, G_LOG_LEVEL_WARNING, G_LOG_DOMAIN, format __VA_OPT__(,) __VA_ARGS__)
+#else
+#define ide_context_warning(instance, format, ...) \
+ ide_object_log(instance, G_LOG_LEVEL_WARNING, G_LOG_DOMAIN, format, ##__VA_ARGS__)
+#endif
G_END_DECLS
diff --git a/src/libide/core/ide-object.h b/src/libide/core/ide-object.h
index a0ec78c78..3591ca365 100644
--- a/src/libide/core/ide-object.h
+++ b/src/libide/core/ide-object.h
@@ -150,7 +150,12 @@ void ide_object_log (gpointer instance,
const gchar *format,
...) G_GNUC_PRINTF (4, 5);
+#ifdef __cplusplus
#define ide_object_message(instance, format, ...) ide_object_log(instance, G_LOG_LEVEL_MESSAGE,
G_LOG_DOMAIN, format __VA_OPT__(,) __VA_ARGS__)
#define ide_object_warning(instance, format, ...) ide_object_log(instance, G_LOG_LEVEL_WARNING,
G_LOG_DOMAIN, format __VA_OPT__(,) __VA_ARGS__)
+#else
+#define ide_object_message(instance, format, ...) ide_object_log(instance, G_LOG_LEVEL_MESSAGE,
G_LOG_DOMAIN, format, ##__VA_ARGS__)
+#define ide_object_warning(instance, format, ...) ide_object_log(instance, G_LOG_LEVEL_WARNING,
G_LOG_DOMAIN, format, ##__VA_ARGS__)
+#endif
G_END_DECLS
diff --git a/src/libide/gui/ide-gui-global.h b/src/libide/gui/ide-gui-global.h
index abdae1c29..3dc2f0497 100644
--- a/src/libide/gui/ide-gui-global.h
+++ b/src/libide/gui/ide-gui-global.h
@@ -27,11 +27,19 @@
G_BEGIN_DECLS
+#ifdef __cplusplus
#define ide_widget_warning(instance, format, ...) \
G_STMT_START { \
IdeContext *context = ide_widget_get_context (GTK_WIDGET (instance)); \
ide_context_log (context, G_LOG_LEVEL_WARNING, G_LOG_DOMAIN, format __VA_OPT__(,) __VA_ARGS__); \
} G_STMT_END
+#else
+#define ide_widget_warning(instance, format, ...) \
+ G_STMT_START { \
+ IdeContext *context = ide_widget_get_context (GTK_WIDGET (instance)); \
+ ide_context_log (context, G_LOG_LEVEL_WARNING, G_LOG_DOMAIN, format, ##__VA_ARGS__); \
+ } G_STMT_END
+#endif
typedef void (*IdeWidgetContextHandler) (GtkWidget *widget,
IdeContext *context);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]