From 7a4765325d1f6accdbad3b74abddc2760f014c11 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 3 Nov 2022 11:38:41 +0100 Subject: [PATCH] Support building with -Werror=strict-prototypes / -Werror=old-style-definition Unfortunately "-std=c99" is not sufficient to make gcc ignore code that uses constructs of earlier C standards, which were abandoned in C99. See https://lwn.net/ml/fedora-devel/Y1kvF35WozzGBpc8@redhat.com/ for some related discussion. Change-Id: I861be39275b40c522c02f553074c5a4489e87127 --- src/ctrl.c | 2 +- src/dgsm.c | 2 +- src/hlr.c | 4 ++-- src/hlr_db_tool.c | 2 +- src/lu_fsm.c | 2 +- src/mslookup/osmo-mslookup-client.c | 4 ++-- src/mslookup_server.c | 2 +- src/mslookup_server_mdns.c | 2 +- tests/auc/auc_test.c | 2 +- .../gen_ts_55_205_test_sets/main_template.c | 2 +- tests/db/db_test.c | 10 +++++----- tests/mslookup/mdns_test.c | 6 +++--- tests/mslookup/mslookup_client_mdns_test.c | 18 +++++++++--------- tests/mslookup/mslookup_client_test.c | 4 ++-- tests/mslookup/mslookup_test.c | 4 ++-- 15 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/ctrl.c b/src/ctrl.c index f101d253..11b0f5c9 100644 --- a/src/ctrl.c +++ b/src/ctrl.c @@ -749,7 +749,7 @@ static int hlr_ctrl_node_lookup(void *data, vector vline, int *node_type, return 1; } -static int hlr_ctrl_cmds_install() +static int hlr_ctrl_cmds_install(void) { int rc = 0; diff --git a/src/dgsm.c b/src/dgsm.c index bfa5df83..cdd82a23 100644 --- a/src/dgsm.c +++ b/src/dgsm.c @@ -191,7 +191,7 @@ void dgsm_start(void *ctx) dgsm_mdns_client_config_apply(); } -void dgsm_stop() +void dgsm_stop(void) { g_hlr->mslookup.allow_startup = false; mslookup_server_mdns_config_apply(); diff --git a/src/hlr.c b/src/hlr.c index 294da23c..193dd38d 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -568,12 +568,12 @@ static int read_cb(struct osmo_gsup_conn *conn, struct msgb *msg) return 0; } -static void print_usage() +static void print_usage(void) { printf("Usage: osmo-hlr\n"); } -static void print_help() +static void print_help(void) { printf(" -h --help This text.\n"); printf(" -c --config-file filename The config file to use.\n"); diff --git a/src/hlr_db_tool.c b/src/hlr_db_tool.c index b2a26dc1..058a12cb 100644 --- a/src/hlr_db_tool.c +++ b/src/hlr_db_tool.c @@ -51,7 +51,7 @@ static struct { .db_upgrade = false, }; -static void print_help() +static void print_help(void) { printf("\n"); printf("Usage: osmo-hlr-db-tool [-l ] [create|import-nitb-db ]\n"); diff --git a/src/lu_fsm.c b/src/lu_fsm.c index b5493dbb..8f02f5a0 100644 --- a/src/lu_fsm.c +++ b/src/lu_fsm.c @@ -314,7 +314,7 @@ static struct osmo_fsm lu_fsm = { .cleanup = lu_fsm_cleanup, }; -static __attribute__((constructor)) void lu_fsm_init() +static __attribute__((constructor)) void lu_fsm_init(void) { OSMO_ASSERT(osmo_fsm_register(&lu_fsm) == 0); } diff --git a/src/mslookup/osmo-mslookup-client.c b/src/mslookup/osmo-mslookup-client.c index dff7d316..d2a629f0 100644 --- a/src/mslookup/osmo-mslookup-client.c +++ b/src/mslookup/osmo-mslookup-client.c @@ -53,7 +53,7 @@ static void print_version(void) "\n"); } -static void print_help() +static void print_help(void) { print_version(); printf( @@ -555,7 +555,7 @@ int socket_init(const char *sock_path) return 0; } -void socket_close() +void socket_close(void) { struct socket_client *c, *n; llist_for_each_entry_safe(c, n, &globals.socket_clients, entry) diff --git a/src/mslookup_server.c b/src/mslookup_server.c index 885adf83..37713697 100644 --- a/src/mslookup_server.c +++ b/src/mslookup_server.c @@ -49,7 +49,7 @@ static void set_result(struct osmo_mslookup_result *result, result->age = age; } -const struct mslookup_service_host *mslookup_server_get_local_gsup_addr() +const struct mslookup_service_host *mslookup_server_get_local_gsup_addr(void) { static struct mslookup_service_host gsup_bind = {}; struct mslookup_service_host *host; diff --git a/src/mslookup_server_mdns.c b/src/mslookup_server_mdns.c index a6695266..3c7606ae 100644 --- a/src/mslookup_server_mdns.c +++ b/src/mslookup_server_mdns.c @@ -121,7 +121,7 @@ void osmo_mslookup_server_mdns_stop(struct osmo_mslookup_server_mdns *server) talloc_free(server); } -void mslookup_server_mdns_config_apply() +void mslookup_server_mdns_config_apply(void) { /* Check whether to start/stop/restart mDNS server */ bool should_run; diff --git a/tests/auc/auc_test.c b/tests/auc/auc_test.c index 6bf2eb2f..61cf82f8 100644 --- a/tests/auc/auc_test.c +++ b/tests/auc/auc_test.c @@ -509,7 +509,7 @@ static void test_gen_vectors_3g_xor(void) } /* Test a variety of invalid authentication data combinations */ -void test_gen_vectors_bad_args() +void test_gen_vectors_bad_args(void) { struct osmo_auth_vector vec; uint8_t auts[14]; diff --git a/tests/auc/gen_ts_55_205_test_sets/main_template.c b/tests/auc/gen_ts_55_205_test_sets/main_template.c index 509416a0..ffdfa78b 100644 --- a/tests/auc/gen_ts_55_205_test_sets/main_template.c +++ b/tests/auc/gen_ts_55_205_test_sets/main_template.c @@ -100,7 +100,7 @@ int rand_get(uint8_t *rand, unsigned int len) FUNCTIONS -int main() +int main(int argc, char **argv) { printf("3GPP TS 55.205 Test Sets\n"); void *tall_ctx = talloc_named_const(NULL, 1, "test"); diff --git a/tests/db/db_test.c b/tests/db/db_test.c index 246b7dbe..ab997bfc 100644 --- a/tests/db/db_test.c +++ b/tests/db/db_test.c @@ -246,7 +246,7 @@ static int db_subscr_lu_str(struct db_context *dbc, int64_t subscr_id, return db_subscr_lu(dbc, subscr_id, &vlr_nr, is_ps, NULL); } -static void test_subscr_create_update_sel_delete() +static void test_subscr_create_update_sel_delete(void) { int64_t id0, id1, id2, id_short; comment_start(); @@ -541,7 +541,7 @@ static const struct sub_auth_data_str *mk_aud_3g(enum osmo_auth_algo algo, return &aud; } -static void test_subscr_aud() +static void test_subscr_aud(void) { int64_t id; @@ -783,7 +783,7 @@ static void test_subscr_aud() /* Make each key too short in this test. Note that we can't set them longer than the allowed size without changing the * table structure. */ -static void test_subscr_aud_invalid_len() +static void test_subscr_aud_invalid_len(void) { int64_t id; @@ -845,7 +845,7 @@ static void test_subscr_aud_invalid_len() comment_end(); } -static void test_subscr_sqn() +static void test_subscr_sqn(void) { int64_t id; @@ -918,7 +918,7 @@ static void test_subscr_sqn() comment_end(); } -static void test_ind() +static void test_ind(void) { comment_start(); diff --git a/tests/mslookup/mdns_test.c b/tests/mslookup/mdns_test.c index 0c8be46b..7b26f0f3 100644 --- a/tests/mslookup/mdns_test.c +++ b/tests/mslookup/mdns_test.c @@ -216,7 +216,7 @@ static const struct osmo_mdns_rfc_header header_enc_dec_test_data[] = { }, }; -void test_enc_dec_rfc_header() +void test_enc_dec_rfc_header(void) { int i; @@ -241,7 +241,7 @@ void test_enc_dec_rfc_header() } } -void test_enc_dec_rfc_header_einval() +void test_enc_dec_rfc_header_einval(void) { struct osmo_mdns_rfc_header out = {0}; struct msgb *msg = msgb_alloc(4096, "dns_test"); @@ -578,7 +578,7 @@ static void test_result_from_answer(void *ctx) } } -int main() +int main(int argc, char **argv) { void *ctx = talloc_named_const(NULL, 0, "main"); osmo_init_logging2(ctx, NULL); diff --git a/tests/mslookup/mslookup_client_mdns_test.c b/tests/mslookup/mslookup_client_mdns_test.c index dc9d1d55..274e1e76 100644 --- a/tests/mslookup/mslookup_client_mdns_test.c +++ b/tests/mslookup/mslookup_client_mdns_test.c @@ -80,14 +80,14 @@ static int server_recv(struct osmo_fd *osmo_fd, unsigned int what) return n; } -static void server_init() +static void server_init(void) { fprintf(stderr, "%s\n", __func__); server_mc = osmo_mdns_sock_init(ctx, TEST_IP, TEST_PORT, server_recv, NULL, 0); OSMO_ASSERT(server_mc); } -static void server_stop() +static void server_stop(void) { fprintf(stderr, "%s\n", __func__); OSMO_ASSERT(server_mc); @@ -98,7 +98,7 @@ static void server_stop() struct osmo_mslookup_client* client; struct osmo_mslookup_client_method* client_method; -static void client_init() +static void client_init(void) { fprintf(stderr, "%s\n", __func__); client = osmo_mslookup_client_new(ctx); @@ -117,7 +117,7 @@ static void client_recv(struct osmo_mslookup_client *client, uint32_t request_ha osmo_mslookup_client_request_cancel(client, request_handle); } -static void client_query() +static void client_query(void) { struct osmo_mslookup_id id = {.type = OSMO_MSLOOKUP_ID_IMSI, .imsi = "123456789012345"}; @@ -134,7 +134,7 @@ static void client_query() osmo_mslookup_client_request(client, &query, &handling); } -static void client_stop() +static void client_stop(void) { fprintf(stderr, "%s\n", __func__); osmo_mslookup_client_free(client); @@ -154,7 +154,7 @@ const struct timeval fake_time_start_time = { 0, 0 }; osmo_timers_update(); \ } while (0) -static void fake_time_start() +static void fake_time_start(void) { struct timespec *clock_override; @@ -167,7 +167,7 @@ static void fake_time_start() osmo_clock_override_enable(CLOCK_MONOTONIC, true); fake_time_passes(0, 0); } -static void test_server_client() +static void test_server_client(void) { fprintf(stderr, "-- %s --\n", __func__); server_init(); @@ -190,7 +190,7 @@ static void test_server_client() client_stop(); } -bool is_multicast_enabled() +bool is_multicast_enabled(void) { bool ret = true; struct addrinfo *ai; @@ -222,7 +222,7 @@ bool is_multicast_enabled() /* * Run all tests */ -int main() +int main(int argc, char **argv) { if (!is_multicast_enabled()) { fprintf(stderr, "ERROR: multicast is disabled! (OS#4361)"); diff --git a/tests/mslookup/mslookup_client_test.c b/tests/mslookup/mslookup_client_test.c index 9fcb9838..84b78104 100644 --- a/tests/mslookup/mslookup_client_test.c +++ b/tests/mslookup/mslookup_client_test.c @@ -147,7 +147,7 @@ const struct timeval fake_time_start_time = { 0, 0 }; osmo_timers_update(); \ } while (0) -static void fake_time_start() +static void fake_time_start(void) { struct timespec *clock_override; @@ -169,7 +169,7 @@ static void result_cb_once(struct osmo_mslookup_client *client, LOGP(DMSLOOKUP, LOGL_DEBUG, "result_cb(): %s\n", osmo_mslookup_result_name_c(ctx, query, result)); } -int main() +int main(int argc, char **argv) { ctx = talloc_named_const(NULL, 0, "main"); osmo_init_logging2(ctx, NULL); diff --git a/tests/mslookup/mslookup_test.c b/tests/mslookup/mslookup_test.c index a5efa00e..742e14b2 100644 --- a/tests/mslookup/mslookup_test.c +++ b/tests/mslookup/mslookup_test.c @@ -50,7 +50,7 @@ const char *domains[] = { "qwerty.1.qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmm", }; -void test_osmo_mslookup_query_init_from_domain_str() +void test_osmo_mslookup_query_init_from_domain_str(void) { int i; for (i = 0; i < ARRAY_SIZE(domains); i++) { @@ -68,7 +68,7 @@ void test_osmo_mslookup_query_init_from_domain_str() } } -int main() +int main(int argc, char **argv) { ctx = talloc_named_const(NULL, 0, "main"); osmo_init_logging2(ctx, NULL);