From b670b3048650a2568e1fd782843252bb237851cb Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 25 Mar 2020 18:39:39 -0400 Subject: [PATCH] Fix: tests: add `void` parameter to functions that take no parameters MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In C, empty parenthesis declare a function without a prorotype (without specifying its parameters). This is not the same as having a `void` parameter, which declares a function which has no parameters. It's safer to use the later, otherwise it makes it possible to erroneously call the function with some arguments. Change this `test_function` to add `void`. It fixes diagnostics like: CC userspace-probe-elf-binary.o /home/simark/src/lttng-tools/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary.c:12:33: error: no previous prototype for ‘test_function’ [-Werror=missing-prototypes] 12 | void __attribute__ ((noinline)) test_function() | Change-Id: Iceb7636e44d45f51889667ec76f2c04c032b5df8 Signed-off-by: Simon Marchi Signed-off-by: Jérémie Galarneau --- tests/regression/ust/multi-lib/multi-lib-test.c | 4 ++-- .../userspace-probe-elf-binary/userspace-probe-elf-binary.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/regression/ust/multi-lib/multi-lib-test.c b/tests/regression/ust/multi-lib/multi-lib-test.c index 218b1196b..6bec733ff 100644 --- a/tests/regression/ust/multi-lib/multi-lib-test.c +++ b/tests/regression/ust/multi-lib/multi-lib-test.c @@ -15,8 +15,8 @@ #include "callsites.h" #endif -void exec_callsite(); -void exec_callsite() +void exec_callsite(void); +void exec_callsite(void) { #if HAS_CALLSITES call_tracepoint(); diff --git a/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary.c b/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary.c index d4304541d..e6e041da9 100644 --- a/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary.c +++ b/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary.c @@ -8,8 +8,8 @@ #include "foo.h" volatile int not_a_function = 0; -void __attribute__ ((noinline)) test_function(); -void __attribute__ ((noinline)) test_function() +void __attribute__ ((noinline)) test_function(void); +void __attribute__ ((noinline)) test_function(void) { not_a_function += 1; } -- 2.34.1