From e3ec97f8581b019b134eb5b937a9b0e87dfa4455 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 1 Mar 2019 14:01:31 -0500 Subject: [PATCH] TT#50652 add -Wstrict-prototypes everywhere Change-Id: Ic5b5fcb892a8f70196478f8622d956bdea373422 --- daemon/.ycm_extra_conf.py | 1 + daemon/Makefile | 2 +- daemon/aux.c | 2 +- daemon/dtls.c | 2 +- daemon/log_funcs.h | 2 +- daemon/main.c | 4 ++-- daemon/redis.c | 4 ++-- debian/rules.modules | 2 +- include/.ycm_extra_conf.py | 1 + include/aux.h | 2 +- include/crypto.h | 2 +- include/homer.h | 2 +- include/kernel.h | 2 +- include/rtcp.h | 2 +- iptables-extension/Makefile | 2 +- lib/.ycm_extra_conf.py | 1 + lib/codeclib.c | 2 +- lib/codeclib.h | 2 +- lib/fix_frame_channel_layout-test.c | 2 +- lib/loglib.h | 2 +- recording-daemon/.ycm_extra_conf.py | 1 + recording-daemon/Makefile | 2 +- recording-daemon/db.c | 6 +++--- t/.ycm_extra_conf.py | 1 + t/Makefile | 2 +- t/aes-crypt.c | 2 +- t/amr-decode-test.c | 2 +- t/amr-encode-test.c | 2 +- t/bitstr-test.c | 2 +- t/const_str_hash-test.c | 2 +- t/log_funcs.h | 2 +- t/payload-tracker-test.c | 2 +- t/transcode-test.c | 8 ++++---- 33 files changed, 40 insertions(+), 35 deletions(-) diff --git a/daemon/.ycm_extra_conf.py b/daemon/.ycm_extra_conf.py index cf12a6910..8d2343d0a 100644 --- a/daemon/.ycm_extra_conf.py +++ b/daemon/.ycm_extra_conf.py @@ -23,6 +23,7 @@ csh_lookup_str = csh_lookup_str.replace('!', '0') flags = [ '-g', '-Wall', + '-Wstrict-prototypes', '-pthread', '-fno-strict-aliasing', '-I/usr/include/glib-2.0', diff --git a/daemon/Makefile b/daemon/Makefile index 4f1cd7ce1..1ec226c51 100644 --- a/daemon/Makefile +++ b/daemon/Makefile @@ -51,7 +51,7 @@ endif endif endif -CFLAGS= -g -Wall -pthread -fno-strict-aliasing +CFLAGS= -g -Wall -Wstrict-prototypes -pthread -fno-strict-aliasing CFLAGS+= -std=c99 CFLAGS+= $(shell pkg-config --cflags glib-2.0) CFLAGS+= $(shell pkg-config --cflags gthread-2.0) diff --git a/daemon/aux.c b/daemon/aux.c index 8f6d36430..1f9005924 100644 --- a/daemon/aux.c +++ b/daemon/aux.c @@ -114,7 +114,7 @@ int pcre_multi_match(pcre *re, pcre_extra *ree, const char *s, unsigned int num, -static void thread_join_me() { +static void thread_join_me(void) { pthread_t *me; me = g_slice_alloc(sizeof(*me)); diff --git a/daemon/dtls.c b/daemon/dtls.c index f1fc09e6b..fb27187d4 100644 --- a/daemon/dtls.c +++ b/daemon/dtls.c @@ -170,7 +170,7 @@ static void dump_cert(struct dtls_cert *cert) { buf_dump_free(buf, len); } -static int cert_init() { +static int cert_init(void) { X509 *x509 = NULL; EVP_PKEY *pkey = NULL; BIGNUM *exponent = NULL, *serial_number = NULL; diff --git a/daemon/log_funcs.h b/daemon/log_funcs.h index 4c6229a31..a8330ca07 100644 --- a/daemon/log_funcs.h +++ b/daemon/log_funcs.h @@ -8,7 +8,7 @@ #include "ice.h" #include "log.h" -INLINE void log_info_clear() { +INLINE void log_info_clear(void) { switch (log_info.e) { case LOG_INFO_NONE: return; diff --git a/daemon/main.c b/daemon/main.c index 7033ef776..c5cf23f1b 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -586,11 +586,11 @@ void fill_initial_rtpe_cfg(struct rtpengine_config* ini_rtpe_cfg) { } -static void early_init() { +static void early_init(void) { socket_init(); // needed for socktype_udp } -static void init_everything() { +static void init_everything(void) { log_init("rtpengine"); log_format(rtpe_config.log_format); recording_fs_init(rtpe_config.spooldir, rtpe_config.rec_method, rtpe_config.rec_format); diff --git a/daemon/redis.c b/daemon/redis.c index 5e66792a1..0f1c184c5 100644 --- a/daemon/redis.c +++ b/daemon/redis.c @@ -412,7 +412,7 @@ void redis_async_context_disconnect(const redisAsyncContext *redis_notify_async_ } } -int redis_async_context_alloc() { +int redis_async_context_alloc(void) { struct redis *r = 0; if (!rtpe_redis_notify) { @@ -521,7 +521,7 @@ int redis_notify_subscribe_action(enum subscribe_action action, int keyspace) { return 0; } -static int redis_notify() { +static int redis_notify(void) { struct redis *r = 0; GList *l; diff --git a/debian/rules.modules b/debian/rules.modules index f115e5963..da4b6e10f 100644 --- a/debian/rules.modules +++ b/debian/rules.modules @@ -3,7 +3,7 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -CFLAGS ?= -Wall -g +CFLAGS ?= -Wall -Wstrict-prototypes -g ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 diff --git a/include/.ycm_extra_conf.py b/include/.ycm_extra_conf.py index 04612a9b0..9ee5e6f00 100644 --- a/include/.ycm_extra_conf.py +++ b/include/.ycm_extra_conf.py @@ -14,6 +14,7 @@ compilation_database_folder = '' flags = [ '-g', '-Wall', + '-Wstrict-prototypes', '-pthread', '-fno-strict-aliasing', '-I/usr/include/glib-2.0', diff --git a/include/aux.h b/include/aux.h index 75de0bc45..1627d6b96 100644 --- a/include/aux.h +++ b/include/aux.h @@ -184,7 +184,7 @@ INLINE int strmemcmp(const void *mem, int len, const char *str) { return memcmp(mem, str, len); } -INLINE long unsigned int ssl_random() { +INLINE long unsigned int ssl_random(void) { long unsigned int ret; random_string((void *) &ret, sizeof(ret)); return ret; diff --git a/include/crypto.h b/include/crypto.h index f594d35d6..d4d9c03e3 100644 --- a/include/crypto.h +++ b/include/crypto.h @@ -103,7 +103,7 @@ extern const unsigned int num_crypto_suites; -void crypto_init_main(); +void crypto_init_main(void); const struct crypto_suite *crypto_find_suite(const str *); int crypto_gen_session_key(struct crypto_context *, str *, unsigned char, int); diff --git a/include/homer.h b/include/homer.h index ef9345cd6..de86f13ea 100644 --- a/include/homer.h +++ b/include/homer.h @@ -7,7 +7,7 @@ void homer_sender_init(const endpoint_t *, int, int); int homer_send(GString *, const str *, const endpoint_t *, const endpoint_t *, const struct timeval *tv); -int has_homer(); +int has_homer(void); #endif diff --git a/include/kernel.h b/include/kernel.h index bddb5ec07..96f123d70 100644 --- a/include/kernel.h +++ b/include/kernel.h @@ -34,7 +34,7 @@ int kernel_setup_table(unsigned int); int kernel_add_stream(struct rtpengine_target_info *, int); int kernel_del_stream(const struct re_address *); -GList *kernel_list(); +GList *kernel_list(void); unsigned int kernel_add_call(const char *id); int kernel_del_call(unsigned int); diff --git a/include/rtcp.h b/include/rtcp.h index ecbce3b8d..dfd06ce76 100644 --- a/include/rtcp.h +++ b/include/rtcp.h @@ -33,6 +33,6 @@ void rtcp_list_free(GQueue *q); rtcp_filter_func rtcp_avpf2avp_filter; -void rtcp_init(); +void rtcp_init(void); #endif diff --git a/iptables-extension/Makefile b/iptables-extension/Makefile index 8aeb2ae24..0d3e0bdbf 100644 --- a/iptables-extension/Makefile +++ b/iptables-extension/Makefile @@ -1,5 +1,5 @@ CC?=gcc -CFLAGS = -O2 -Wall -shared -fPIC +CFLAGS = -O2 -Wall -Wstrict-prototypes -shared -fPIC ifneq ($(RTPENGINE_VERSION),) CFLAGS += -DRTPENGINE_VERSION="\"$(RTPENGINE_VERSION)\"" else diff --git a/lib/.ycm_extra_conf.py b/lib/.ycm_extra_conf.py index ec9a19293..7658687d7 100644 --- a/lib/.ycm_extra_conf.py +++ b/lib/.ycm_extra_conf.py @@ -14,6 +14,7 @@ compilation_database_folder = '' flags = [ '-g', '-Wall', + '-Wstrict-prototypes', '-pthread', '-fno-strict-aliasing', '-I/usr/include/glib-2.0', diff --git a/lib/codeclib.c b/lib/codeclib.c index 452bf6df5..934e54c50 100644 --- a/lib/codeclib.c +++ b/lib/codeclib.c @@ -920,7 +920,7 @@ seq_ok: -encoder_t *encoder_new() { +encoder_t *encoder_new(void) { encoder_t *ret = g_slice_alloc0(sizeof(*ret)); format_init(&ret->requested_format); format_init(&ret->actual_format); diff --git a/lib/codeclib.h b/lib/codeclib.h index fc8fe3b1d..4eb068f9b 100644 --- a/lib/codeclib.h +++ b/lib/codeclib.h @@ -202,7 +202,7 @@ int decoder_input_data(decoder_t *dec, const str *data, unsigned long ts, int (*callback)(decoder_t *, AVFrame *, void *u1, void *u2), void *u1, void *u2); -encoder_t *encoder_new(); +encoder_t *encoder_new(void); int encoder_config(encoder_t *enc, const codec_def_t *def, int bitrate, int ptime, const format_t *requested_format, format_t *actual_format); int encoder_config_fmtp(encoder_t *enc, const codec_def_t *def, int bitrate, int ptime, diff --git a/lib/fix_frame_channel_layout-test.c b/lib/fix_frame_channel_layout-test.c index f08d2e793..5cf538498 100644 --- a/lib/fix_frame_channel_layout-test.c +++ b/lib/fix_frame_channel_layout-test.c @@ -1,5 +1,5 @@ #include "fix_frame_channel_layout.h" -void test() { +void test(void) { AVFrame *f = NULL; fix_frame_channel_layout(f); } diff --git a/lib/loglib.h b/lib/loglib.h index 2d1bd3506..e40e5d358 100644 --- a/lib/loglib.h +++ b/lib/loglib.h @@ -18,7 +18,7 @@ typedef void write_log_t(int facility_priority, const char *format, ...) __attri extern write_log_t *write_log; int parse_log_facility(const char *name, int *dst); -void print_available_log_facilities (); +void print_available_log_facilities (void); void log_to_stderr(int facility_priority, const char *format, ...) __attribute__ ((format (printf, 2, 3))); diff --git a/recording-daemon/.ycm_extra_conf.py b/recording-daemon/.ycm_extra_conf.py index bc65e7192..a853960a2 100644 --- a/recording-daemon/.ycm_extra_conf.py +++ b/recording-daemon/.ycm_extra_conf.py @@ -14,6 +14,7 @@ compilation_database_folder = '' flags = [ '-g', '-Wall', + '-Wstrict-prototypes', '-pthread', '-fno-strict-aliasing', '-I/usr/include/glib-2.0', diff --git a/recording-daemon/Makefile b/recording-daemon/Makefile index 88dda5681..ca6dbd81a 100644 --- a/recording-daemon/Makefile +++ b/recording-daemon/Makefile @@ -1,6 +1,6 @@ TARGET= rtpengine-recording -CFLAGS= -g -Wall -pthread -I. -I../lib/ -I../kernel-module/ +CFLAGS= -g -Wall -Wstrict-prototypes -pthread -I. -I../lib/ -I../kernel-module/ CFLAGS+= -std=c99 -fno-strict-aliasing CFLAGS+= -D_GNU_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE CFLAGS+= $(shell pkg-config --cflags glib-2.0) diff --git a/recording-daemon/db.c b/recording-daemon/db.c index c21696de4..47c57a7e6 100644 --- a/recording-daemon/db.c +++ b/recording-daemon/db.c @@ -69,7 +69,7 @@ static void my_stmt_close(MYSQL_STMT **st) { } -static void reset_conn() { +static void reset_conn(void) { my_stmt_close(&stm_insert_call); my_stmt_close(&stm_close_call); my_stmt_close(&stm_insert_stream); @@ -93,7 +93,7 @@ INLINE int prep(MYSQL_STMT **st, const char *str) { } -static int check_conn() { +static int check_conn(void) { if (mysql_conn) return 0; if (!c_mysql_host || !c_mysql_db) @@ -236,7 +236,7 @@ err: } -static double now_double() { +static double now_double(void) { struct timeval tv; gettimeofday(&tv, NULL); return tv.tv_sec + tv.tv_usec / 1000000.0; diff --git a/t/.ycm_extra_conf.py b/t/.ycm_extra_conf.py index ae7a3870c..be988155c 100644 --- a/t/.ycm_extra_conf.py +++ b/t/.ycm_extra_conf.py @@ -14,6 +14,7 @@ compilation_database_folder = '' flags = [ '-g', '-Wall', + '-Wstrict-prototypes', '-pthread', '-fno-strict-aliasing', '-I/usr/include/glib-2.0', diff --git a/t/Makefile b/t/Makefile index ed9b80f06..ab425e92d 100644 --- a/t/Makefile +++ b/t/Makefile @@ -2,7 +2,7 @@ TARGET= all-tests with_transcoding ?= yes -CFLAGS= -g -Wall -pthread -fno-strict-aliasing +CFLAGS= -g -Wall -Wstrict-prototypes -pthread -fno-strict-aliasing CFLAGS+= -std=c99 CFLAGS+= $(shell pkg-config --cflags glib-2.0) CFLAGS+= $(shell pkg-config --cflags gthread-2.0) diff --git a/t/aes-crypt.c b/t/aes-crypt.c index 018af5294..8c60f7189 100644 --- a/t/aes-crypt.c +++ b/t/aes-crypt.c @@ -178,7 +178,7 @@ void srtp_validate (struct crypto_context *c, struct crypto_context *c2, char* m printf("%s RTCP decrypt: PASS\n", message); } -extern void crypto_init_main(); +extern void crypto_init_main(void); void check_session_keys(struct crypto_context *c, int i) { str s; diff --git a/t/amr-decode-test.c b/t/amr-decode-test.c index 315601be6..9ad373d59 100644 --- a/t/amr-decode-test.c +++ b/t/amr-decode-test.c @@ -79,7 +79,7 @@ static void do_test_amr_wb(const char *file, int line, #define do_test_nb(in, out, fmt) \ do_test_amr_nb(__FILE__, __LINE__, fmt, in, sizeof(in)-1, out, sizeof(out)-1) -int main() { +int main(void) { codeclib_init(0); do_test_wb( diff --git a/t/amr-encode-test.c b/t/amr-encode-test.c index e526745aa..44d081c8c 100644 --- a/t/amr-encode-test.c +++ b/t/amr-encode-test.c @@ -118,7 +118,7 @@ static void do_test_amr_nb(const char *file, int line, #define test_160_samples_16_bits \ "\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x01\x00\x01\x01" -int main() { +int main(void) { codeclib_init(0); do_test_wb( diff --git a/t/bitstr-test.c b/t/bitstr-test.c index 68008d5c8..1fde4137b 100644 --- a/t/bitstr-test.c +++ b/t/bitstr-test.c @@ -87,7 +87,7 @@ int do_test(const char *input, unsigned int input_len, return argc; } -int main() { +int main(void) { test1("\x81", 8, "\x81", 0); test2("\x81", 8, "\x81", 0, 1, "", -1); test2("\x81", 8, "\x81", 0, 1, NULL, -1); diff --git a/t/const_str_hash-test.c b/t/const_str_hash-test.c index a028a3402..2ff732c57 100644 --- a/t/const_str_hash-test.c +++ b/t/const_str_hash-test.c @@ -26,7 +26,7 @@ static void test(char *p, int exp) { } } -int main() { +int main(void) { test("one", 1); test("two", 2); test("dashed-string", 3); diff --git a/t/log_funcs.h b/t/log_funcs.h index ffba6d974..fdb0048b3 100644 --- a/t/log_funcs.h +++ b/t/log_funcs.h @@ -8,7 +8,7 @@ struct call; struct stream_fd; struct ice_agent; -INLINE void log_info_clear() { +INLINE void log_info_clear(void) { } INLINE void log_info_call(struct call *c) { } diff --git a/t/payload-tracker-test.c b/t/payload-tracker-test.c index 1763f7c65..48f25b068 100644 --- a/t/payload-tracker-test.c +++ b/t/payload-tracker-test.c @@ -31,7 +31,7 @@ static void most_cmp(struct payload_tracker *t, const char *cmp, const char *fil #define cmp(s) most_cmp(&t, s, __FILE__, __LINE__) #define add(p) payload_tracker_add(&t, p) -int main() { +int main(void) { struct payload_tracker t; payload_tracker_init(&t); diff --git a/t/transcode-test.c b/t/transcode-test.c index 75ddb457a..df63ad65e 100644 --- a/t/transcode-test.c +++ b/t/transcode-test.c @@ -103,7 +103,7 @@ static void __sdp_pt_fmt(int num, str codec, int clockrate, str full_codec, str #define sdp_pt(num, codec, clockrate) sdp_pt_fmt(num, codec, clockrate, "") -static void offer() { +static void offer(void) { printf("offer\n"); codec_rtp_payload_types(media_B, media_A, &rtp_types, &flags); codec_handlers_update(media_B, media_A, &flags); @@ -111,7 +111,7 @@ static void offer() { memset(&flags, 0, sizeof(flags)); } -static void answer() { +static void answer(void) { printf("answer\n"); codec_rtp_payload_types(media_A, media_B, &rtp_types, &flags); codec_handlers_update(media_A, media_B, &flags); @@ -282,7 +282,7 @@ static void __packet_seq_ts(const char *file, int line, struct call_media *media #define packet_seq_nf(side, pt_in, pload, rtp_ts, rtp_seq, pt_out, pload_exp) \ packet_seq_ts(side, pt_in, pload, rtp_ts, rtp_seq, pt_out, pload_exp, -1, 0) -static void end() { +static void end(void) { g_hash_table_destroy(rtp_ts_ht); g_hash_table_destroy(rtp_seq_ht); printf("\n"); @@ -312,7 +312,7 @@ static void dtmf(const char *s) { #define AMR_WB_payload "\xf0\x1c\xf3\x06\x08\x10\x77\x32\x23\x20\xd3\x50\x62\x12\xc7\x7c\xe2\xea\x84\x0e\x6e\xf4\x4d\xe4\x7f\xc9\x4c\xcc\x58\x5d\xed\xcc\x5d\x7c\x6c\x14\x7d\xc0" // octet aligned #define AMR_WB_payload_noe "\xf1\xfc\xc1\x82\x04\x1d\xcc\x88\xc8\x34\xd4\x18\x84\xb1\xdf\x38\xba\xa1\x03\x9b\xbd\x13\x79\x1f\xf2\x53\x33\x16\x17\x7b\x73\x17\x5f\x1b\x05\x1f\x70" // bandwidth efficient -int main() { +int main(void) { codeclib_init(0); srandom(time(NULL));