Fixes for unused variables reported by clang (#44338)

This commit is contained in:
Zbigniew Jędrzejewski-Szmek authored and GitHub committed 2026-10-23 14:42:38 +02:00
commit da22c6eeed
5 files changed
+10 -16

No files matched your search

+4 -3
View File
@@ -7,9 +7,10 @@
#include "errno-util.h"
#include "log.h"
/* Akin to glibc's __abort_msg; which is private and we hence cannot
* use here. */
static char *log_abort_msg = NULL;
/* Akin to glibc's __abort_msg; which is private and we hence cannot use here. If an abort happened, this
* will contain a pointer to the formatted error message. Debuggers, core dump analyzers, and post-mortem
* analysis tools can extract the cause of a crash from the program core dump. */
static char _used_ _unused_ *log_abort_msg = NULL;
static void log_assert(
int level,
+1 -1
View File
@@ -21,7 +21,7 @@ int dlopen_many_sym_or_warn_sentinel(void **dlp, const char *filename, int log_l
dlopen_many_sym_or_warn_sentinel(dlp, filename, log_level, __VA_ARGS__, NULL)
#define DLSYM_PROTOTYPE(symbol) \
typeof(symbol)* sym_##symbol
typeof(&symbol) sym_##symbol
/* Macro useful for putting together variable/symbol name pairs when calling dlsym_many_or_warn(). Assumes
* that each library symbol to resolve will be placed in a variable with the "sym_" prefix, i.e. a symbol
+3 -10
View File
@@ -358,9 +358,7 @@ static EventLog* event_log_free(EventLog *el) {
DEFINE_TRIVIAL_CLEANUP_FUNC(EventLog*, event_log_free);
static EventLogRecord* event_log_record_new(EventLog *el) {
EventLogRecord *record;
record = new(EventLogRecord, 1);
EventLogRecord *record = new(EventLogRecord, 1);
if (!record)
return NULL;
@@ -379,15 +377,12 @@ static EventLogRecord* event_log_record_new(EventLog *el) {
static int event_log_add_record(
EventLog *el,
EventLogRecord **ret) {
_cleanup_(event_log_record_freep) EventLogRecord *record = NULL;
assert(el);
if (!GREEDY_REALLOC(el->records, el->n_records+1))
return -ENOMEM;
record = event_log_record_new(el);
EventLogRecord *record = event_log_record_new(el);
if (!record)
return -ENOMEM;
@@ -396,8 +391,6 @@ static int event_log_add_record(
if (ret)
*ret = record;
TAKE_PTR(record);
return 0;
}
@@ -947,7 +940,7 @@ static int event_log_add_firmware_record(
size_t payload_size,
EventLogRecord **ret) {
EventLogRecord *record = NULL;
EventLogRecord *record;
int r;
assert(el);
+1 -1
View File
@@ -8,7 +8,7 @@
static void* idn_dl = NULL;
DLSYM_PROTOTYPE(idn2_lookup_u8) = NULL;
const char *(*sym_idn2_strerror)(int rc) _const_ = NULL;
DLSYM_PROTOTYPE(idn2_strerror) = NULL;
DLSYM_PROTOTYPE(idn2_to_unicode_8z8z) = NULL;
#endif
+1 -1
View File
@@ -14,7 +14,7 @@
#include "dlfcn-util.h"
extern DLSYM_PROTOTYPE(idn2_lookup_u8);
extern const char *(*sym_idn2_strerror)(int rc) _const_;
extern DLSYM_PROTOTYPE(idn2_strerror);
extern DLSYM_PROTOTYPE(idn2_to_unicode_8z8z);
#endif