clang-tidy: Enable more warnings (#39910)

This commit is contained in:
Yu Watanabe
2026-01-03 06:00:30 +09:00
committed by GitHub
23 changed files with 107 additions and 82 deletions
-2
View File
@@ -28,7 +28,6 @@ typedef void* (*mfree_func_t)(void *p);
})
#define _DEFINE_TRIVIAL_REF_FUNC(type, name, scope) \
/* NOLINTNEXTLINE (readability-inconsistent-declaration-parameter-name) */ \
scope type *name##_ref(type *p) { \
if (!p) \
return NULL; \
@@ -43,7 +42,6 @@ typedef void* (*mfree_func_t)(void *p);
}
#define _DEFINE_TRIVIAL_UNREF_FUNC(type, name, free_func, scope) \
/* NOLINTNEXTLINE (readability-inconsistent-declaration-parameter-name) */ \
scope type *name##_unref(type *p) { \
if (!p) \
return NULL; \
+1 -1
View File
@@ -38,4 +38,4 @@ int fs_type_from_string(const char *name, const statfs_f_type_t **ret);
bool fs_in_group(const struct statfs *s, enum FilesystemGroups fs_group);
/* gperf prototypes */
const struct FilesystemMagic* filesystems_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
const struct FilesystemMagic* filesystems_gperf_lookup(const char *str, GPERF_LEN_TYPE length);
+5 -5
View File
@@ -1135,17 +1135,17 @@ bool oom_score_adjust_is_valid(int oa) {
return oa >= OOM_SCORE_ADJ_MIN && oa <= OOM_SCORE_ADJ_MAX;
}
unsigned long personality_from_string(const char *p) {
unsigned long personality_from_string(const char *s) {
Architecture architecture;
if (!p)
if (!s)
return PERSONALITY_INVALID;
/* Parse a personality specifier. We use our own identifiers that indicate specific ABIs, rather than just
* hints regarding the register size, since we want to keep things open for multiple locally supported ABIs for
* the same register size. */
architecture = architecture_from_string(p);
architecture = architecture_from_string(s);
if (architecture < 0)
return PERSONALITY_INVALID;
@@ -1247,8 +1247,8 @@ bool nice_is_valid(int n) {
return n >= PRIO_MIN && n < PRIO_MAX;
}
bool sched_policy_is_valid(int i) {
return IN_SET(i, SCHED_OTHER, SCHED_BATCH, SCHED_IDLE, SCHED_FIFO, SCHED_RR, SCHED_EXT);
bool sched_policy_is_valid(int policy) {
return IN_SET(policy, SCHED_OTHER, SCHED_BATCH, SCHED_IDLE, SCHED_FIFO, SCHED_RR, SCHED_EXT);
}
bool sched_policy_supported(int policy) {
+6 -6
View File
@@ -101,8 +101,8 @@ bool oom_score_adjust_is_valid(int oa);
* personality we're interested in. */
#define OPINIONATED_PERSONALITY_MASK 0xFFUL
unsigned long personality_from_string(const char *p);
const char* personality_to_string(unsigned long);
unsigned long personality_from_string(const char *s);
const char* personality_to_string(unsigned long p);
int safe_personality(unsigned long p);
int opinionated_personality(unsigned long *ret);
@@ -124,10 +124,10 @@ int pid_compare_func(const pid_t *a, const pid_t *b);
bool nice_is_valid(int n) _const_;
bool sched_policy_is_valid(int i) _const_;
bool sched_policy_supported(int i);
int sched_get_priority_min_safe(int i);
int sched_get_priority_max_safe(int i);
bool sched_policy_is_valid(int policy) _const_;
bool sched_policy_supported(int policy);
int sched_get_priority_min_safe(int policy);
int sched_get_priority_max_safe(int policy);
#define PID_AUTOMATIC ((pid_t) INT_MIN) /* special value indicating "acquire pid from connection peer" */
-2
View File
@@ -15,7 +15,6 @@ ssize_t string_table_lookup_from_string_fallback(const char * const *table, size
/* For basic lookup tables with strictly enumerated entries */
#define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name, type, scope) \
/* NOLINTNEXTLINE (readability-inconsistent-declaration-parameter-name) */ \
scope const char* name##_to_string(type i) { \
return string_table_lookup_to_string(name##_table, ELEMENTSOF(name##_table), i); \
}
@@ -31,7 +30,6 @@ ssize_t string_table_lookup_from_string_fallback(const char * const *table, size
}
#define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING_FALLBACK(name, type, max, scope) \
/* NOLINTNEXTLINE (readability-inconsistent-declaration-parameter-name) */ \
scope int name##_to_string_alloc(type i, char **ret) { \
return string_table_lookup_to_string_fallback(name##_table, ELEMENTSOF(name##_table), i, max, ret); \
}
+1 -1
View File
@@ -124,7 +124,7 @@ bool terminal_is_dumb(void);
bool dev_console_colors_enabled(void);
int get_ctty_devnr(pid_t pid, dev_t *ret);
int get_ctty(pid_t, dev_t *ret_devnr, char **ret);
int get_ctty(pid_t pid, dev_t *ret_devnr, char **ret);
int getttyname_malloc(int fd, char **ret);
int getttyname_harder(int fd, char **ret);
+1 -1
View File
@@ -173,7 +173,7 @@ char* save_timezone(void);
bool clock_supported(clockid_t clock);
usec_t usec_shift_clock(usec_t, clockid_t from, clockid_t to);
usec_t usec_shift_clock(usec_t x, clockid_t from, clockid_t to);
int get_timezone(char **ret);
const char* etc_localtime(void);
+3
View File
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#if ENABLE_COMPAT_MUTABLE_UID_BOUNDARIES
#include <threads.h>
#include "chase.h"
@@ -7,6 +8,8 @@
#include "fileio.h"
#include "log.h"
#include "string-util.h"
#endif
#include "uid-classification.h"
#include "user-util.h"