]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fixed one bug in gdbserver_tests/t.c and several compiler warnings triggered by the...
authorBart Van Assche <bvanassche@acm.org>
Sun, 8 May 2011 09:29:06 +0000 (09:29 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sun, 8 May 2011 09:29:06 +0000 (09:29 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11729

gdbserver_tests/clean_after_fork.c
gdbserver_tests/sleepers.c
gdbserver_tests/t.c

index 3ef0f67d476c5554234cfb6a990a058cac32dbc1..2246bb0ae7d256af7011dd31a4ef60c558e26716 100644 (file)
@@ -1,7 +1,10 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
-main()
+#include <unistd.h>
+#include <sys/wait.h>
+
+int main()
 {
    int mem = 0;
    int pid;
@@ -31,4 +34,6 @@ main()
    }
    if (mem == 0)
       printf("mem is zero\n");
+
+   return 0;
 }
index cea20cb6163d08ce891cd460a91be571cb3a6152..b7433ef9c1c3ab41ea0738aea67c86f43f92ca0a 100644 (file)
@@ -24,6 +24,7 @@ static pid_t gettid()
 }
 
 // will be invoked from gdb.
+static void whoami(char *msg) __attribute__((unused));
 static void whoami(char *msg)
 {
    fprintf(stderr, "pid %d Thread %d %s\n", getpid(), gettid(), msg);
@@ -131,7 +132,7 @@ int main (int argc, char *argv[])
   char *threads_spec;
   pthread_t ebbr, egll, zzzz;
   struct spec b, l, p, m;
-  char *some_mem = malloc(100);
+  char *some_mem __attribute__((unused)) = malloc(100);
   setaffinity();
 
   if (argc > 1)
index 860048090e687bfd4697a63172c03b35caa4fa1a..e40e457f34fcc5bfc9f2a31fa428d0cc674c5f0d 100644 (file)
@@ -33,9 +33,9 @@ static int int_und;
 static int sleeps = 15;
 static void make_error (char *s)
 {
-  char *make_error_name = "make_error name";
-  char c;
-  double pi2 = 2.0 * pi;
+  char *make_error_name __attribute__((unused)) = "make_error name";
+  char c __attribute__((unused));
+  double pi2 __attribute__((unused)) = 2.0 * pi;
   whoami(s);
   if (int_und == 0)
      printf ("%s int_und is zero %d\n", s, int_und);
@@ -46,7 +46,7 @@ static void make_error (char *s)
 
 static void level ()
 {
-  char *level_name = "level name";
+  char *level_name __attribute__((unused)) = "level name";
   make_error ("called from level");
 }
 
@@ -55,12 +55,12 @@ static void loops (int *loopnr)
   int i, j;
   for (i = 0; i < LOOPS; i++)
     for (j = 0; i < LOOPS; i++)
-      *loopnr++;
+      (*loopnr)++;
 }
  
 static void *brussels_fn(void *v)
 {
-  char *brussels_name = "Brussels";
+  char *brussels_name __attribute__((unused)) = "Brussels";
   make_error ("called from Brussels");
   loopt1 = 1;
   while (! (loopt1 && loopt2 && loopmain))
@@ -70,7 +70,7 @@ static void *brussels_fn(void *v)
 }
 static void *london_fn(void *v)
 {
-  char *london_name = "London";
+  char *london_name __attribute__((unused)) = "London";
   make_error ("called from London");
   loopt2 = 1;
   while (! (loopt1 && loopt2 && loopmain))
@@ -81,7 +81,7 @@ static void *london_fn(void *v)
 }
 static void *petaouchnok_fn(void *v)
 {
-  char *petaouchnok_name = "Petaouchnok";
+  char *petaouchnok_name __attribute__((unused)) = "Petaouchnok";
   struct timeval t;
   int i;
   for (i = 1; i <= sleeps; i++) {
@@ -102,11 +102,11 @@ static void breakme(int line)
 }
 int main (int argc, char *argv[])
 {
-  char *main_name = "main name";
+  char *main_name __attribute__((unused)) = "main name";
   pthread_t ebbr, egll, zzzz;
   int i = 1234;
   char undef = '?';
-  char *some_mem = malloc(100);
+  char *some_mem __attribute__((unused)) = malloc(100);
   VALGRIND_MAKE_MEM_UNDEFINED(&undef, 1);
   int len = strlen(undefined);
   breakme(__LINE__); //break1