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__))
      |                                ^
```
This commit is contained in:
Yu Watanabe
2026-09-22 02:46:35 +09:00
parent d4f1a76a2e
commit e362a4efcb
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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) {
+1 -1
View File
@@ -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);