summaryrefslogtreecommitdiff
path: root/src/libnm-std-aux
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-07-30 10:50:56 +0200
committerThomas Haller <thaller@redhat.com>2021-07-30 10:50:56 +0200
commit91a36478f6328dc536bcac3a84cb75f82393c11c (patch)
treefc2f0ccfa574df4ef35a3783f4fb38e7106e2016 /src/libnm-std-aux
parent72433a10f4e3e66d39ef9480957a7528d8228e5c (diff)
downloadNetworkManager-91a36478f6328dc536bcac3a84cb75f82393c11c.tar.gz
std-aux: move _NM_CC_SUPPORT_AUTO_TYPE, _NM_CC_SUPPORT_GENERIC to "nm-std-aux.h"
Diffstat (limited to 'src/libnm-std-aux')
-rw-r--r--src/libnm-std-aux/nm-std-aux.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/libnm-std-aux/nm-std-aux.h b/src/libnm-std-aux/nm-std-aux.h
index bc74a30997..a7bfc37ea4 100644
--- a/src/libnm-std-aux/nm-std-aux.h
+++ b/src/libnm-std-aux/nm-std-aux.h
@@ -46,6 +46,36 @@
/*****************************************************************************/
+#ifndef _NM_CC_SUPPORT_AUTO_TYPE
+#if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)))
+#define _NM_CC_SUPPORT_AUTO_TYPE 1
+#else
+#define _NM_CC_SUPPORT_AUTO_TYPE 0
+#endif
+#endif
+
+#if _NM_CC_SUPPORT_AUTO_TYPE
+#define _nm_auto_type __auto_type
+#endif
+
+#ifndef _NM_CC_SUPPORT_GENERIC
+/* In the meantime, NetworkManager requires C11 and _Generic() should always be available.
+ * However, shared/nm-utils may also be used in VPN/applet, which possibly did not yet
+ * bump the C standard requirement. Leave this for the moment, but eventually we can
+ * drop it.
+ *
+ * Technically, gcc 4.9 already has some support for _Generic(). But there seems
+ * to be issues with propagating "const char *[5]" to "const char **". Only assume
+ * we have _Generic() since gcc 5. */
+#if (defined(__GNUC__) && __GNUC__ >= 5) || (defined(__clang__))
+#define _NM_CC_SUPPORT_GENERIC 1
+#else
+#define _NM_CC_SUPPORT_GENERIC 0
+#endif
+#endif
+
+/*****************************************************************************/
+
#ifdef __CHECKER__
#define _nm_bitwise __attribute__((__bitwise__))
#define _nm_force __attribute__((__force__))