Fix warnings

This commit is contained in:
Boian Bonev 2022-04-06 06:55:28 +03:00
parent db3e14bc61
commit dce2732c37
No known key found for this signature in database
GPG Key ID: 1365720913D2F22D
33 changed files with 105 additions and 95 deletions

View File

@ -330,7 +330,7 @@ static void disk_identify_fixup_uint16 (uint8_t identify[512], unsigned int offs
* Returns: 0 if the data was successfully obtained, otherwise * Returns: 0 if the data was successfully obtained, otherwise
* non-zero with errno set. * non-zero with errno set.
*/ */
static int disk_identify(struct udev *udev, static int disk_identify(struct udev *udev __attribute__((unused)),
int fd, int fd,
uint8_t out_identify[512], uint8_t out_identify[512],
int *out_is_packet_device) int *out_is_packet_device)

View File

@ -126,7 +126,7 @@ static bool is_mounted(const char *device)
return mounted; return mounted;
} }
static void info_scsi_cmd_err(struct udev *udev, const char *cmd, int err) static void info_scsi_cmd_err(struct udev *udev __attribute__((unused)), const char *cmd, int err)
{ {
if (err == -1) { if (err == -1) {
log_debug("%s failed", cmd); log_debug("%s failed", cmd);
@ -144,7 +144,7 @@ struct scsi_cmd {
struct sg_io_hdr sg_io; struct sg_io_hdr sg_io;
}; };
static void scsi_cmd_init(struct udev *udev, struct scsi_cmd *cmd) static void scsi_cmd_init(struct udev *udev __attribute__((unused)), struct scsi_cmd *cmd)
{ {
memzero(cmd, sizeof(struct scsi_cmd)); memzero(cmd, sizeof(struct scsi_cmd));
cmd->cgc.quiet = 1; cmd->cgc.quiet = 1;
@ -156,7 +156,7 @@ static void scsi_cmd_init(struct udev *udev, struct scsi_cmd *cmd)
cmd->sg_io.flags = SG_FLAG_LUN_INHIBIT | SG_FLAG_DIRECT_IO; cmd->sg_io.flags = SG_FLAG_LUN_INHIBIT | SG_FLAG_DIRECT_IO;
} }
static void scsi_cmd_set(struct udev *udev, struct scsi_cmd *cmd, size_t i, unsigned char arg) static void scsi_cmd_set(struct udev *udev __attribute__((unused)), struct scsi_cmd *cmd, size_t i, unsigned char arg)
{ {
cmd->sg_io.cmd_len = i + 1; cmd->sg_io.cmd_len = i + 1;
cmd->cgc.cmd[i] = arg; cmd->cgc.cmd[i] = arg;
@ -164,7 +164,7 @@ static void scsi_cmd_set(struct udev *udev, struct scsi_cmd *cmd, size_t i, unsi
#define CHECK_CONDITION 0x01 #define CHECK_CONDITION 0x01
static int scsi_cmd_run(struct udev *udev, struct scsi_cmd *cmd, int fd, unsigned char *buf, size_t bufsize) static int scsi_cmd_run(struct udev *udev __attribute__((unused)), struct scsi_cmd *cmd, int fd, unsigned char *buf, size_t bufsize)
{ {
int ret = 0; int ret = 0;
@ -190,7 +190,7 @@ static int scsi_cmd_run(struct udev *udev, struct scsi_cmd *cmd, int fd, unsigne
return ret; return ret;
} }
static int media_lock(struct udev *udev, int fd, bool lock) static int media_lock(struct udev *udev __attribute__((unused)), int fd, bool lock)
{ {
int err; int err;
@ -223,7 +223,7 @@ static int media_eject(struct udev *udev, int fd)
return 0; return 0;
} }
static int cd_capability_compat(struct udev *udev, int fd) static int cd_capability_compat(struct udev *udev __attribute__((unused)), int fd)
{ {
int capability; int capability;
@ -250,7 +250,7 @@ static int cd_capability_compat(struct udev *udev, int fd)
return 0; return 0;
} }
static int cd_media_compat(struct udev *udev, int fd) static int cd_media_compat(struct udev *udev __attribute__((unused)), int fd)
{ {
if (ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT) != CDS_DISC_OK) { if (ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT) != CDS_DISC_OK) {
log_debug("CDROM_DRIVE_STATUS != CDS_DISC_OK"); log_debug("CDROM_DRIVE_STATUS != CDS_DISC_OK");
@ -285,7 +285,7 @@ static int cd_inquiry(struct udev *udev, int fd)
return 0; return 0;
} }
static void feature_profile_media(struct udev *udev, int cur_profile) static void feature_profile_media(struct udev *udev __attribute__((unused)), int cur_profile)
{ {
switch (cur_profile) { switch (cur_profile) {
case 0x03: case 0x03:
@ -394,7 +394,7 @@ static void feature_profile_media(struct udev *udev, int cur_profile)
} }
} }
static int feature_profiles(struct udev *udev, const unsigned char *profiles, size_t size) static int feature_profiles(struct udev *udev __attribute__((unused)), const unsigned char *profiles, size_t size)
{ {
unsigned int i; unsigned int i;

View File

@ -65,7 +65,7 @@ static inline struct _mate *node_to_mate(struct udev_list_node *node)
return container_of(node, struct _mate, node); return container_of(node, struct _mate, node);
} }
noreturn static void sig_alrm(int signo) noreturn static void sig_alrm(int signo __attribute__((unused)))
{ {
exit(4); exit(4);
} }

View File

@ -215,7 +215,7 @@ static int syspath_cmp(const void *p1, const void *p2)
} }
/* For devices that should be moved to the absolute end of the list */ /* For devices that should be moved to the absolute end of the list */
static bool devices_delay_end(struct udev *udev, const char *syspath) static bool devices_delay_end(struct udev *udev __attribute__((unused)), const char *syspath)
{ {
static const char *delay_device_list[] = { static const char *delay_device_list[] = {
"/block/md", "/block/md",
@ -234,7 +234,7 @@ static bool devices_delay_end(struct udev *udev, const char *syspath)
/* For devices that should just be moved a little bit later, just /* For devices that should just be moved a little bit later, just
* before the point where some common path prefix changes. Returns the * before the point where some common path prefix changes. Returns the
* number of characters that make up that common prefix */ * number of characters that make up that common prefix */
static size_t devices_delay_later(struct udev *udev, const char *syspath) static size_t devices_delay_later(struct udev *udev __attribute__((unused)), const char *syspath)
{ {
const char *c; const char *c;

View File

@ -379,7 +379,7 @@ bool udev_hwdb_validate(struct udev_hwdb *hwdb) {
* *
* Returns: a udev_list_entry. * Returns: a udev_list_entry.
*/ */
_public_ struct udev_list_entry *udev_hwdb_get_properties_list_entry(struct udev_hwdb *hwdb, const char *modalias, unsigned int flags) { _public_ struct udev_list_entry *udev_hwdb_get_properties_list_entry(struct udev_hwdb *hwdb, const char *modalias, unsigned int flags __attribute__((unused))) {
int err; int err;
if (!hwdb || !hwdb->f) { if (!hwdb || !hwdb->f) {

View File

@ -107,7 +107,7 @@ static struct udev_monitor *udev_monitor_new(struct udev *udev)
} }
/* we consider udev running when /dev is on devtmpfs */ /* we consider udev running when /dev is on devtmpfs */
static bool udev_has_devtmpfs(struct udev *udev) { __attribute__((unused)) static bool udev_has_devtmpfs(struct udev *udev __attribute__((unused))) {
union file_handle_union h = FILE_HANDLE_INIT; union file_handle_union h = FILE_HANDLE_INIT;
_cleanup_fclose_ FILE *f = NULL; _cleanup_fclose_ FILE *f = NULL;

View File

@ -139,7 +139,7 @@ _public_ struct udev *udev_queue_get_udev(struct udev_queue *udev_queue)
* *
* Returns: 0. * Returns: 0.
**/ **/
_public_ unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue) _public_ unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue __attribute__((unused)))
{ {
return 0; return 0;
} }
@ -152,7 +152,7 @@ _public_ unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *
* *
* Returns: 0. * Returns: 0.
**/ **/
_public_ unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) _public_ unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue __attribute__((unused)))
{ {
return 0; return 0;
} }
@ -165,7 +165,7 @@ _public_ unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *ud
* *
* Returns: a flag indicating if udev is active. * Returns: a flag indicating if udev is active.
**/ **/
_public_ int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) _public_ int udev_queue_get_udev_is_active(struct udev_queue *udev_queue __attribute__((unused)))
{ {
return access(UDEV_ROOT_RUN "/udev/control", F_OK) >= 0; return access(UDEV_ROOT_RUN "/udev/control", F_OK) >= 0;
} }
@ -178,7 +178,7 @@ _public_ int udev_queue_get_udev_is_active(struct udev_queue *udev_queue)
* *
* Returns: a flag indicating if udev is currently handling events. * Returns: a flag indicating if udev is currently handling events.
**/ **/
_public_ int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) _public_ int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue __attribute__((unused)))
{ {
return access(UDEV_ROOT_RUN "/udev/queue", F_OK) < 0; return access(UDEV_ROOT_RUN "/udev/queue", F_OK) < 0;
} }
@ -195,7 +195,7 @@ _public_ int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue)
* Returns: a flag indicating if udev is currently handling events. * Returns: a flag indicating if udev is currently handling events.
**/ **/
_public_ int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, _public_ int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue,
unsigned long long int start, unsigned long long int end) unsigned long long int start __attribute__((unused)), unsigned long long int end __attribute__((unused)))
{ {
return udev_queue_get_queue_is_empty(udev_queue); return udev_queue_get_queue_is_empty(udev_queue);
} }
@ -210,7 +210,7 @@ _public_ int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_
* *
* Returns: a flag indicating if udev is currently handling events. * Returns: a flag indicating if udev is currently handling events.
**/ **/
_public_ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum) _public_ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum __attribute__((unused)))
{ {
return udev_queue_get_queue_is_empty(udev_queue); return udev_queue_get_queue_is_empty(udev_queue);
} }
@ -223,7 +223,7 @@ _public_ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, un
* *
* Returns: NULL. * Returns: NULL.
**/ **/
_public_ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue) _public_ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue __attribute__((unused)))
{ {
return NULL; return NULL;
} }

View File

@ -111,7 +111,7 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string,
return 0; return 0;
} }
ssize_t util_get_sys_core_link_value(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size) ssize_t util_get_sys_core_link_value(struct udev *udev __attribute__((unused)), const char *slink, const char *syspath, char *value, size_t size)
{ {
char path[UTIL_PATH_SIZE]; char path[UTIL_PATH_SIZE];
char target[UTIL_PATH_SIZE]; char target[UTIL_PATH_SIZE];
@ -130,7 +130,7 @@ ssize_t util_get_sys_core_link_value(struct udev *udev, const char *slink, const
return strscpy(value, size, pos); return strscpy(value, size, pos);
} }
int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size) int util_resolve_sys_link(struct udev *udev __attribute__((unused)), char *syspath, size_t size)
{ {
char link_target[UTIL_PATH_SIZE]; char link_target[UTIL_PATH_SIZE];

View File

@ -221,10 +221,10 @@ _public_ struct udev *udev_unref(struct udev *udev) {
* This function is deprecated. * This function is deprecated.
* *
**/ **/
_public_ void udev_set_log_fn(struct udev *udev, _public_ void udev_set_log_fn(struct udev *udev __attribute__((unused)),
void (*log_fn)(struct udev *udev, void (*log_fn)(struct udev *udev,
int priority, const char *file, int line, const char *fn, int priority, const char *file, int line, const char *fn,
const char *format, va_list args)) { const char *format, va_list args) __attribute__((unused))) {
return; return;
} }
@ -235,7 +235,7 @@ _public_ void udev_set_log_fn(struct udev *udev,
* This function is deprecated. * This function is deprecated.
* *
**/ **/
_public_ int udev_get_log_priority(struct udev *udev) { _public_ int udev_get_log_priority(struct udev *udev __attribute__((unused))) {
return log_get_max_level(); return log_get_max_level();
} }
@ -247,6 +247,6 @@ _public_ int udev_get_log_priority(struct udev *udev) {
* This function is deprecated. * This function is deprecated.
* *
**/ **/
_public_ void udev_set_log_priority(struct udev *udev, int priority) { _public_ void udev_set_log_priority(struct udev *udev __attribute__((unused)), int priority) {
log_set_max_level(priority); log_set_max_level(priority);
} }

View File

@ -155,7 +155,7 @@ static int argc_count(char *opts)
* *
* vendor and model can end in '\n'. * vendor and model can end in '\n'.
*/ */
static int get_file_options(struct udev *udev, static int get_file_options(struct udev *udev __attribute__((unused)),
const char *vendor, const char *model, const char *vendor, const char *model,
int *argc, char ***newargv) int *argc, char ***newargv)
{ {
@ -320,7 +320,7 @@ static void help(void) {
} }
static int set_options(struct udev *udev, static int set_options(struct udev *udev __attribute__((unused)),
int argc, char **argv, int argc, char **argv,
char *maj_min_dev) char *maj_min_dev)
{ {
@ -410,7 +410,7 @@ static int set_options(struct udev *udev,
} }
static int per_dev_options(struct udev *udev, static int per_dev_options(struct udev *udev,
struct scsi_id_device *dev_scsi, int *good_bad, int *page_code) struct scsi_id_device *dev_scsi __attribute__((unused)), int *good_bad, int *page_code)
{ {
int retval; int retval;
int newargc; int newargc;

View File

@ -104,8 +104,8 @@ static int do_scsi_page80_inquiry(struct udev *udev,
struct scsi_id_device *dev_scsi, int fd, struct scsi_id_device *dev_scsi, int fd,
char *serial, char *serial_short, int max_len); char *serial, char *serial_short, int max_len);
static int sg_err_category_new(struct udev *udev, static int sg_err_category_new(struct udev *udev __attribute__((unused)),
int scsi_status, int msg_status, int int scsi_status, int msg_status __attribute__((unused)), int
host_status, int driver_status, const host_status, int driver_status, const
unsigned char *sense_buffer, int sb_len) unsigned char *sense_buffer, int sb_len)
{ {
@ -169,7 +169,7 @@ static int sg_err_category4(struct udev *udev, struct sg_io_v4 *hp) {
hp->response_len); hp->response_len);
} }
static int scsi_dump_sense(struct udev *udev, static int scsi_dump_sense(struct udev *udev __attribute__((unused)),
struct scsi_id_device *dev_scsi, struct scsi_id_device *dev_scsi,
unsigned char *sense_buffer, int sb_len) { unsigned char *sense_buffer, int sb_len) {
int s; int s;
@ -449,7 +449,7 @@ static int append_vendor_model(
* check_fill_0x83_id - check the page 0x83 id, if OK allocate and fill * check_fill_0x83_id - check the page 0x83 id, if OK allocate and fill
* serial number. * serial number.
*/ */
static int check_fill_0x83_id(struct udev *udev, static int check_fill_0x83_id(struct udev *udev __attribute__((unused)),
struct scsi_id_device *dev_scsi, struct scsi_id_device *dev_scsi,
unsigned char *page_83, unsigned char *page_83,
const struct scsi_id_search_values const struct scsi_id_search_values
@ -560,11 +560,11 @@ static int check_fill_0x83_id(struct udev *udev,
} }
/* Extract the raw binary from VPD 0x83 pre-SPC devices */ /* Extract the raw binary from VPD 0x83 pre-SPC devices */
static int check_fill_0x83_prespc3(struct udev *udev, static int check_fill_0x83_prespc3(struct udev *udev __attribute__((unused)),
struct scsi_id_device *dev_scsi, struct scsi_id_device *dev_scsi __attribute__((unused)),
unsigned char *page_83, unsigned char *page_83,
const struct scsi_id_search_values const struct scsi_id_search_values
*id_search, char *serial, char *serial_short, int max_len) { *id_search __attribute__((unused)), char *serial, char *serial_short, int max_len) {
int i, j; int i, j;
serial[0] = hex_str[SCSI_ID_NAA]; serial[0] = hex_str[SCSI_ID_NAA];
@ -674,7 +674,7 @@ static int do_scsi_page83_inquiry(struct udev *udev,
*/ */
static int do_scsi_page83_prespc3_inquiry(struct udev *udev, static int do_scsi_page83_prespc3_inquiry(struct udev *udev,
struct scsi_id_device *dev_scsi, int fd, struct scsi_id_device *dev_scsi, int fd,
char *serial, char *serial_short, int len) { char *serial, char *serial_short __attribute__((unused)), int len __attribute__((unused))) {
int retval; int retval;
int i, j; int i, j;
unsigned char page_83[SCSI_INQ_BUFF_LEN]; unsigned char page_83[SCSI_INQ_BUFF_LEN];

View File

@ -70,7 +70,9 @@ uint32_t MurmurHash2 ( const void * key, int len, uint32_t seed )
switch(len) switch(len)
{ {
case 3: h ^= data[2] << 16; case 3: h ^= data[2] << 16;
// fall through
case 2: h ^= data[1] << 8; case 2: h ^= data[1] << 8;
// fall through
case 1: h ^= data[0]; case 1: h ^= data[0];
h *= m; h *= m;
}; };

View File

@ -238,12 +238,12 @@ void log_set_max_level(int level) {
static int write_to_console( static int write_to_console(
int level, int level,
int error, int error __attribute__((unused)),
const char *file, const char *file,
int line, int line,
const char *func, const char *func __attribute__((unused)),
const char *object_field, const char *object_field __attribute__((unused)),
const char *object, const char *object __attribute__((unused)),
const char *buffer) { const char *buffer) {
char location[64], prefix[1 + DECIMAL_STR_MAX(int) + 2]; char location[64], prefix[1 + DECIMAL_STR_MAX(int) + 2];
@ -299,12 +299,12 @@ static int write_to_console(
static int write_to_syslog( static int write_to_syslog(
int level, int level,
int error, int error __attribute__((unused)),
const char *file, const char *file __attribute__((unused)),
int line, int line __attribute__((unused)),
const char *func, const char *func __attribute__((unused)),
const char *object_field, const char *object_field __attribute__((unused)),
const char *object, const char *object __attribute__((unused)),
const char *buffer) { const char *buffer) {
char header_priority[1 + DECIMAL_STR_MAX(int) + 2], header_time[64], header_pid[1 + DECIMAL_STR_MAX(pid_t) + 4]; char header_priority[1 + DECIMAL_STR_MAX(int) + 2], header_time[64], header_pid[1 + DECIMAL_STR_MAX(pid_t) + 4];
@ -362,12 +362,12 @@ static int write_to_syslog(
static int write_to_kmsg( static int write_to_kmsg(
int level, int level,
int error, int error __attribute__((unused)),
const char*file, const char *file __attribute__((unused)),
int line, int line __attribute__((unused)),
const char *func, const char *func __attribute__((unused)),
const char *object_field, const char *object_field __attribute__((unused)),
const char *object, const char *object __attribute__((unused)),
const char *buffer) { const char *buffer) {
char header_priority[1 + DECIMAL_STR_MAX(int) + 2], header_pid[1 + DECIMAL_STR_MAX(pid_t) + 4]; char header_priority[1 + DECIMAL_STR_MAX(int) + 2], header_pid[1 + DECIMAL_STR_MAX(pid_t) + 4];

View File

@ -69,7 +69,7 @@ int mkdir_parents_internal(const char *prefix, const char *path, mode_t mode, mk
char buf[PATH_MAX + 1]; char buf[PATH_MAX + 1];
p = buf; p = buf;
assert(e-path < sizeof(buf)); assert(e-path < (ssize_t)sizeof(buf));
memcpy(buf, path, e-path); memcpy(buf, path, e-path);
buf[e-path] = 0; buf[e-path] = 0;

View File

@ -92,16 +92,22 @@ void siphash24(uint8_t out[8], const void *_in, size_t inlen, const uint8_t k[16
switch( left ) switch( left )
{ {
case 7: b |= ( ( u64 )in[ 6] ) << 48; case 7: b |= ( ( u64 )in[ 6] ) << 48;
// fall through
case 6: b |= ( ( u64 )in[ 5] ) << 40; case 6: b |= ( ( u64 )in[ 5] ) << 40;
// fall through
case 5: b |= ( ( u64 )in[ 4] ) << 32; case 5: b |= ( ( u64 )in[ 4] ) << 32;
// fall through
case 4: b |= ( ( u64 )in[ 3] ) << 24; case 4: b |= ( ( u64 )in[ 3] ) << 24;
// fall through
case 3: b |= ( ( u64 )in[ 2] ) << 16; case 3: b |= ( ( u64 )in[ 2] ) << 16;
// fall through
case 2: b |= ( ( u64 )in[ 1] ) << 8; case 2: b |= ( ( u64 )in[ 1] ) << 8;
// fall through
case 1: b |= ( ( u64 )in[ 0] ); break; case 1: b |= ( ( u64 )in[ 0] ); break;

View File

@ -45,7 +45,7 @@ bool mac_smack_use(void) {
#endif #endif
} }
int mac_smack_apply(const char *path, const char *label) { int mac_smack_apply(const char *path, const char *label __attribute__((unused))) {
int r = 0; int r = 0;
assert(path); assert(path);
@ -65,7 +65,7 @@ int mac_smack_apply(const char *path, const char *label) {
return r; return r;
} }
int mac_smack_apply_fd(int fd, const char *label) { int mac_smack_apply_fd(int fd, const char *label __attribute__((unused))) {
int r = 0; int r = 0;
assert(fd >= 0); assert(fd >= 0);
@ -85,7 +85,7 @@ int mac_smack_apply_fd(int fd, const char *label) {
return r; return r;
} }
int mac_smack_apply_ip_out_fd(int fd, const char *label) { int mac_smack_apply_ip_out_fd(int fd, const char *label __attribute__((unused))) {
int r = 0; int r = 0;
assert(fd >= 0); assert(fd >= 0);
@ -105,7 +105,7 @@ int mac_smack_apply_ip_out_fd(int fd, const char *label) {
return r; return r;
} }
int mac_smack_apply_ip_in_fd(int fd, const char *label) { int mac_smack_apply_ip_in_fd(int fd, const char *label __attribute__((unused))) {
int r = 0; int r = 0;
assert(fd >= 0); assert(fd >= 0);
@ -125,7 +125,7 @@ int mac_smack_apply_ip_in_fd(int fd, const char *label) {
return r; return r;
} }
int mac_smack_apply_pid(pid_t pid, const char *label) { int mac_smack_apply_pid(pid_t pid __attribute__((unused)), const char *label) {
#ifdef HAVE_SMACK #ifdef HAVE_SMACK
const char *p; const char *p;
@ -147,7 +147,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
return r; return r;
} }
int mac_smack_fix(const char *path, bool ignore_enoent, bool ignore_erofs) { int mac_smack_fix(const char *path, bool ignore_enoent __attribute__((unused)), bool ignore_erofs __attribute__((unused))) {
#ifdef HAVE_SMACK #ifdef HAVE_SMACK
struct stat st; struct stat st;

View File

@ -154,6 +154,7 @@ bool hidden_file(const char *filename) _pure_;
/* For basic lookup tables with strictly enumerated entries */ /* For basic lookup tables with strictly enumerated entries */
#define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,scope) \ #define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,scope) \
__attribute__((unused)) \
scope const char *name##_to_string(type i) { \ scope const char *name##_to_string(type i) { \
if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \
return NULL; \ return NULL; \
@ -161,6 +162,7 @@ bool hidden_file(const char *filename) _pure_;
} }
#define _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(name,type,scope) \ #define _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(name,type,scope) \
__attribute__((unused)) \
scope type name##_from_string(const char *s) { \ scope type name##_from_string(const char *s) { \
type i; \ type i; \
if (!s) \ if (!s) \

View File

@ -199,12 +199,12 @@ static int builtin_hwdb_init(struct udev *udev) {
} }
/* called on udev shutdown and reload request */ /* called on udev shutdown and reload request */
static void builtin_hwdb_exit(struct udev *udev) { static void builtin_hwdb_exit(struct udev *udev __attribute__((unused))) {
hwdb = udev_hwdb_unref(hwdb); hwdb = udev_hwdb_unref(hwdb);
} }
/* called every couple of seconds during event activity; 'true' if config has changed */ /* called every couple of seconds during event activity; 'true' if config has changed */
static bool builtin_hwdb_validate(struct udev *udev) { static bool builtin_hwdb_validate(struct udev *udev __attribute__((unused))) {
return udev_hwdb_validate(hwdb); return udev_hwdb_validate(hwdb);
} }

View File

@ -87,7 +87,7 @@ static void extract_info(struct udev_device *dev, const char *devpath, bool test
* @param attr sysfs attribute name (e. g. "capabilities/key") * @param attr sysfs attribute name (e. g. "capabilities/key")
* @param bitmask: Output array which has a sizeof of bitmask_size * @param bitmask: Output array which has a sizeof of bitmask_size
*/ */
static void get_cap_mask(struct udev_device *dev, static void get_cap_mask(struct udev_device *dev __attribute__((unused)),
struct udev_device *pdev, const char* attr, struct udev_device *pdev, const char* attr,
unsigned long *bitmask, size_t bitmask_size, unsigned long *bitmask, size_t bitmask_size,
bool test) { bool test) {
@ -312,7 +312,7 @@ static bool test_key(struct udev_device *dev,
return ret; return ret;
} }
static int builtin_input_id(struct udev_device *dev, int argc, char *argv[], bool test) { static int builtin_input_id(struct udev_device *dev, int argc __attribute__((unused)), char *argv[] __attribute__((unused)), bool test) {
struct udev_device *pdev; struct udev_device *pdev;
unsigned long bitmask_ev[NBITS(EV_MAX)]; unsigned long bitmask_ev[NBITS(EV_MAX)];
unsigned long bitmask_abs[NBITS(ABS_MAX)]; unsigned long bitmask_abs[NBITS(ABS_MAX)];

View File

@ -185,7 +185,7 @@ static int open_device(const char *devnode) {
return fd; return fd;
} }
static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], bool test) { static int builtin_keyboard(struct udev_device *dev, int argc __attribute__((unused)), char *argv[] __attribute__((unused)), bool test __attribute__((unused))) {
struct udev_list_entry *entry; struct udev_list_entry *entry;
unsigned release[1024]; unsigned release[1024];
unsigned release_count = 0; unsigned release_count = 0;

View File

@ -33,7 +33,7 @@
static struct kmod_ctx *ctx = NULL; static struct kmod_ctx *ctx = NULL;
static int load_module(struct udev *udev, const char *alias) { static int load_module(struct udev *udev __attribute__((unused)), const char *alias) {
struct kmod_list *list = NULL; struct kmod_list *list = NULL;
struct kmod_list *l; struct kmod_list *l;
int err; int err;
@ -63,11 +63,11 @@ static int load_module(struct udev *udev, const char *alias) {
return err; return err;
} }
_printf_(6,0) static void udev_kmod_log(void *data, int priority, const char *file, int line, const char *fn, const char *format, va_list args) { _printf_(6,0) static void udev_kmod_log(void *data __attribute__((unused)), int priority, const char *file, int line, const char *fn, const char *format, va_list args) {
log_internalv(priority, 0, file, line, fn, format, args); log_internalv(priority, 0, file, line, fn, format, args);
} }
static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool test) { static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool test __attribute__((unused))) {
struct udev *udev = udev_device_get_udev(dev); struct udev *udev = udev_device_get_udev(dev);
int i; int i;
@ -103,13 +103,13 @@ static int builtin_kmod_init(struct udev *udev) {
} }
/* called on udev shutdown and reload request */ /* called on udev shutdown and reload request */
static void builtin_kmod_exit(struct udev *udev) { static void builtin_kmod_exit(struct udev *udev __attribute__((unused))) {
log_debug("Unload module index"); log_debug("Unload module index");
ctx = kmod_unref(ctx); ctx = kmod_unref(ctx);
} }
/* called every couple of seconds during event activity; 'true' if config has changed */ /* called every couple of seconds during event activity; 'true' if config has changed */
static bool builtin_kmod_validate(struct udev *udev) { static bool builtin_kmod_validate(struct udev *udev __attribute__((unused))) {
log_debug("Validate module index"); log_debug("Validate module index");
if (!ctx) if (!ctx)
return false; return false;

View File

@ -192,7 +192,7 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) {
char *s; char *s;
const char *attr; const char *attr;
struct udev_device *pci = NULL; struct udev_device *pci = NULL;
char slots[256], str[256]; char slots[256], str[520];
_cleanup_closedir_ DIR *dir = NULL; _cleanup_closedir_ DIR *dir = NULL;
struct dirent *dent; struct dirent *dent;
int hotplug_slot = 0, err = 0; int hotplug_slot = 0, err = 0;
@ -452,7 +452,7 @@ static int ieee_oui(struct udev_device *dev, struct netnames *names, bool test)
return 0; return 0;
} }
static int builtin_net_id(struct udev_device *dev, int argc, char *argv[], bool test) { static int builtin_net_id(struct udev_device *dev, int argc __attribute__((unused)), char *argv[] __attribute__((unused)), bool test) {
const char *s; const char *s;
const char *p; const char *p;
unsigned int i; unsigned int i;

View File

@ -576,7 +576,7 @@ out:
return parent; return parent;
} }
static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool test) { static int builtin_path_id(struct udev_device *dev, int argc __attribute__((unused)), char *argv[] __attribute__((unused)), bool test) {
struct udev_device *parent; struct udev_device *parent;
char *path = NULL; char *path = NULL;
bool supported_transport = false; bool supported_transport = false;

View File

@ -228,7 +228,7 @@ static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len
* 6.) If the device supplies a serial number, this number * 6.) If the device supplies a serial number, this number
* is concatenated with the identification with an underscore '_'. * is concatenated with the identification with an underscore '_'.
*/ */
static int builtin_usb_id(struct udev_device *dev, int argc, char *argv[], bool test) { static int builtin_usb_id(struct udev_device *dev, int argc __attribute__((unused)), char *argv[] __attribute__((unused)), bool test) {
char vendor_str[64] = ""; char vendor_str[64] = "";
char vendor_str_enc[256]; char vendor_str_enc[256];
const char *vendor_id; const char *vendor_id;

View File

@ -80,7 +80,7 @@ bool udev_builtin_validate(struct udev *udev) {
return false; return false;
} }
void udev_builtin_list(struct udev *udev) { void udev_builtin_list(struct udev *udev __attribute__((unused))) {
unsigned int i; unsigned int i;
for (i = 0; i < ELEMENTSOF(builtins); i++) for (i = 0; i < ELEMENTSOF(builtins); i++)

View File

@ -406,7 +406,7 @@ out:
return l; return l;
} }
static int spawn_exec(struct udev_event *event, static int spawn_exec(struct udev_event *event __attribute__((unused)),
const char *cmd, char *const argv[], char **envp, const sigset_t *sigmask, const char *cmd, char *const argv[], char **envp, const sigset_t *sigmask,
int fd_stdout, int fd_stderr) { int fd_stdout, int fd_stderr) {
_cleanup_close_ int fd = -1; _cleanup_close_ int fd = -1;
@ -671,7 +671,7 @@ out:
return err; return err;
} }
int udev_build_argv(struct udev *udev, char *cmd, int *argc, char *argv[]) { int udev_build_argv(struct udev *udev __attribute__((unused)), char *cmd, int *argc, char *argv[]) {
int i = 0; int i = 0;
char *pos; char *pos;
@ -810,7 +810,7 @@ out:
int udev_rules_assigning_name_to(struct udev_rules *rules,const char *match_name); int udev_rules_assigning_name_to(struct udev_rules *rules,const char *match_name);
#endif #endif
static int rename_netif_dev_fromname_toname(struct udev_device *dev,const char *oldname,const char *name) { static int rename_netif_dev_fromname_toname(struct udev_device *dev __attribute__((unused)),const char *oldname,const char *name) {
int r; int r;
int sk; int sk;
struct ifreq ifr; struct ifreq ifr;

View File

@ -444,8 +444,8 @@ static void dump_rules(struct udev_rules *rules) {
dump_token(rules, &rules->tokens[i]); dump_token(rules, &rules->tokens[i]);
} }
#else #else
static inline void dump_token(struct udev_rules *rules, struct token *token) {} static inline void dump_token(struct udev_rules *rules __attribute__((unused)), struct token *token __attribute__((unused))) {}
static inline void dump_rules(struct udev_rules *rules) {} static inline void dump_rules(struct udev_rules *rules __attribute__((unused))) {}
#endif /* DEBUG */ #endif /* DEBUG */
static int add_token(struct udev_rules *rules, struct token *token) { static int add_token(struct udev_rules *rules, struct token *token) {
@ -757,7 +757,7 @@ static int attr_subst_subdir(char *attr, size_t len) {
return found; return found;
} }
static int get_key(struct udev *udev, char **line, char **key, enum operation_type *op, char **value) { static int get_key(struct udev *udev __attribute__((unused)), char **line, char **key, enum operation_type *op, char **value) {
char *linepos; char *linepos;
char *temp; char *temp;
unsigned i, j; unsigned i, j;
@ -859,7 +859,7 @@ static int get_key(struct udev *udev, char **line, char **key, enum operation_ty
} }
/* extract possible KEY{attr} */ /* extract possible KEY{attr} */
static const char *get_key_attribute(struct udev *udev, char *str) { static const char *get_key_attribute(struct udev *udev __attribute__((unused)), char *str) {
char *pos; char *pos;
char *attr; char *attr;

View File

@ -36,7 +36,7 @@ static int inotify_fd = -1;
* set to cloexec since we need our children to be able to add * set to cloexec since we need our children to be able to add
* watches for us * watches for us
*/ */
int udev_watch_init(struct udev *udev) { int udev_watch_init(struct udev *udev __attribute__((unused))) {
inotify_fd = inotify_init1(IN_CLOEXEC); inotify_fd = inotify_init1(IN_CLOEXEC);
if (inotify_fd < 0) if (inotify_fd < 0)
log_error_errno(errno, "inotify_init failed: %m"); log_error_errno(errno, "inotify_init failed: %m");
@ -92,7 +92,7 @@ unlink:
} }
} }
void udev_watch_begin(struct udev *udev, struct udev_device *dev) { void udev_watch_begin(struct udev *udev __attribute__((unused)), struct udev_device *dev) {
char filename[UTIL_PATH_SIZE]; char filename[UTIL_PATH_SIZE];
int wd; int wd;
int r; int r;
@ -118,7 +118,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev) {
udev_device_set_watch_handle(dev, wd); udev_device_set_watch_handle(dev, wd);
} }
void udev_watch_end(struct udev *udev, struct udev_device *dev) { void udev_watch_end(struct udev *udev __attribute__((unused)), struct udev_device *dev) {
int wd; int wd;
char filename[UTIL_PATH_SIZE]; char filename[UTIL_PATH_SIZE];

View File

@ -422,7 +422,7 @@ static int trie_store(struct trie *trie, const char *filename) {
} }
static int insert_data(struct trie *trie, struct udev_list *match_list, static int insert_data(struct trie *trie, struct udev_list *match_list,
char *line, const char *filename) { char *line, const char *filename __attribute__((unused))) {
char *value; char *value;
struct udev_list_entry *entry; struct udev_list_entry *entry;

View File

@ -221,7 +221,7 @@ static void cleanup_dir(DIR *dir, mode_t mask, int depth) {
} }
} }
static void cleanup_db(struct udev *udev) { static void cleanup_db(struct udev *udev __attribute__((unused))) {
DIR *dir; DIR *dir;
unlink(UDEV_ROOT_RUN "/udev/queue.bin"); unlink(UDEV_ROOT_RUN "/udev/queue.bin");

View File

@ -26,7 +26,7 @@
#include "udev.h" #include "udev.h"
static int adm_version(struct udev *udev, int argc, char *argv[]) { static int adm_version(struct udev *udev __attribute__((unused)), int argc __attribute__((unused)), char *argv[] __attribute__((unused))) {
printf("%s\n", UDEV_VERSION); printf("%s\n", UDEV_VERSION);
return 0; return 0;
} }
@ -56,7 +56,7 @@ static const struct udevadm_cmd *udevadm_cmds[] = {
&udevadm_help, &udevadm_help,
}; };
static int adm_help(struct udev *udev, int argc, char *argv[]) { static int adm_help(struct udev *udev __attribute__((unused)), int argc __attribute__((unused)), char *argv[] __attribute__((unused))) {
unsigned int i; unsigned int i;
printf("%s [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]\n\n" printf("%s [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]\n\n"

View File

@ -584,7 +584,7 @@ static bool is_devpath_busy(struct event *event) {
return false; return false;
} }
static void event_queue_start(struct udev *udev) { static void event_queue_start(struct udev *udev __attribute__((unused))) {
struct udev_list_node *loop; struct udev_list_node *loop;
udev_list_node_foreach(loop, &event_list) { udev_list_node_foreach(loop, &event_list) {
@ -601,7 +601,7 @@ static void event_queue_start(struct udev *udev) {
} }
} }
static void event_queue_cleanup(struct udev *udev, enum event_state match_type) { static void event_queue_cleanup(struct udev *udev __attribute__((unused)), enum event_state match_type) {
struct udev_list_node *loop, *tmp; struct udev_list_node *loop, *tmp;
udev_list_node_foreach_safe(loop, tmp, &event_list) { udev_list_node_foreach_safe(loop, tmp, &event_list) {
@ -920,7 +920,7 @@ static int handle_inotify(struct udev *udev) {
return 0; return 0;
} }
static void handle_signal(struct udev *udev, int signo) { static void handle_signal(struct udev *udev __attribute__((unused)), int signo) {
switch (signo) { switch (signo) {
case SIGINT: case SIGINT:
case SIGTERM: case SIGTERM:

View File

@ -86,7 +86,7 @@ out:
return err; return err;
} }
int main(int argc, char *argv[]) { int main(int argc __attribute__((unused)), char *argv[]) {
_cleanup_udev_unref_ struct udev *udev = NULL; _cleanup_udev_unref_ struct udev *udev = NULL;
_cleanup_udev_event_unref_ struct udev_event *event = NULL; _cleanup_udev_event_unref_ struct udev_event *event = NULL;
_cleanup_udev_device_unref_ struct udev_device *dev = NULL; _cleanup_udev_device_unref_ struct udev_device *dev = NULL;