Fix: tests: add `void` parameter to functions that take no parameters
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 25 Mar 2020 22:39:39 +0000 (18:39 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 26 Mar 2020 22:01:40 +0000 (18:01 -0400)
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 <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/regression/ust/multi-lib/multi-lib-test.c
tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary.c

index 218b1196be438ce2d6402e4891605db8a841a0b8..6bec733ff555d9a501b773b9f439278a777cd8af 100644 (file)
@@ -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();
index d4304541d34a7a451f8d001857aea304ef96ecd4..e6e041da998519ecadd7afc7ee4e4d9a31878caa 100644 (file)
@@ -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;
 }
This page took 0.027148 seconds and 4 git commands to generate.