]> sourceware.org Git - systemtap.git/commitdiff
testsuite C programs: fix some gcc warnings
authorFrank Ch. Eigler <fche@redhat.com>
Tue, 11 Aug 2015 15:46:54 +0000 (11:46 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Tue, 11 Aug 2015 15:54:55 +0000 (11:54 -0400)
A few "undeclared function" warnings could make tests untested.
We ununtest a bunch.

testsuite/systemtap.base/func_alias.c
testsuite/systemtap.base/plt.c
testsuite/systemtap.base/process_by_pid.c
testsuite/systemtap.base/towers.c
testsuite/systemtap.syscall/arch_prctl.c
testsuite/systemtap.syscall/capability.c
testsuite/systemtap.syscall/ioperm.c
testsuite/systemtap.syscall/kexec_load.c
testsuite/systemtap.syscall/lxattr.c
testsuite/systemtap.syscall/perf_event.c
testsuite/systemtap.syscall/uselib.c

index acc6b30082df53a34905af0f481e0b3088d7d2cc..c44fc1c8208306a31fc20c26d0c894bb794ddd0a 100644 (file)
@@ -1,2 +1,2 @@
 int main() { return 0; }
-extern int (*func_alias) __attribute__ ((alias ("main")));
+extern int func_alias () __attribute__ ((alias ("main")));
index 6d56333046551a268e1c2088b331224ebcb3c851..8a9a68789b13063987d9f6732d0ada55605e5337 100644 (file)
@@ -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 ()
index f81de2d229090080c23e28a8c1b1e821eb2e722f..39e3c2d02a9ccf3138f5ff751352b68ed8d67986 100644 (file)
@@ -1,4 +1,5 @@
 #include "sys/sdt.h"
+#include <unistd.h>
 
 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;
 }
index 6465bc4228624b44165629d9b207b86d56136843..9c60c53adf86091ceaf5f7b6cbbc50b0f46b51c1 100644 (file)
@@ -31,6 +31,7 @@ error (emsg)
 
 void
 makenull (s)
+     int s;
 {
   stack[s] = 0;
 }
index 9acf4516aaa6547fef02e1d12b2653390dd0f158..5aedd51b6c9c151b2b086348118e2e6b12c780c9 100644 (file)
@@ -9,6 +9,9 @@
 #include <asm/prctl.h>
 #include <sys/prctl.h>
 
+// 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;
index c07c42f46387487937e331db6dd0b0380910d23c..68b04e8612fd1c0645de2f46200f91d5a5d64aac 100644 (file)
@@ -9,6 +9,9 @@
 
 #include <linux/capability.h>
 
+#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;
 
index 68f9dffe5a2039f5303454af974fb7bdb7c586af..c16bb64741c66c5dec88812b50168d9b36665756 100644 (file)
@@ -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
 
index 5e98f82cfaf89942f0c33a624e74a20f62166f63..0ca8bbf4557e812aa0a6be950590400650cbbe9a 100644 (file)
@@ -10,6 +10,9 @@
 #include <fcntl.h>
 #include <linux/version.h>
 
+#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;
 
index b8b87b96b76a5354b978cb98114aa5cb11c08c6b..425ffbc6437a7ca4b8708e3a9739d6dabcdf7790 100644 (file)
@@ -4,6 +4,7 @@
 #include <unistd.h>
 #include <sys/xattr.h>
 #include <endian.h>
+#include <fcntl.h>
 
 #define PATH "foobar"
 #define XATTR_NAME "user.systemtap.test"
index 3bfc49d39fa150d119af43ea3bc800aa654fdffe..013ddf235574319f156b6b8fc5bcc36483ed7ff6 100644 (file)
@@ -4,6 +4,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <sys/syscall.h>
+#include <sys/ioctl.h>
 
 #ifdef __NR_perf_event_open
 #include <linux/perf_event.h>
index 91d2864bb8d1f7ae61e3bbfb71c37748eed5ad06..d42a7ea972fa7dc86f756e057999c1d586cf067d 100644 (file)
@@ -3,6 +3,7 @@
 #define _GNU_SOURCE
 #include <unistd.h>
 #include <sys/syscall.h>
+#include <linux/version.h>
 
 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)]]]]
 
This page took 0.04118 seconds and 5 git commands to generate.