From dce2732c378656c708baeb4e9a1e2a775372ca66 Mon Sep 17 00:00:00 2001 From: Boian Bonev Date: Wed, 6 Apr 2022 06:55:28 +0300 Subject: [PATCH] Fix warnings --- src/ata_id/ata_id.c | 2 +- src/cdrom_id/cdrom_id.c | 18 +++++++++--------- src/collect/collect.c | 2 +- src/libudev/libudev-enumerate.c | 4 ++-- src/libudev/libudev-hwdb.c | 2 +- src/libudev/libudev-monitor.c | 2 +- src/libudev/libudev-queue.c | 14 +++++++------- src/libudev/libudev-util.c | 4 ++-- src/libudev/libudev.c | 8 ++++---- src/scsi_id/scsi_id.c | 6 +++--- src/scsi_id/scsi_serial.c | 16 ++++++++-------- src/shared/MurmurHash2.c | 2 ++ src/shared/log.c | 32 ++++++++++++++++---------------- src/shared/mkdir.c | 2 +- src/shared/siphash24.c | 6 ++++++ src/shared/smack-util.c | 12 ++++++------ src/shared/util.h | 2 ++ src/udev/udev-builtin-hwdb.c | 4 ++-- src/udev/udev-builtin-input_id.c | 4 ++-- src/udev/udev-builtin-keyboard.c | 2 +- src/udev/udev-builtin-kmod.c | 10 +++++----- src/udev/udev-builtin-net_id.c | 4 ++-- src/udev/udev-builtin-path_id.c | 2 +- src/udev/udev-builtin-usb_id.c | 2 +- src/udev/udev-builtin.c | 2 +- src/udev/udev-event.c | 6 +++--- src/udev/udev-rules.c | 8 ++++---- src/udev/udev-watch.c | 6 +++--- src/udev/udevadm-hwdb.c | 2 +- src/udev/udevadm-info.c | 2 +- src/udev/udevadm.c | 4 ++-- src/udev/udevd.c | 6 +++--- test/test-udev.c | 2 +- 33 files changed, 105 insertions(+), 95 deletions(-) diff --git a/src/ata_id/ata_id.c b/src/ata_id/ata_id.c index 65e595d83..fbc14de69 100644 --- a/src/ata_id/ata_id.c +++ b/src/ata_id/ata_id.c @@ -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 * non-zero with errno set. */ -static int disk_identify(struct udev *udev, +static int disk_identify(struct udev *udev __attribute__((unused)), int fd, uint8_t out_identify[512], int *out_is_packet_device) diff --git a/src/cdrom_id/cdrom_id.c b/src/cdrom_id/cdrom_id.c index 99a64367f..2647fda9d 100644 --- a/src/cdrom_id/cdrom_id.c +++ b/src/cdrom_id/cdrom_id.c @@ -126,7 +126,7 @@ static bool is_mounted(const char *device) 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) { log_debug("%s failed", cmd); @@ -144,7 +144,7 @@ struct scsi_cmd { 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)); 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; } -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->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 -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; @@ -190,7 +190,7 @@ static int scsi_cmd_run(struct udev *udev, struct scsi_cmd *cmd, int fd, unsigne 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; @@ -223,7 +223,7 @@ static int media_eject(struct udev *udev, int fd) 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; @@ -250,7 +250,7 @@ static int cd_capability_compat(struct udev *udev, int fd) 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) { log_debug("CDROM_DRIVE_STATUS != CDS_DISC_OK"); @@ -285,7 +285,7 @@ static int cd_inquiry(struct udev *udev, int fd) 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) { 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; diff --git a/src/collect/collect.c b/src/collect/collect.c index 2cf1f0054..620d23ae6 100644 --- a/src/collect/collect.c +++ b/src/collect/collect.c @@ -65,7 +65,7 @@ static inline struct _mate *node_to_mate(struct udev_list_node *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); } diff --git a/src/libudev/libudev-enumerate.c b/src/libudev/libudev-enumerate.c index 2a647a7b7..9526f0a2b 100644 --- a/src/libudev/libudev-enumerate.c +++ b/src/libudev/libudev-enumerate.c @@ -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 */ -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[] = { "/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 * before the point where some common path prefix changes. Returns the * 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; diff --git a/src/libudev/libudev-hwdb.c b/src/libudev/libudev-hwdb.c index 951205cb2..cfc51d6b4 100644 --- a/src/libudev/libudev-hwdb.c +++ b/src/libudev/libudev-hwdb.c @@ -379,7 +379,7 @@ bool udev_hwdb_validate(struct udev_hwdb *hwdb) { * * 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; if (!hwdb || !hwdb->f) { diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c index 597cb8e68..361c340d3 100644 --- a/src/libudev/libudev-monitor.c +++ b/src/libudev/libudev-monitor.c @@ -107,7 +107,7 @@ static struct udev_monitor *udev_monitor_new(struct udev *udev) } /* 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; _cleanup_fclose_ FILE *f = NULL; diff --git a/src/libudev/libudev-queue.c b/src/libudev/libudev-queue.c index 9750057c7..1957f5bf4 100644 --- a/src/libudev/libudev-queue.c +++ b/src/libudev/libudev-queue.c @@ -139,7 +139,7 @@ _public_ struct udev *udev_queue_get_udev(struct udev_queue *udev_queue) * * 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; } @@ -152,7 +152,7 @@ _public_ unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue * * * 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; } @@ -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. **/ -_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; } @@ -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. **/ -_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; } @@ -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. **/ _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); } @@ -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. **/ -_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); } @@ -223,7 +223,7 @@ _public_ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, un * * 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; } diff --git a/src/libudev/libudev-util.c b/src/libudev/libudev-util.c index ce42ff425..891c944fb 100644 --- a/src/libudev/libudev-util.c +++ b/src/libudev/libudev-util.c @@ -111,7 +111,7 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string, 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 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); } -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]; diff --git a/src/libudev/libudev.c b/src/libudev/libudev.c index e656b352c..db1f1e4d5 100644 --- a/src/libudev/libudev.c +++ b/src/libudev/libudev.c @@ -221,10 +221,10 @@ _public_ struct udev *udev_unref(struct udev *udev) { * 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, 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; } @@ -235,7 +235,7 @@ _public_ void udev_set_log_fn(struct udev *udev, * 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(); } @@ -247,6 +247,6 @@ _public_ int udev_get_log_priority(struct udev *udev) { * 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); } diff --git a/src/scsi_id/scsi_id.c b/src/scsi_id/scsi_id.c index 714d3d2b6..e42368fb9 100644 --- a/src/scsi_id/scsi_id.c +++ b/src/scsi_id/scsi_id.c @@ -155,7 +155,7 @@ static int argc_count(char *opts) * * 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, 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, char *maj_min_dev) { @@ -410,7 +410,7 @@ static int set_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 newargc; diff --git a/src/scsi_id/scsi_serial.c b/src/scsi_id/scsi_serial.c index 53240a923..20a554b26 100644 --- a/src/scsi_id/scsi_serial.c +++ b/src/scsi_id/scsi_serial.c @@ -104,8 +104,8 @@ static int do_scsi_page80_inquiry(struct udev *udev, struct scsi_id_device *dev_scsi, int fd, char *serial, char *serial_short, int max_len); -static int sg_err_category_new(struct udev *udev, - int scsi_status, int msg_status, int +static int sg_err_category_new(struct udev *udev __attribute__((unused)), + int scsi_status, int msg_status __attribute__((unused)), int host_status, int driver_status, const 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); } -static int scsi_dump_sense(struct udev *udev, +static int scsi_dump_sense(struct udev *udev __attribute__((unused)), struct scsi_id_device *dev_scsi, unsigned char *sense_buffer, int sb_len) { 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 * 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, unsigned char *page_83, 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 */ -static int check_fill_0x83_prespc3(struct udev *udev, - struct scsi_id_device *dev_scsi, +static int check_fill_0x83_prespc3(struct udev *udev __attribute__((unused)), + struct scsi_id_device *dev_scsi __attribute__((unused)), unsigned char *page_83, 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; 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, 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 i, j; unsigned char page_83[SCSI_INQ_BUFF_LEN]; diff --git a/src/shared/MurmurHash2.c b/src/shared/MurmurHash2.c index 2f4149dbe..8f04b28cd 100644 --- a/src/shared/MurmurHash2.c +++ b/src/shared/MurmurHash2.c @@ -70,7 +70,9 @@ uint32_t MurmurHash2 ( const void * key, int len, uint32_t seed ) switch(len) { case 3: h ^= data[2] << 16; + // fall through case 2: h ^= data[1] << 8; + // fall through case 1: h ^= data[0]; h *= m; }; diff --git a/src/shared/log.c b/src/shared/log.c index 4a409964a..17bdee9cf 100644 --- a/src/shared/log.c +++ b/src/shared/log.c @@ -238,12 +238,12 @@ void log_set_max_level(int level) { static int write_to_console( int level, - int error, + int error __attribute__((unused)), const char *file, int line, - const char *func, - const char *object_field, - const char *object, + const char *func __attribute__((unused)), + const char *object_field __attribute__((unused)), + const char *object __attribute__((unused)), const char *buffer) { char location[64], prefix[1 + DECIMAL_STR_MAX(int) + 2]; @@ -299,12 +299,12 @@ static int write_to_console( static int write_to_syslog( int level, - int error, - const char *file, - int line, - const char *func, - const char *object_field, - const char *object, + int error __attribute__((unused)), + const char *file __attribute__((unused)), + int line __attribute__((unused)), + const char *func __attribute__((unused)), + const char *object_field __attribute__((unused)), + const char *object __attribute__((unused)), const char *buffer) { 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( int level, - int error, - const char*file, - int line, - const char *func, - const char *object_field, - const char *object, + int error __attribute__((unused)), + const char *file __attribute__((unused)), + int line __attribute__((unused)), + const char *func __attribute__((unused)), + const char *object_field __attribute__((unused)), + const char *object __attribute__((unused)), const char *buffer) { char header_priority[1 + DECIMAL_STR_MAX(int) + 2], header_pid[1 + DECIMAL_STR_MAX(pid_t) + 4]; diff --git a/src/shared/mkdir.c b/src/shared/mkdir.c index 20702afa1..e852ff4c6 100644 --- a/src/shared/mkdir.c +++ b/src/shared/mkdir.c @@ -69,7 +69,7 @@ int mkdir_parents_internal(const char *prefix, const char *path, mode_t mode, mk char buf[PATH_MAX + 1]; p = buf; - assert(e-path < sizeof(buf)); + assert(e-path < (ssize_t)sizeof(buf)); memcpy(buf, path, e-path); buf[e-path] = 0; diff --git a/src/shared/siphash24.c b/src/shared/siphash24.c index f68bd283a..4c30ac3de 100644 --- a/src/shared/siphash24.c +++ b/src/shared/siphash24.c @@ -92,16 +92,22 @@ void siphash24(uint8_t out[8], const void *_in, size_t inlen, const uint8_t k[16 switch( left ) { case 7: b |= ( ( u64 )in[ 6] ) << 48; + // fall through case 6: b |= ( ( u64 )in[ 5] ) << 40; + // fall through case 5: b |= ( ( u64 )in[ 4] ) << 32; + // fall through case 4: b |= ( ( u64 )in[ 3] ) << 24; + // fall through case 3: b |= ( ( u64 )in[ 2] ) << 16; + // fall through case 2: b |= ( ( u64 )in[ 1] ) << 8; + // fall through case 1: b |= ( ( u64 )in[ 0] ); break; diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c index 92477811a..d73ac469d 100644 --- a/src/shared/smack-util.c +++ b/src/shared/smack-util.c @@ -45,7 +45,7 @@ bool mac_smack_use(void) { #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; assert(path); @@ -65,7 +65,7 @@ int mac_smack_apply(const char *path, const char *label) { 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; assert(fd >= 0); @@ -85,7 +85,7 @@ int mac_smack_apply_fd(int fd, const char *label) { 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; assert(fd >= 0); @@ -105,7 +105,7 @@ int mac_smack_apply_ip_out_fd(int fd, const char *label) { 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; assert(fd >= 0); @@ -125,7 +125,7 @@ int mac_smack_apply_ip_in_fd(int fd, const char *label) { 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 const char *p; @@ -147,7 +147,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) { 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 struct stat st; diff --git a/src/shared/util.h b/src/shared/util.h index 43feec4f7..cbc9669e9 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -154,6 +154,7 @@ bool hidden_file(const char *filename) _pure_; /* For basic lookup tables with strictly enumerated entries */ #define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,scope) \ + __attribute__((unused)) \ scope const char *name##_to_string(type i) { \ if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \ return NULL; \ @@ -161,6 +162,7 @@ bool hidden_file(const char *filename) _pure_; } #define _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(name,type,scope) \ + __attribute__((unused)) \ scope type name##_from_string(const char *s) { \ type i; \ if (!s) \ diff --git a/src/udev/udev-builtin-hwdb.c b/src/udev/udev-builtin-hwdb.c index 1eddf86b6..931b5e28b 100644 --- a/src/udev/udev-builtin-hwdb.c +++ b/src/udev/udev-builtin-hwdb.c @@ -199,12 +199,12 @@ static int builtin_hwdb_init(struct udev *udev) { } /* 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); } /* 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); } diff --git a/src/udev/udev-builtin-input_id.c b/src/udev/udev-builtin-input_id.c index 3c769e362..9670e8d89 100644 --- a/src/udev/udev-builtin-input_id.c +++ b/src/udev/udev-builtin-input_id.c @@ -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 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, unsigned long *bitmask, size_t bitmask_size, bool test) { @@ -312,7 +312,7 @@ static bool test_key(struct udev_device *dev, 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; unsigned long bitmask_ev[NBITS(EV_MAX)]; unsigned long bitmask_abs[NBITS(ABS_MAX)]; diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c index fad352005..47afbf7f1 100644 --- a/src/udev/udev-builtin-keyboard.c +++ b/src/udev/udev-builtin-keyboard.c @@ -185,7 +185,7 @@ static int open_device(const char *devnode) { 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; unsigned release[1024]; unsigned release_count = 0; diff --git a/src/udev/udev-builtin-kmod.c b/src/udev/udev-builtin-kmod.c index ad2829e50..3b604bf29 100644 --- a/src/udev/udev-builtin-kmod.c +++ b/src/udev/udev-builtin-kmod.c @@ -33,7 +33,7 @@ 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 *l; int err; @@ -63,11 +63,11 @@ static int load_module(struct udev *udev, const char *alias) { 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); } -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); int i; @@ -103,13 +103,13 @@ static int builtin_kmod_init(struct udev *udev) { } /* 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"); ctx = kmod_unref(ctx); } /* 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"); if (!ctx) return false; diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c index 448920507..2fbaf9016 100644 --- a/src/udev/udev-builtin-net_id.c +++ b/src/udev/udev-builtin-net_id.c @@ -192,7 +192,7 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) { char *s; const char *attr; struct udev_device *pci = NULL; - char slots[256], str[256]; + char slots[256], str[520]; _cleanup_closedir_ DIR *dir = NULL; struct dirent *dent; 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; } -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 *p; unsigned int i; diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c index b6749aab7..44c549347 100644 --- a/src/udev/udev-builtin-path_id.c +++ b/src/udev/udev-builtin-path_id.c @@ -576,7 +576,7 @@ static struct udev_device *handle_ccw(struct udev_device *parent, struct udev_de 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; char *path = NULL; bool supported_transport = false; diff --git a/src/udev/udev-builtin-usb_id.c b/src/udev/udev-builtin-usb_id.c index 462efc5c8..624b3c6b1 100644 --- a/src/udev/udev-builtin-usb_id.c +++ b/src/udev/udev-builtin-usb_id.c @@ -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 * 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_enc[256]; const char *vendor_id; diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c index 74b3bdc58..e2b524f33 100644 --- a/src/udev/udev-builtin.c +++ b/src/udev/udev-builtin.c @@ -80,7 +80,7 @@ bool udev_builtin_validate(struct udev *udev) { return false; } -void udev_builtin_list(struct udev *udev) { +void udev_builtin_list(struct udev *udev __attribute__((unused))) { unsigned int i; for (i = 0; i < ELEMENTSOF(builtins); i++) diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c index 0666c7a69..ebbe0b74c 100644 --- a/src/udev/udev-event.c +++ b/src/udev/udev-event.c @@ -406,7 +406,7 @@ size_t udev_event_apply_format(struct udev_event *event, 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, int fd_stdout, int fd_stderr) { _cleanup_close_ int fd = -1; @@ -671,7 +671,7 @@ static int spawn_wait(struct udev_event *event, 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; char *pos; @@ -810,7 +810,7 @@ int udev_event_spawn(struct udev_event *event, int udev_rules_assigning_name_to(struct udev_rules *rules,const char *match_name); #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 sk; struct ifreq ifr; diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index d2ea718ad..198875bc9 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -444,8 +444,8 @@ static void dump_rules(struct udev_rules *rules) { dump_token(rules, &rules->tokens[i]); } #else -static inline void dump_token(struct udev_rules *rules, struct token *token) {} -static inline void dump_rules(struct udev_rules *rules) {} +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 __attribute__((unused))) {} #endif /* DEBUG */ 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; } -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 *temp; 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} */ -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 *attr; diff --git a/src/udev/udev-watch.c b/src/udev/udev-watch.c index b6a0d3e93..59d5870c9 100644 --- a/src/udev/udev-watch.c +++ b/src/udev/udev-watch.c @@ -36,7 +36,7 @@ static int inotify_fd = -1; * set to cloexec since we need our children to be able to add * 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); if (inotify_fd < 0) log_error_errno(errno, "inotify_init failed: %m"); @@ -92,7 +92,7 @@ void udev_watch_restore(struct udev *udev) { } } -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]; int wd; int r; @@ -118,7 +118,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev) { 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; char filename[UTIL_PATH_SIZE]; diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c index 53b1b15c7..95826b700 100644 --- a/src/udev/udevadm-hwdb.c +++ b/src/udev/udevadm-hwdb.c @@ -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, - char *line, const char *filename) { + char *line, const char *filename __attribute__((unused))) { char *value; struct udev_list_entry *entry; diff --git a/src/udev/udevadm-info.c b/src/udev/udevadm-info.c index 0aec976a3..b31108e53 100644 --- a/src/udev/udevadm-info.c +++ b/src/udev/udevadm-info.c @@ -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; unlink(UDEV_ROOT_RUN "/udev/queue.bin"); diff --git a/src/udev/udevadm.c b/src/udev/udevadm.c index 3e57cf6de..a74bf8536 100644 --- a/src/udev/udevadm.c +++ b/src/udev/udevadm.c @@ -26,7 +26,7 @@ #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); return 0; } @@ -56,7 +56,7 @@ static const struct udevadm_cmd *udevadm_cmds[] = { &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; printf("%s [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]\n\n" diff --git a/src/udev/udevd.c b/src/udev/udevd.c index cf826c6dc..e32fa978c 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -584,7 +584,7 @@ static bool is_devpath_busy(struct event *event) { 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; 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; udev_list_node_foreach_safe(loop, tmp, &event_list) { @@ -920,7 +920,7 @@ static int handle_inotify(struct udev *udev) { return 0; } -static void handle_signal(struct udev *udev, int signo) { +static void handle_signal(struct udev *udev __attribute__((unused)), int signo) { switch (signo) { case SIGINT: case SIGTERM: diff --git a/test/test-udev.c b/test/test-udev.c index 6bed8d61c..6d7e2b0b0 100644 --- a/test/test-udev.c +++ b/test/test-udev.c @@ -86,7 +86,7 @@ static int fake_filesystems(void) { 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_event_unref_ struct udev_event *event = NULL; _cleanup_udev_device_unref_ struct udev_device *dev = NULL;