ell: add missing void to function declarations
PATCH 1/4 ell: add missing void to function declarations
Found with -Wstrict-prototypes.
--- ell/checksum.h | 2 +- ell/dbus-private.h | 2 +- ell/main.h | 2 +- ell/random.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
ell/checksum.h +1 -1
@@ -64,7 +64,7 @@ ssize_t l_checksum_get_digest(struct l_checksum *checksum,char *l_checksum_get_string (struct l_checksum *checksum);bool l_checksum_is_supported (enum l_checksum_type type,bool check_hmac); -bool l_checksum_cmac_aes_supported (); +bool l_checksum_cmac_aes_supported (void );ssize_t l_checksum_digest_length (enum l_checksum_type type);
ell/dbus-private.h +1 -1
@@ -189,7 +189,7 @@ struct _dbus_signal *_dbus_interface_find_signal(struct l_dbus_interface *i,struct _dbus_property *_dbus_interface_find_property (struct l_dbus_interface *i,const char *property); -struct _dbus_object_tree *_dbus_object_tree_new (); +struct _dbus_object_tree *_dbus_object_tree_new (void );void _dbus_object_tree_free (struct _dbus_object_tree *tree); struct object_node *_dbus_object_tree_makepath(struct _dbus_object_tree *tree,
ell/main.h +1 -1
@@ -42,7 +42,7 @@ typedef void (*l_main_signal_cb_t) (uint32_t signo, void *user_data);int l_main_run_with_signal (l_main_signal_cb_t callback,void *user_data); -int l_main_get_epoll_fd (); +int l_main_get_epoll_fd (void ); #ifdef __cplusplus }
ell/random.h +1 -1
@@ -32,7 +32,7 @@ extern "C" {#include <stdint.h> bool l_getrandom (void *buf,size_t len); -bool l_getrandom_is_supported (); +bool l_getrandom_is_supported (void );uint32_t l_getrandom_uint32 (void );
Signature · 1 line
2.25.1
PATCH 2/4 ell: add missing format attribute
Found with clang's -Wformat-nonliteral
--- ell/dbus.h | 3 ++- ell/hwdb.h | 3 ++- ell/log.c | 3 +++ ell/ringbuf.h | 3 ++- ell/string.h | 3 ++- ell/strv.h | 3 ++- ell/util.h | 3 ++- 7 files changed, 15 insertions(+), 6 deletions(-)
ell/dbus.h +2 -1
@@ -114,7 +114,8 @@ struct l_dbus_message *l_dbus_message_new_method_return(struct l_dbus_message *l_dbus_message_new_error_valist (struct l_dbus_message *method_call,const char *name, -const char *format,va_list args); +const char *format,va_list args) + __attribute__((format (printf,3 ,0 ))); struct l_dbus_message *l_dbus_message_new_error( struct l_dbus_message *method_call, const char *name,
ell/hwdb.h +2 -1
@@ -46,7 +46,8 @@ struct l_hwdb_entry {struct l_hwdb_entry *l_hwdb_lookup (struct l_hwdb *hwdb,const char *format, ...) __attribute__((format (printf,2 ,3 )));struct l_hwdb_entry *l_hwdb_lookup_valist (struct l_hwdb *hwdb, -const char *format,va_list args); +const char *format,va_list args) + __attribute__((format (printf,2 ,0 )));void l_hwdb_lookup_free (struct l_hwdb_entry *entries); typedef void (*l_hwdb_foreach_func_t)(const char *modalias,
ell/log.c +3 -0
@@ -139,6 +139,7 @@ LIB_EXPORT void l_log_set_null(void) log_func = log_null; } +__attribute__((format (printf,5 ,0 )))static void log_stderr (int priority,const char *file,const char *line,const char *func,const char *format,va_list ap) {
@@ -157,6 +158,7 @@ LIB_EXPORT void l_log_set_stderr(void) log_func = log_stderr; } +__attribute__((format (printf,5 ,0 )))static void log_syslog (int priority,const char *file,const char *line,const char *func,const char *format,va_list ap) {
@@ -205,6 +207,7 @@ LIB_EXPORT void l_log_set_syslog(void) log_func = log_syslog; } +__attribute__((format (printf,5 ,0 )))static void log_journal (int priority,const char *file,const char *line,const char *func,const char *format,va_list ap) {
ell/ringbuf.h +2 -1
@@ -55,7 +55,8 @@ size_t l_ringbuf_avail(struct l_ringbuf *ringbuf);int l_ringbuf_printf (struct l_ringbuf *ringbuf,const char *format, ...) __attribute__((format (printf,2 ,3 )));int l_ringbuf_vprintf (struct l_ringbuf *ringbuf,const char *format, -va_list ap); +va_list ap) + __attribute__((format (printf,2 ,0 )));ssize_t l_ringbuf_read (struct l_ringbuf *ringbuf,int fd); ssize_t l_ringbuf_append(struct l_ringbuf *ringbuf,
ell/string.h +2 -1
@@ -41,7 +41,8 @@ struct l_string *l_string_append_fixed(struct l_string *dest, const char *src, size_t max);void l_string_append_vprintf (struct l_string *dest, -const char *format,va_list args); +const char *format,va_list args) + __attribute__((format (printf,2 ,0 )));void l_string_append_printf (struct l_string *dest,const char *format, ...) __attribute__((format (printf,2 ,3 )));
ell/strv.h +2 -1
@@ -40,7 +40,8 @@ char **l_strv_append(char **str_array, const char *str);char **l_strv_append_printf (char **str_array,const char *format, ...) __attribute__((format (printf,2 ,3 )));char **l_strv_append_vprintf (char **str_array,const char *format, -va_list args); +va_list args) + __attribute__((format (printf,2 ,0 )));char **l_strv_copy (char **str_array);#ifdef __cplusplus
ell/util.h +2 -1
@@ -280,7 +280,8 @@ char *l_strdup(const char *str);char *l_strndup (const char *str,size_t max);char *l_strdup_printf (const char *format, ...) __attribute__((format (printf,1 ,2 ))); -char *l_strdup_vprintf (const char *format,va_list args); +char *l_strdup_vprintf (const char *format,va_list args) + __attribute__((format (printf,1 ,0 )));size_t l_strlcpy (char * dst,const char *src,size_t len);
Signature · 1 line
2.25.1
PATCH 3/4 ell: remove extra/unnecessary semicolons
In reply to Rosen PenevFound with clang's -Wextra-semi-stmt
--- ell/dbus-client.c | 2 +- ell/dbus.c | 2 +- ell/dhcp.c | 4 ++-- ell/siphash.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
ell/dbus-client.c +1 -1
@@ -414,7 +414,7 @@ static struct l_dbus_proxy *dbus_proxy_new(struct l_dbus_client *client, proxy->interface =l_strdup (interface); proxy->path =l_strdup (path); proxy->properties =l_queue_new (); - proxy->pending_calls =l_queue_new ();; + proxy->pending_calls =l_queue_new ();l_queue_push_tail (client->proxies, proxy);
ell/dbus.c +1 -1
@@ -1496,7 +1496,7 @@ LIB_EXPORT bool l_dbus_register_object(struct l_dbus *dbus, const char *path,va_list args;const char *interface;void *if_user_data; -bool r = true;; +bool r = true;if (unlikely (!dbus))return false;
ell/dhcp.c +2 -2
@@ -153,7 +153,7 @@ const char *_dhcp_option_to_string(uint8_t option)return "End" ;default :return "unknown" ; - }; + } } bool _dhcp_message_iter_init(struct dhcp_message_iter *iter,
@@ -768,7 +768,7 @@ static void dhcp_client_timeout_resend(struct l_timeout *timeout,case DHCP_STATE_REBOOTING :case DHCP_STATE_BOUND :break ; - }; + }if (next_timeout)l_timeout_modify_ms (timeout,dhcp_fuzz_secs (next_timeout));
ell/siphash.c +1 -1
@@ -134,5 +134,5 @@ void _siphash24(uint8_t out[8], const uint8_t *in, size_t inlen,SIPROUND ;SIPROUND ; b = v0 ^ v1 ^ v2 ^ v3; -U64TO8_LE (out, b); + U64TO8_LE(out, b) }
Signature · 1 line
2.25.1
PATCH 4/4 ell: switch to new __atomic API
In reply to Rosen PenevThe __sync API is legacy. __atomic is also explicit. Fixes:
warning: implicit use of sequentially-consistent atomic may incur stronger memory barriers than necessary [-Watomic-implicit-seq-cst]
from clang.
--- ell/dbus-message.c | 4 ++-- ell/genl.c | 8 ++++---- ell/hwdb.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-)
ell/dbus-message.c +2 -2
@@ -397,7 +397,7 @@ LIB_EXPORT struct l_dbus_message *l_dbus_message_ref(struct l_dbus_message *messif (unlikely (!message))return NULL ; -__sync_fetch_and_add (&message->refcount,1 ); +__atomic_fetch_add (&message->refcount,1 , __ATOMIC_SEQ_CST);return message; }
@@ -409,7 +409,7 @@ LIB_EXPORT void l_dbus_message_unref(struct l_dbus_message *message)if (unlikely (!message))return ; -if (__sync_sub_and_fetch (&message->refcount,1 )) +if (__atomic_sub_fetch (&message->refcount,1 , __ATOMIC_SEQ_CST))return ;for (i =0 ; i < message->num_fds; i++)
ell/genl.c +4 -4
@@ -1125,7 +1125,7 @@ LIB_EXPORT struct l_genl *l_genl_ref(struct l_genl *genl)if (unlikely (!genl))return NULL ; -__sync_fetch_and_add (&genl->ref_count,1 ); +__atomic_fetch_add (&genl->ref_count,1 , __ATOMIC_SEQ_CST);return genl; }
@@ -1135,7 +1135,7 @@ LIB_EXPORT void l_genl_unref(struct l_genl *genl)if (unlikely (!genl))return ; -if (__sync_sub_and_fetch (&genl->ref_count,1 )) +if (__atomic_sub_fetch (&genl->ref_count,1 , __ATOMIC_SEQ_CST))return ;if (genl->discovery) {
@@ -1542,7 +1542,7 @@ LIB_EXPORT struct l_genl_msg *l_genl_msg_ref(struct l_genl_msg *msg)if (unlikely (!msg))return NULL ; -__sync_fetch_and_add (&msg->ref_count,1 ); +__atomic_fetch_add (&msg->ref_count,1 , __ATOMIC_SEQ_CST);return msg; }
@@ -1552,7 +1552,7 @@ LIB_EXPORT void l_genl_msg_unref(struct l_genl_msg *msg)if (unlikely (!msg))return ; -if (__sync_sub_and_fetch (&msg->ref_count,1 )) +if (__atomic_sub_fetch (&msg->ref_count,1 , __ATOMIC_SEQ_CST))return ;l_free (msg->data);
ell/hwdb.c +2 -2
@@ -178,7 +178,7 @@ LIB_EXPORT struct l_hwdb *l_hwdb_ref(struct l_hwdb *hwdb)if (!hwdb)return NULL ; -__sync_fetch_and_add (&hwdb->ref_count,1 ); +__atomic_fetch_add (&hwdb->ref_count,1 , __ATOMIC_SEQ_CST);return hwdb; }
@@ -188,7 +188,7 @@ LIB_EXPORT void l_hwdb_unref(struct l_hwdb *hwdb)if (!hwdb)return ; -if (__sync_sub_and_fetch (&hwdb->ref_count,1 )) +if (__atomic_sub_fetch (&hwdb->ref_count,1 , __ATOMIC_SEQ_CST))return ;munmap (hwdb->addr, hwdb->size);
Signature · 1 line
2.25.1
Hi Rosen,
Quoted 8 lines · Rosen Penev
Found with -Wstrict-prototypes.
--- ell/checksum.h | 2 +- ell/dbus-private.h | 2 +- ell/main.h | 2 +- ell/random.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
All applied, thanks.
Regards,
-Denis