]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: use gcc attribute macros where appropriate
authorLennart Poettering <lennart@poettering.net>
Mon, 3 Dec 2018 12:08:33 +0000 (13:08 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 3 Dec 2018 12:28:26 +0000 (13:28 +0100)
We have these macros already, hence use them.

src/basic/hashmap.c
src/basic/process-util.c
src/basic/static-destruct.h
src/basic/util.h

index eba56add1fc76a3e013f160a61609031c4006b1d..edcdfb865283bab1456c81d164e09c08ccf169a4 100644 (file)
@@ -276,7 +276,7 @@ static const struct hashmap_type_info hashmap_type_info[_HASHMAP_TYPE_MAX] = {
 };
 
 #if VALGRIND
-__attribute__((destructor)) static void cleanup_pools(void) {
+_destructor_ static void cleanup_pools(void) {
         _cleanup_free_ char *t = NULL;
         int r;
 
index d1a34338f6d07556671faf75799bfe81f800f3de..981628504b3fd5edd327d41f4788d375004b2b79 100644 (file)
@@ -1172,7 +1172,7 @@ void reset_cached_pid(void) {
  * headers. __register_atfork() is mostly equivalent to pthread_atfork(), but doesn't require us to link against
  * libpthread, as it is part of glibc anyway. */
 extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void *dso_handle);
-extern void* __dso_handle __attribute__ ((__weak__));
+extern void* __dso_handle _weak_;
 
 pid_t getpid_cached(void) {
         static bool installed = false;
index cad838083fa7b1d792d4863354669d46643d660e..b780985d117d4b4f609d0890392bfc4ae28e0b95 100644 (file)
@@ -32,8 +32,8 @@ typedef struct StaticDestructor {
 
 /* Beginning and end of our section listing the destructors. We define these as weak as we want this to work even if
  * there's not a single destructor is defined in which case the section will be missing. */
-extern const struct StaticDestructor __attribute__((__weak__)) __start_SYSTEMD_STATIC_DESTRUCT[];
-extern const struct StaticDestructor __attribute__((__weak__)) __stop_SYSTEMD_STATIC_DESTRUCT[];
+extern const struct StaticDestructor _weak_ __start_SYSTEMD_STATIC_DESTRUCT[];
+extern const struct StaticDestructor _weak_ __stop_SYSTEMD_STATIC_DESTRUCT[];
 
 /* The function to destroy everything. (Note that this must be static inline, as it's key that it remains in the same
  * linking unit as the variables we want to destroy. */
index 2f3d1eeab86a03bfc8092d9683597f70df98b56a..43f40811906c778c225e3d4c8d425d70e7af48c3 100644 (file)
@@ -173,7 +173,7 @@ static inline void _reset_errno_(int *saved_errno) {
 }
 
 #define PROTECT_ERRNO                                                   \
-        _cleanup_(_reset_errno_) __attribute__((__unused__)) int _saved_errno_ = errno
+        _cleanup_(_reset_errno_) _unused_ int _saved_errno_ = errno
 
 static inline int negative_errno(void) {
         /* This helper should be used to shut up gcc if you know 'errno' is