]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Stop disabling -Wattributes
authorZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Thu, 19 Mar 2026 10:35:00 +0000 (11:35 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Thu, 19 Mar 2026 10:46:30 +0000 (11:46 +0100)
In one of the reviews one of the LLMs noticed that the pragma is set but
never unset, so it remains in effect for the rest of the translation
unit. From the comment, it's not clear how old those "old compilers" were,
so let's try if things work without this workaround.

src/basic/static-destruct.h
src/libsystemd/sd-bus/bus-error.h
src/shared/tests.h

index 5772d24240f8872fbc05a5146a92ce7eac884a3f..00087ad779e0a321b920ca777535f60c1e1a8373 100644 (file)
@@ -12,8 +12,6 @@ typedef void (*free_func_t)(void *p);
  * variables declared in .so's, as the list is private to the same linking unit. But maybe that's a good thing. */
 
 #define _common_static_destruct_attrs_                                  \
-        /* Older compilers don't know "retain" attribute. */            \
-        _Pragma("GCC diagnostic ignored \"-Wattributes\"")              \
         /* The actual destructor structure we place in a special section to find it. */ \
         _section_("SYSTEMD_STATIC_DESTRUCT")                            \
         /* Use pointer alignment, since that is apparently what gcc does for static variables. */ \
index ac3c90c0d317e487facb10df62e75c24fea09fbc..5aca67f006578593cebeab96c4bacde9aa7f2a51 100644 (file)
@@ -31,12 +31,10 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
  * the error map is really added to the final binary.
  *
  * In addition, set the retain attribute so that the section cannot be
- * discarded by ld --gc-sections -z start-stop-gc. Older compilers would
- * warn for the unknown attribute, so just disable -Wattributes.
+ * discarded by ld --gc-sections -z start-stop-gc.
  */
 
 #define BUS_ERROR_MAP_ELF_REGISTER                                      \
-        _Pragma("GCC diagnostic ignored \"-Wattributes\"")              \
         _section_("SYSTEMD_BUS_ERROR_MAP")                              \
         _used_                                                          \
         _retain_                                                        \
index ae57cab3863c5c4bb6a8c2480ab13eed1f5fe69d..4e1bfad86d35031e6be12b6bb790fc150f2946d1 100644 (file)
@@ -101,7 +101,6 @@ typedef struct TestFunc {
 
 /* See static-destruct.h for an explanation of how this works. */
 #define REGISTER_TEST(func, ...)                                                                        \
-        _Pragma("GCC diagnostic ignored \"-Wattributes\"")                                              \
         _section_("SYSTEMD_TEST_TABLE") _alignptr_ _used_ _retain_ _variable_no_sanitize_address_       \
         static const TestFunc UNIQ_T(static_test_table_entry, UNIQ) = {                                 \
                 .f = (union f) &(func),                                                                 \