From: Frank Ch. Eigler Date: Tue, 11 Aug 2015 15:46:54 +0000 (-0400) Subject: testsuite C programs: fix some gcc warnings X-Git-Tag: release-2.9~167 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=c8a69986cd0af8095ae9c061491375fe9b407dc6;p=systemtap.git testsuite C programs: fix some gcc warnings A few "undeclared function" warnings could make tests untested. We ununtest a bunch. --- diff --git a/testsuite/systemtap.base/func_alias.c b/testsuite/systemtap.base/func_alias.c index acc6b3008..c44fc1c82 100644 --- a/testsuite/systemtap.base/func_alias.c +++ b/testsuite/systemtap.base/func_alias.c @@ -1,2 +1,2 @@ int main() { return 0; } -extern int (*func_alias) __attribute__ ((alias ("main"))); +extern int func_alias () __attribute__ ((alias ("main"))); diff --git a/testsuite/systemtap.base/plt.c b/testsuite/systemtap.base/plt.c index 6d5633304..8a9a68789 100644 --- a/testsuite/systemtap.base/plt.c +++ b/testsuite/systemtap.base/plt.c @@ -248,6 +248,20 @@ datetime (void) #endif +#if defined (LIBPLT1) // decls for LIBPLT2 pieces +void * fatal (const char *ptr); +void * xmalloc (size_t size); +char * savestring (const char *ptr); +int open2 (char *str1, char *str2, int flags); +int open3 (char *str1, char *str2, int flags); +char * basename2 (char *prog); +int critters (void); +int widgets (void); +int datetime (void); +#endif + + + #if defined (LIBPLT1) || defined (NOLIBPLT) void zenme () diff --git a/testsuite/systemtap.base/process_by_pid.c b/testsuite/systemtap.base/process_by_pid.c index f81de2d22..39e3c2d02 100644 --- a/testsuite/systemtap.base/process_by_pid.c +++ b/testsuite/systemtap.base/process_by_pid.c @@ -1,4 +1,5 @@ #include "sys/sdt.h" +#include void sleeper () { sleep(1); @@ -10,5 +11,7 @@ int main () { marker_here: STAP_PROBE(tmp_test_file, while_start); } + if (0) // suppress gcc warning about unused label + goto marker_here; return 0; } diff --git a/testsuite/systemtap.base/towers.c b/testsuite/systemtap.base/towers.c index 6465bc422..9c60c53ad 100644 --- a/testsuite/systemtap.base/towers.c +++ b/testsuite/systemtap.base/towers.c @@ -31,6 +31,7 @@ error (emsg) void makenull (s) + int s; { stack[s] = 0; } diff --git a/testsuite/systemtap.syscall/arch_prctl.c b/testsuite/systemtap.syscall/arch_prctl.c index 9acf4516a..5aedd51b6 100644 --- a/testsuite/systemtap.syscall/arch_prctl.c +++ b/testsuite/systemtap.syscall/arch_prctl.c @@ -9,6 +9,9 @@ #include #include +// This decl is missing from glibc; it's a deprecated syscall. +#define arch_prctl(x,y) syscall(__NR_arch_prctl,x,y) + int main() { unsigned long fs; diff --git a/testsuite/systemtap.syscall/capability.c b/testsuite/systemtap.syscall/capability.c index c07c42f46..68b04e861 100644 --- a/testsuite/systemtap.syscall/capability.c +++ b/testsuite/systemtap.syscall/capability.c @@ -9,6 +9,9 @@ #include +#define capget(x,y) syscall(__NR_capget,x,y) +#define capset(x,y) syscall(__NR_capset,x,y) + static struct __user_cap_header_struct header; static struct __user_cap_data_struct data; diff --git a/testsuite/systemtap.syscall/ioperm.c b/testsuite/systemtap.syscall/ioperm.c index 68f9dffe5..c16bb6474 100644 --- a/testsuite/systemtap.syscall/ioperm.c +++ b/testsuite/systemtap.syscall/ioperm.c @@ -51,6 +51,8 @@ int main() { // its args vary between those two archs. Not all are // being addressed in the tapset. +#define iopl(x) syscall(__NR_iopl,x) + iopl(3); //staptest// iopl (3) = NNNN diff --git a/testsuite/systemtap.syscall/kexec_load.c b/testsuite/systemtap.syscall/kexec_load.c index 5e98f82cf..0ca8bbf45 100644 --- a/testsuite/systemtap.syscall/kexec_load.c +++ b/testsuite/systemtap.syscall/kexec_load.c @@ -10,6 +10,9 @@ #include #include +#define capget(x,y) syscall(__NR_capget,x,y) +#define capset(x,y) syscall(__NR_capset,x,y) + static struct __user_cap_header_struct header; static struct __user_cap_data_struct data; diff --git a/testsuite/systemtap.syscall/lxattr.c b/testsuite/systemtap.syscall/lxattr.c index b8b87b96b..425ffbc64 100644 --- a/testsuite/systemtap.syscall/lxattr.c +++ b/testsuite/systemtap.syscall/lxattr.c @@ -4,6 +4,7 @@ #include #include #include +#include #define PATH "foobar" #define XATTR_NAME "user.systemtap.test" diff --git a/testsuite/systemtap.syscall/perf_event.c b/testsuite/systemtap.syscall/perf_event.c index 3bfc49d39..013ddf235 100644 --- a/testsuite/systemtap.syscall/perf_event.c +++ b/testsuite/systemtap.syscall/perf_event.c @@ -4,6 +4,7 @@ #include #include #include +#include #ifdef __NR_perf_event_open #include diff --git a/testsuite/systemtap.syscall/uselib.c b/testsuite/systemtap.syscall/uselib.c index 91d2864bb..d42a7ea97 100644 --- a/testsuite/systemtap.syscall/uselib.c +++ b/testsuite/systemtap.syscall/uselib.c @@ -3,6 +3,7 @@ #define _GNU_SOURCE #include #include +#include int main() { @@ -15,6 +16,7 @@ int main() // language function that we can't probe. This was changed in // 2.6.22. #if defined(__NR_uselib) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) +#define uselib(x) syscall(__NR_uselib,x) uselib("blah"); //staptest// [[[[uselib ("blah") = -NNNN!!!!ni_syscall () = -NNNN (ENOSYS)]]]]