fix: __STDC_VERSION__ can be undefined in C++
[lttng-ust.git] / include / lttng / ust-compiler.h
index 6ce2b65242334e74c3ddf48f8dc8ae278f06bf42..b7fd2c1c42bff2bac5d6bfc1c4f403a61fa82234 100644 (file)
@@ -68,7 +68,7 @@
 #ifdef __cplusplus
 #define lttng_ust_static_assert(predicate, msg, c_identifier_msg)  \
        static_assert(predicate, msg)
-#elif __STDC_VERSION__ >= 201112L
+#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
 #define lttng_ust_static_assert(predicate, msg, c_identifier_msg)  \
        _Static_assert(predicate, msg)
 #else
@@ -106,17 +106,17 @@ namespace details {                                                               \
 class LTTNG_UST_COMPILER_COMBINE_TOKENS(lttng_ust_constructor_destructor_,      \
                                   name) {                                      \
 public:                                                                                \
-       LTTNG_UST_COMPILER_COMBINE_TOKENS(lttng_ust_constructor_destructor_,    \
-                                    name)() __VA_ARGS__                        \
-       {                                                                       \
-               constructor_func();                                             \
-       }                                                                       \
-       ~LTTNG_UST_COMPILER_COMBINE_TOKENS(lttng_ust_constructor_destructor_,   \
-                                     name)() __VA_ARGS__                       \
-       {                                                                       \
-               destructor_func();                                              \
-       }                                                                       \
+       LTTNG_UST_COMPILER_COMBINE_TOKENS(lttng_ust_constructor_destructor_, name)() __VA_ARGS__; \
+       ~LTTNG_UST_COMPILER_COMBINE_TOKENS(lttng_ust_constructor_destructor_, name)() __VA_ARGS__; \
 };                                                                             \
+LTTNG_UST_COMPILER_COMBINE_TOKENS(lttng_ust_constructor_destructor_, name)::LTTNG_UST_COMPILER_COMBINE_TOKENS(lttng_ust_constructor_destructor_, name)() \
+{                                                                              \
+       constructor_func();                                                     \
+}                                                                              \
+LTTNG_UST_COMPILER_COMBINE_TOKENS(lttng_ust_constructor_destructor_, name)::~LTTNG_UST_COMPILER_COMBINE_TOKENS(lttng_ust_constructor_destructor_, name)() \
+{                                                                              \
+       destructor_func();                                                      \
+}                                                                              \
 }                                                                              \
 }                                                                              \
 }                                                                              \
This page took 0.023231 seconds and 4 git commands to generate.