From f12eb9c1ceb619db54be0842323a32cda12651cd Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 25 Nov 2019 16:41:29 -0500 Subject: [PATCH] Fix all -Wmissing-declarations warning instances MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This fixes all the remaining -Wmissing-declarations warning occurences. The changes either: - Make functions static - Remove unused functions - Add declarations for functions that are meant to be exported in a shared object to override some other function (e.g. lttng_ust_clock_plugin_init). There isn't really a better place for these declarations. Change-Id: If08855b75bf44dfdcfbdd654c272474ad8ebef39 Signed-off-by: Simon Marchi Signed-off-by: Jérémie Galarneau --- extras/bindings/swig/python/lttng.i.in | 3 ++ tests/regression/kernel/select_poll_epoll.c | 31 +++++++++++++------ .../tools/notification/notification.c | 9 +++++- .../regression/tools/rotation/schedule_api.c | 11 +++++++ .../lttng-ust-clock-override-test.c | 1 + .../lttng-ust-getcpu-override-test.c | 2 ++ tests/regression/ust/high-throughput/main.c | 2 ++ tests/regression/ust/multi-lib/callsites.c | 4 ++- .../regression/ust/multi-lib/multi-lib-test.c | 9 ++++++ 9 files changed, 61 insertions(+), 11 deletions(-) diff --git a/extras/bindings/swig/python/lttng.i.in b/extras/bindings/swig/python/lttng.i.in index e99c9aecf..b6b6f960e 100644 --- a/extras/bindings/swig/python/lttng.i.in +++ b/extras/bindings/swig/python/lttng.i.in @@ -29,6 +29,9 @@ multiple concurrent processes and threads. Tracing across multiple systems is al // This makes the typemap code useable with both Python 2 and 3. #define PyInt_AsSsize_t PyLong_AsSsize_t #endif + +// Avoid -Wmissing-declarations warning. +PyObject *SWIG_init(void); %} typedef unsigned int uint32_t; diff --git a/tests/regression/kernel/select_poll_epoll.c b/tests/regression/kernel/select_poll_epoll.c index 33b8cb5d5..3c9a4b15d 100644 --- a/tests/regression/kernel/select_poll_epoll.c +++ b/tests/regression/kernel/select_poll_epoll.c @@ -46,6 +46,7 @@ struct ppoll_thread_data { int value; }; +static void test_select_big(void) { fd_set rfds, wfds, exfds; @@ -95,6 +96,7 @@ end: return; } +static void test_pselect(void) { fd_set rfds; @@ -128,6 +130,7 @@ void test_pselect(void) } +static void test_select(void) { fd_set rfds; @@ -161,6 +164,7 @@ void test_select(void) } +static void test_poll(void) { struct pollfd ufds[NB_FD]; @@ -185,6 +189,7 @@ void test_poll(void) } } +static void test_ppoll(void) { struct pollfd ufds[NB_FD]; @@ -217,6 +222,7 @@ void test_ppoll(void) } } +static void test_ppoll_big(void) { struct pollfd ufds[MAX_FDS]; @@ -256,6 +262,7 @@ void test_ppoll_big(void) return; } +static void test_epoll(void) { int ret, epollfd; @@ -298,6 +305,7 @@ end: return; } +static void test_pepoll(void) { int ret, epollfd; @@ -340,6 +348,7 @@ end: return; } +static void run_working_cases(void) { int ret; @@ -386,6 +395,7 @@ end: * segfault (eventually with a "*** stack smashing detected ***" message). * The event should contain an array of 100 FDs filled with garbage. */ +static void ppoll_fds_buffer_overflow(void) { struct pollfd ufds[NB_FD]; @@ -417,6 +427,7 @@ void ppoll_fds_buffer_overflow(void) * cleanly fail with a "Invalid argument". * The event should contain an empty array of FDs and overflow = 1. */ +static void ppoll_fds_ulong_max(void) { struct pollfd ufds[NB_FD]; @@ -447,6 +458,7 @@ void ppoll_fds_ulong_max(void) * Pass an invalid file descriptor to pselect6(). The syscall should return * -EBADF. The recorded event should contain a "ret = -EBADF (-9)". */ +static void pselect_invalid_fd(void) { fd_set rfds; @@ -493,6 +505,7 @@ error: * Invalid pointer as writefds, should output a ppoll event * with 0 FDs. */ +static void pselect_invalid_pointer(void) { fd_set rfds; @@ -524,6 +537,7 @@ void pselect_invalid_pointer(void) * Pass an invalid pointer to epoll_pwait, should fail with * "Bad address", the event returns 0 FDs. */ +static void epoll_pwait_invalid_pointer(void) { int ret, epollfd; @@ -568,6 +582,7 @@ end: * Set maxevents to INT_MAX, should output "Invalid argument" * The event should return an empty array. */ +static void epoll_pwait_int_max(void) { int ret, epollfd; @@ -607,6 +622,7 @@ end: return; } +static void *ppoll_writer(void *arg) { struct ppoll_thread_data *data = (struct ppoll_thread_data *) arg; @@ -620,6 +636,7 @@ void *ppoll_writer(void *arg) return NULL; } +static void do_ppoll(int *fds, struct pollfd *ufds) { int i, ret; @@ -649,6 +666,7 @@ void do_ppoll(int *fds, struct pollfd *ufds) } } +static void stress_ppoll(int *fds, int value) { pthread_t writer; @@ -690,6 +708,7 @@ end: * * ppoll should work as expected and the trace should be readable at the end. */ +static void ppoll_concurrent_write(void) { int i, ret, fds[MAX_FDS]; @@ -715,6 +734,7 @@ void ppoll_concurrent_write(void) return; } +static void *epoll_pwait_writer(void *addr) { srand(time(NULL)); @@ -732,6 +752,7 @@ void *epoll_pwait_writer(void *addr) * buffer allocated for the returned data. This should randomly segfault. * The trace should be readable and no kernel OOPS should occur. */ +static void epoll_pwait_concurrent_munmap(void) { int ret, epollfd, i, fds[MAX_FDS]; @@ -814,15 +835,7 @@ end: return; } -void usage(poptContext optCon, int exitcode, char *error, char *addl) -{ - poptPrintUsage(optCon, stderr, 0); - if (error) { - fprintf(stderr, "%s: %s\n", error, addl); - } - exit(exitcode); -} - +static void print_list(void) { fprintf(stderr, "Test list (-t X):\n"); diff --git a/tests/regression/tools/notification/notification.c b/tests/regression/tools/notification/notification.c index 68ec64d01..535a71fce 100644 --- a/tests/regression/tools/notification/notification.c +++ b/tests/regression/tools/notification/notification.c @@ -87,6 +87,7 @@ void wait_on_file(const char *path, bool file_exist) } } +static int write_pipe(const char *path, uint8_t data) { int ret = 0; @@ -118,6 +119,7 @@ end: return ret; } +static int stop_consumer(const char **argv) { int ret = 0, i; @@ -128,6 +130,7 @@ int stop_consumer(const char **argv) return ret; } +static int resume_consumer(const char **argv) { int ret = 0, i; @@ -138,7 +141,8 @@ int resume_consumer(const char **argv) return ret; } -int suspend_application() +static +int suspend_application(void) { int ret; struct stat buf; @@ -166,6 +170,7 @@ error: } +static int resume_application() { int ret; @@ -196,6 +201,7 @@ error: } +static void test_triggers_buffer_usage_condition(const char *session_name, const char *channel_name, enum lttng_domain_type domain_type, @@ -389,6 +395,7 @@ void wait_data_pending(const char *session_name) } while (ret != 0); } +static void test_notification_channel(const char *session_name, const char *channel_name, const enum lttng_domain_type domain_type, const char **argv) { int ret = 0; diff --git a/tests/regression/tools/rotation/schedule_api.c b/tests/regression/tools/rotation/schedule_api.c index 03c446fcb..611468563 100644 --- a/tests/regression/tools/rotation/schedule_api.c +++ b/tests/regression/tools/rotation/schedule_api.c @@ -22,6 +22,7 @@ const char *session_name; +static bool schedules_equal(const struct lttng_rotation_schedule *a, const struct lttng_rotation_schedule *b) { @@ -84,6 +85,7 @@ end: return equal; } +static void test_add_null_session(void) { enum lttng_rotation_status status; @@ -97,6 +99,7 @@ void test_add_null_session(void) lttng_rotation_schedule_destroy(size_schedule); } +static void test_add_null_schedule(void) { enum lttng_rotation_status status; @@ -106,6 +109,7 @@ void test_add_null_schedule(void) "NULL schedule rejected by lttng_session_add_rotation_schedule()"); } +static void test_add_uninitialized_schedule(void) { enum lttng_rotation_status status; @@ -132,6 +136,7 @@ void test_add_uninitialized_schedule(void) lttng_rotation_schedule_destroy(periodic_schedule); } +static void test_remove_null_session(void) { enum lttng_rotation_status status; @@ -145,6 +150,7 @@ void test_remove_null_session(void) lttng_rotation_schedule_destroy(size_schedule); } +static void test_remove_null_schedule(void) { enum lttng_rotation_status status; @@ -154,6 +160,7 @@ void test_remove_null_schedule(void) "NULL schedule rejected by lttng_session_remove_rotation_schedule()"); } +static void test_remove_uninitialized_schedule(void) { enum lttng_rotation_status status; @@ -176,6 +183,7 @@ void test_remove_uninitialized_schedule(void) lttng_rotation_schedule_destroy(periodic_schedule); } +static void test_uninitialized_schedule_get(void) { uint64_t value; @@ -200,6 +208,7 @@ void test_uninitialized_schedule_get(void) } +static void test_add_list_remove_schedule( const struct lttng_rotation_schedule *original_schedule) { @@ -249,6 +258,7 @@ void test_add_list_remove_schedule( } +static void test_add_list_remove_size_schedule(void) { struct lttng_rotation_schedule *size_schedule; @@ -261,6 +271,7 @@ void test_add_list_remove_size_schedule(void) lttng_rotation_schedule_destroy(size_schedule); } +static void test_add_list_remove_periodic_schedule(void) { struct lttng_rotation_schedule *periodic_schedule; diff --git a/tests/regression/ust/clock-override/lttng-ust-clock-override-test.c b/tests/regression/ust/clock-override/lttng-ust-clock-override-test.c index b2c20bee3..dace1d99c 100644 --- a/tests/regression/ust/clock-override/lttng-ust-clock-override-test.c +++ b/tests/regression/ust/clock-override/lttng-ust-clock-override-test.c @@ -49,6 +49,7 @@ const char *plugin_description(void) return "Freeze time with 1KHz for regression test"; } +void lttng_ust_clock_plugin_init(void); void lttng_ust_clock_plugin_init(void) { int ret; diff --git a/tests/regression/ust/getcpu-override/lttng-ust-getcpu-override-test.c b/tests/regression/ust/getcpu-override/lttng-ust-getcpu-override-test.c index f1b707425..976bcb231 100644 --- a/tests/regression/ust/getcpu-override/lttng-ust-getcpu-override-test.c +++ b/tests/regression/ust/getcpu-override/lttng-ust-getcpu-override-test.c @@ -18,6 +18,7 @@ static long nprocessors; +static int plugin_getcpu(void) { /* Generate a sequence based on the number of configurated processor @@ -57,6 +58,7 @@ int plugin_getcpu(void) return ret; } +void lttng_ust_getcpu_plugin_init(void); void lttng_ust_getcpu_plugin_init(void) { int ret; diff --git a/tests/regression/ust/high-throughput/main.c b/tests/regression/ust/high-throughput/main.c index b59c9241f..092d8015f 100644 --- a/tests/regression/ust/high-throughput/main.c +++ b/tests/regression/ust/high-throughput/main.c @@ -21,10 +21,12 @@ #define TRACEPOINT_DEFINE #include "tp.h" +static void inthandler(int sig) { } +static int init_int_handler(void) { int result; diff --git a/tests/regression/ust/multi-lib/callsites.c b/tests/regression/ust/multi-lib/callsites.c index eaa613708..a67f102b4 100644 --- a/tests/regression/ust/multi-lib/callsites.c +++ b/tests/regression/ust/multi-lib/callsites.c @@ -18,7 +18,9 @@ #define VALUE (-1) #endif -void call_tracepoint(void) { +void call_tracepoint(void); +void call_tracepoint(void) +{ tracepoint(multi, tp, VALUE); } diff --git a/tests/regression/ust/multi-lib/multi-lib-test.c b/tests/regression/ust/multi-lib/multi-lib-test.c index 6a91089df..218b1196b 100644 --- a/tests/regression/ust/multi-lib/multi-lib-test.c +++ b/tests/regression/ust/multi-lib/multi-lib-test.c @@ -15,6 +15,7 @@ #include "callsites.h" #endif +void exec_callsite(); void exec_callsite() { #if HAS_CALLSITES @@ -22,6 +23,7 @@ void exec_callsite() #endif } +static void print_list(void) { fprintf(stderr, "Test list (-t X):\n"); @@ -31,6 +33,8 @@ void print_list(void) fprintf(stderr, "\t2: simulate the upgrade of a library containing the callsites using dlopen() and dlclose(). \n"); } +#if HAS_CALLSITES +static int dl_open_all(int nb_libraries, char **libraries) { int i, ret = 0; @@ -61,6 +65,7 @@ error: * Takes 2 paths to libraries, dlopen() the first, trace, dlopen() the second, * and dlclose the first to simulate the upgrade of a library. */ +static int upgrade_lib(int nb_libraries, char **libraries) { int i, ret = 0; @@ -92,11 +97,14 @@ int upgrade_lib(int nb_libraries, char **libraries) error: return ret; } +#endif /* HAS_CALLSITES */ +#if !HAS_CALLSITES /* * Simulate the upgrade of a library containing a callsite. * Receives two libraries containing callsites for the same tracepoint. */ +static int upgrade_callsite(int nb_libraries, char **libraries) { int ret = 0; @@ -159,6 +167,7 @@ int upgrade_callsite(int nb_libraries, char **libraries) error: return ret; } +#endif /* !HAS_CALLSITES */ int main(int argc, const char **argv) { -- 2.34.1