From e362a4efcbe7366d03f6b60959b752440fe1f69b Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 21 Sep 2026 15:23:41 +0900 Subject: [PATCH] namespace,condition: drop invalid _const_ attributes The _const_ attribute can be only used for functions. Fixes the following warnings on Fedora rawhide: ``` ../src/core/namespace.h:260:75: warning: '__const__' attribute only applies to functions [-Wignored-attributes] 260 | char* bpf_delegate_to_string(uint64_t u, const char * (*parser)(uint64_t) _const_); | ^ ../src/basic/../fundamental/macro.h:80:32: note: expanded from macro '_const_' 80 | #define _const_ __attribute__((__const__)) | ^ In file included from ../src/core/unit.c:24: ../src/shared/condition.h:87:63: warning: '__const__' attribute only applies to functions [-Wignored-attributes] 87 | typedef const char* (*condition_to_string_t)(ConditionType t) _const_; | ^ ../src/basic/../fundamental/macro.h:80:32: note: expanded from macro '_const_' 80 | #define _const_ __attribute__((__const__)) | ^ ``` --- src/core/namespace.c | 2 +- src/core/namespace.h | 2 +- src/shared/condition.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/namespace.c b/src/core/namespace.c index 45253b4804..dd15bda3ac 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -4185,7 +4185,7 @@ DEFINE_STRING_TABLE_LOOKUP(bpf_delegate_map_type, uint64_t); DEFINE_STRING_TABLE_LOOKUP(bpf_delegate_prog_type, uint64_t); DEFINE_STRING_TABLE_LOOKUP(bpf_delegate_attach_type, uint64_t); -char* bpf_delegate_to_string(uint64_t u, const char * (*parser)(uint64_t) _const_ ) { +char* bpf_delegate_to_string(uint64_t u, const char* (*parser)(uint64_t)) { assert(parser); if (u == UINT64_MAX) diff --git a/src/core/namespace.h b/src/core/namespace.h index d25859f17a..a761beb01c 100644 --- a/src/core/namespace.h +++ b/src/core/namespace.h @@ -257,7 +257,7 @@ DECLARE_STRING_TABLE_LOOKUP(bpf_delegate_prog_type, uint64_t); DECLARE_STRING_TABLE_LOOKUP(bpf_delegate_attach_type, uint64_t); -char* bpf_delegate_to_string(uint64_t u, const char * (*parser)(uint64_t) _const_); +char* bpf_delegate_to_string(uint64_t u, const char* (*parser)(uint64_t)); int bpf_delegate_from_string(const char *s, uint64_t *ret, uint64_t (*parser)(const char *)); static inline int bpf_delegate_commands_from_string(const char *s, uint64_t *ret) { diff --git a/src/shared/condition.h b/src/shared/condition.h index 21eceea4a1..f79a625718 100644 --- a/src/shared/condition.h +++ b/src/shared/condition.h @@ -84,7 +84,7 @@ static inline Condition* condition_free_list(Condition *first) { int condition_test(Condition *c, char **env); typedef int (*condition_test_logger_t)(void *userdata, int level, int error, const char *file, int line, const char *func, const char *format, ...) _printf_(7, 8); -typedef const char* (*condition_to_string_t)(ConditionType t) _const_; +typedef const char* (*condition_to_string_t)(ConditionType t); bool condition_test_list_net(Condition *first, char **env, condition_to_string_t to_string, condition_test_logger_t logger, void *userdata); int condition_test_list(Condition *first, char **env, condition_to_string_t to_string, condition_test_logger_t logger, void *userdata);