tree-wide: mark set-but-not-used variables as unused to make LLVM happy
LLVM 13 introduced `-Wunused-but-set-variable` diagnostic flag, which
trips over some intentionally set-but-not-used variables or variables
attached to cleanup handlers with side effects (`_cleanup_umask_`,
`_cleanup_(notify_on_cleanup)`, `_cleanup_(restore_sigsetp)`, etc.):
```
../src/basic/process-util.c:1257:46: error: variable 'saved_ssp' set but not used [-Werror,-Wunused-but-set-variable]
_cleanup_(restore_sigsetp) sigset_t *saved_ssp = NULL;
^
1 error generated.
```
This commit is contained in:
@@ -90,7 +90,7 @@
|
||||
* Returns: 0 on success, negative error code on failure.
|
||||
*/
|
||||
int barrier_create(Barrier *b) {
|
||||
_cleanup_(barrier_destroyp) Barrier *staging = b;
|
||||
_unused_ _cleanup_(barrier_destroyp) Barrier *staging = b;
|
||||
int r;
|
||||
|
||||
assert(b);
|
||||
|
||||
@@ -81,7 +81,7 @@ int make_inaccessible_nodes(
|
||||
{ "inaccessible/blk", S_IFBLK | 0000 },
|
||||
};
|
||||
|
||||
_cleanup_umask_ mode_t u;
|
||||
_unused_ _cleanup_umask_ mode_t u;
|
||||
int r;
|
||||
|
||||
if (!parent_dir)
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "utmp-wtmp.h"
|
||||
|
||||
int utmp_get_runlevel(int *runlevel, int *previous) {
|
||||
_cleanup_(utxent_cleanup) bool utmpx = false;
|
||||
_unused_ _cleanup_(utxent_cleanup) bool utmpx = false;
|
||||
struct utmpx *found, lookup = { .ut_type = RUN_LVL };
|
||||
const char *e;
|
||||
|
||||
@@ -87,7 +87,7 @@ static void init_entry(struct utmpx *store, usec_t t) {
|
||||
}
|
||||
|
||||
static int write_entry_utmp(const struct utmpx *store) {
|
||||
_cleanup_(utxent_cleanup) bool utmpx = false;
|
||||
_unused_ _cleanup_(utxent_cleanup) bool utmpx = false;
|
||||
|
||||
assert(store);
|
||||
|
||||
@@ -215,7 +215,7 @@ int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line
|
||||
}
|
||||
|
||||
int utmp_put_dead_process(const char *id, pid_t pid, int code, int status) {
|
||||
_cleanup_(utxent_cleanup) bool utmpx = false;
|
||||
_unused_ _cleanup_(utxent_cleanup) bool utmpx = false;
|
||||
struct utmpx lookup = {
|
||||
.ut_type = INIT_PROCESS /* looks for DEAD_PROCESS, LOGIN_PROCESS, USER_PROCESS, too */
|
||||
}, store, store_wtmp, *found;
|
||||
@@ -340,7 +340,7 @@ int utmp_wall(
|
||||
bool (*match_tty)(const char *tty, void *userdata),
|
||||
void *userdata) {
|
||||
|
||||
_cleanup_(utxent_cleanup) bool utmpx = false;
|
||||
_unused_ _cleanup_(utxent_cleanup) bool utmpx = false;
|
||||
_cleanup_free_ char *text = NULL, *hn = NULL, *un = NULL, *stdin_tty = NULL;
|
||||
struct utmpx *u;
|
||||
int r;
|
||||
|
||||
Reference in New Issue
Block a user