summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-07-04 18:44:01 +0200
committerThomas Haller <thaller@redhat.com>2020-07-06 11:45:37 +0200
commit5361317f68f88e81430bf15ec3a820027562d319 (patch)
tree1b6f7229d6a42778232e1e543045ec6bc7d097a5
parent030d68aef792fd54c342e79aa9091c1a68d2e672 (diff)
downloadNetworkManager-5361317f68f88e81430bf15ec3a820027562d319.tar.gz
shared: add macros for declaration attribute to "nm-std-aux.h"
-rw-r--r--shared/nm-glib-aux/nm-macros-internal.h47
-rw-r--r--shared/nm-std-aux/nm-std-aux.h46
2 files changed, 46 insertions, 47 deletions
diff --git a/shared/nm-glib-aux/nm-macros-internal.h b/shared/nm-glib-aux/nm-macros-internal.h
index 0299bc13f7..a8b0b755b5 100644
--- a/shared/nm-glib-aux/nm-macros-internal.h
+++ b/shared/nm-glib-aux/nm-macros-internal.h
@@ -16,53 +16,6 @@
/*****************************************************************************/
-#define _nm_packed __attribute__ ((__packed__))
-#define _nm_unused __attribute__ ((__unused__))
-#define _nm_used __attribute__ ((__used__))
-#define _nm_pure __attribute__ ((__pure__))
-#define _nm_const __attribute__ ((__const__))
-#define _nm_printf(a,b) __attribute__ ((__format__ (__printf__, a, b)))
-#define _nm_align(s) __attribute__ ((__aligned__ (s)))
-#define _nm_section(s) __attribute__ ((__section__ (s)))
-#define _nm_alignof(type) __alignof (type)
-#define _nm_alignas(type) _nm_align (_nm_alignof (type))
-#define nm_auto(fcn) __attribute__ ((__cleanup__(fcn)))
-
-
-/* This is required to make LTO working.
- *
- * See https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/76#note_112694
- * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48200#c28
- */
-#ifndef __clang__
-#define _nm_externally_visible __attribute__ ((__externally_visible__))
-#else
-#define _nm_externally_visible
-#endif
-
-
-#if __GNUC__ >= 7
-#define _nm_fallthrough __attribute__ ((__fallthrough__))
-#else
-#define _nm_fallthrough
-#endif
-
-/*****************************************************************************/
-
-#ifdef thread_local
-#define _nm_thread_local thread_local
-/*
- * Don't break on glibc < 2.16 that doesn't define __STDC_NO_THREADS__
- * see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53769
- */
-#elif __STDC_VERSION__ >= 201112L && !(defined(__STDC_NO_THREADS__) || (defined(__GNU_LIBRARY__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 16))
-#define _nm_thread_local _Thread_local
-#else
-#define _nm_thread_local __thread
-#endif
-
-/*****************************************************************************/
-
/* most of our code is single-threaded with a mainloop. Hence, we usually don't need
* any thread-safety. Sometimes, we do need thread-safety (nm-logging), but we can
* avoid locking if we are on the main-thread by:
diff --git a/shared/nm-std-aux/nm-std-aux.h b/shared/nm-std-aux/nm-std-aux.h
index c5ed458dfd..c21b177074 100644
--- a/shared/nm-std-aux/nm-std-aux.h
+++ b/shared/nm-std-aux/nm-std-aux.h
@@ -7,6 +7,52 @@
/*****************************************************************************/
+#define _nm_packed __attribute__ ((__packed__))
+#define _nm_unused __attribute__ ((__unused__))
+#define _nm_used __attribute__ ((__used__))
+#define _nm_pure __attribute__ ((__pure__))
+#define _nm_const __attribute__ ((__const__))
+#define _nm_printf(a,b) __attribute__ ((__format__ (__printf__, a, b)))
+#define _nm_align(s) __attribute__ ((__aligned__ (s)))
+#define _nm_section(s) __attribute__ ((__section__ (s)))
+#define _nm_alignof(type) __alignof (type)
+#define _nm_alignas(type) _nm_align (_nm_alignof (type))
+#define nm_auto(fcn) __attribute__ ((__cleanup__(fcn)))
+
+/* This is required to make LTO working.
+ *
+ * See https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/76#note_112694
+ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48200#c28
+ */
+#ifndef __clang__
+#define _nm_externally_visible __attribute__ ((__externally_visible__))
+#else
+#define _nm_externally_visible
+#endif
+
+
+#if __GNUC__ >= 7
+#define _nm_fallthrough __attribute__ ((__fallthrough__))
+#else
+#define _nm_fallthrough
+#endif
+
+/*****************************************************************************/
+
+#ifdef thread_local
+#define _nm_thread_local thread_local
+/*
+ * Don't break on glibc < 2.16 that doesn't define __STDC_NO_THREADS__
+ * see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53769
+ */
+#elif __STDC_VERSION__ >= 201112L && !(defined(__STDC_NO_THREADS__) || (defined(__GNU_LIBRARY__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 16))
+#define _nm_thread_local _Thread_local
+#else
+#define _nm_thread_local __thread
+#endif
+
+/*****************************************************************************/
+
#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
#define NM_BOOLEAN_EXPR(expr) \
({ \