This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix a few testsuite compile warnings causing untested tests


I've applied the testsuite patch below to address these issues,
seen on ubuntu 9.10's gcc 4.4.1 x86_64-linux:

gdb compile failed, ../../../src/gdb/testsuite/gdb.base/shmain.c: In function 'main':
../../../src/gdb/testsuite/gdb.base/shmain.c:49: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'float *'
(...)
gdb compile failed, ../../../src/gdb/testsuite/gdb.base/sizeof.c: In function 'main':
../../../src/gdb/testsuite/gdb.base/sizeof.c:103: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int'
../../../src/gdb/testsuite/gdb.base/sizeof.c:104: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int'
../../../src/gdb/testsuite/gdb.base/sizeof.c:105: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int'
../../../src/gdb/testsuite/gdb.base/sizeof.c:106: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int'
../../../src/gdb/testsuite/gdb.base/sizeof.c:107: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int'
../../../src/gdb/testsuite/gdb.base/sizeof.c:109: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int'
../../../src/gdb/testsuite/gdb.base/sizeof.c:110: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int'
../../../src/gdb/testsuite/gdb.base/sizeof.c:112: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int'
../../../src/gdb/testsuite/gdb.base/sizeof.c:113: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int'
../../../src/gdb/testsuite/gdb.base/sizeof.c:114: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int'
UNTESTED: gdb.base/sizeof.exp: sizeof.exp
(...)
gdb compile failed, ../../../src/gdb/testsuite/gdb.base/unload.c: In function 'main':
../../../src/gdb/testsuite/gdb.base/unload.c:47: warning: format not a string literal and no format arguments
../../../src/gdb/testsuite/gdb.base/unload.c:74: warning: format not a string literal and no format arguments
UNTESTED: gdb.base/unload.exp: Couldn't compile ../../../src/gdb/testsuite/gdb.base/unloadshr.c or ../../../src/gdb/testsuite/gdb.base/unloadshr2.c or ../../../src/gdb/testsuite/gdb.base/unload.c.
(...)
gdb compile failed, ../../../src/gdb/testsuite/gdb.base/watchpoint-solib.c: In function 'open_shlib':
../../../src/gdb/testsuite/gdb.base/watchpoint-solib.c:56: warning: format not a string literal and no format arguments
UNTESTED: gdb.base/watchpoint-solib.exp: Couldn't compile ../../../src/gdb/testsuite/gdb.base/watchpoint-solib-shr.c or ../../../src/gdb/testsuite/gdb.base/watchpoint-solib.c.
testcase ../../../src/gdb/testsuite/gdb.base/watchpoint-solib.exp completed in 0 seconds
(...)

Drops 4 untested tests and adds no failures.

-- 
Pedro Alves

2010-02-17  Pedro Alves  <pedro@codesourcery.com>

	gdb/testsuite/
	* gdb.base/shmain.c (main): Remove printf call.
	* gdb.base/sizeof.c (main): Cast return of sizeof to int.
	* gdb.base/unload.c (main): Make format of fprintf a string
	literal.  Add missing endlines to prints to stderr.
	* gdb.base/watchpoint-solib.c (open_shlib): Ditto.

---
 gdb/testsuite/gdb.base/shmain.c           |    1 -
 gdb/testsuite/gdb.base/sizeof.c           |   20 ++++++++++----------
 gdb/testsuite/gdb.base/unload.c           |   12 ++++++------
 gdb/testsuite/gdb.base/watchpoint-solib.c |    6 +++---
 4 files changed, 19 insertions(+), 20 deletions(-)

Index: src/gdb/testsuite/gdb.base/shmain.c
===================================================================
--- src.orig/gdb/testsuite/gdb.base/shmain.c	2010-02-17 22:27:32.000000000 +0000
+++ src/gdb/testsuite/gdb.base/shmain.c	2010-02-17 22:29:40.000000000 +0000
@@ -46,7 +46,6 @@ int main()
   g = shr2(g);
   g = mainshr1(g);
   sg = 1.1;
-  printf("address of sg is 0x%x\n", &sg);
   y.a = 3;
   y.b = 4;
   g = local_structarg(y);
Index: src/gdb/testsuite/gdb.base/sizeof.c
===================================================================
--- src.orig/gdb/testsuite/gdb.base/sizeof.c	2010-02-17 22:27:32.000000000 +0000
+++ src/gdb/testsuite/gdb.base/sizeof.c	2010-02-17 22:30:52.000000000 +0000
@@ -100,18 +100,18 @@ main ()
 {
   fill_structs ();
 
-  printf ("sizeof (char) == %d\n", sizeof (char));
-  printf ("sizeof (short) == %d\n", sizeof (short));
-  printf ("sizeof (int) == %d\n", sizeof (int));
-  printf ("sizeof (long) == %d\n", sizeof (long));
-  printf ("sizeof (long long) == %d\n", sizeof (long long));
+  printf ("sizeof (char) == %d\n", (int) sizeof (char));
+  printf ("sizeof (short) == %d\n", (int) sizeof (short));
+  printf ("sizeof (int) == %d\n", (int) sizeof (int));
+  printf ("sizeof (long) == %d\n", (int) sizeof (long));
+  printf ("sizeof (long long) == %d\n", (int) sizeof (long long));
 
-  printf ("sizeof (void *) == %d\n", sizeof (void*));
-  printf ("sizeof (void (*)(void)) == %d\n", sizeof (void (*)(void)));
+  printf ("sizeof (void *) == %d\n", (int) sizeof (void*));
+  printf ("sizeof (void (*)(void)) == %d\n", (int) sizeof (void (*)(void)));
 
-  printf ("sizeof (float) == %d\n", sizeof (float));
-  printf ("sizeof (double) == %d\n", sizeof (double));
-  printf ("sizeof (long double) == %d\n", sizeof (long double));
+  printf ("sizeof (float) == %d\n", (int) sizeof (float));
+  printf ("sizeof (double) == %d\n", (int) sizeof (double));
+  printf ("sizeof (long double) == %d\n", (int) sizeof (long double));
 
   /* Signed char?  */
   printf ("valueof ('\\377') == %d\n", '\377');
Index: src/gdb/testsuite/gdb.base/unload.c
===================================================================
--- src.orig/gdb/testsuite/gdb.base/unload.c	2010-02-17 22:27:32.000000000 +0000
+++ src/gdb/testsuite/gdb.base/unload.c	2010-02-17 22:37:50.000000000 +0000
@@ -44,7 +44,7 @@ int main()
   
   if (!handle)
     {
-      fprintf (stderr, dlerror ());
+      fprintf (stderr, "%s\n", dlerror ());
       exit (1);
     }
 
@@ -53,9 +53,9 @@ int main()
   if (!unloadshr)
     {
 #ifdef __WIN32__
-      fprintf (stderr, "error %d occurred", GetLastError ());
+      fprintf (stderr, "error %d occurred\n", GetLastError ());
 #else
-      fprintf (stderr, "%s", dlerror ());
+      fprintf (stderr, "%s\n", dlerror ());
 #endif
       exit (1);
     }
@@ -71,7 +71,7 @@ int main()
   
   if (!handle)
     {
-      fprintf (stderr, dlerror ());
+      fprintf (stderr, "%s\n", dlerror ());
       exit (1);
     }
 
@@ -80,9 +80,9 @@ int main()
   if (!unloadshr)
     {
 #ifdef __WIN32__
-      fprintf (stderr, "error %d occurred", GetLastError ());
+      fprintf (stderr, "error %d occurred\n", GetLastError ());
 #else
-      fprintf (stderr, "%s", dlerror ());
+      fprintf (stderr, "%s\n", dlerror ());
 #endif
       exit (1);
     }
Index: src/gdb/testsuite/gdb.base/watchpoint-solib.c
===================================================================
--- src.orig/gdb/testsuite/gdb.base/watchpoint-solib.c	2010-02-17 22:27:32.000000000 +0000
+++ src/gdb/testsuite/gdb.base/watchpoint-solib.c	2010-02-17 22:34:39.000000000 +0000
@@ -42,9 +42,9 @@ void open_shlib ()
   if (!handle)
     {
 #ifdef __WIN32__
-      fprintf (stderr, "error %d occurred", GetLastError ());
+      fprintf (stderr, "error %d occurred\n", GetLastError ());
 #else
-      fprintf (stderr, "%s", dlerror ());
+      fprintf (stderr, "%s\n", dlerror ());
 #endif
       exit (1);
     }
@@ -53,7 +53,7 @@ void open_shlib ()
 
   if (!foo)
     {
-      fprintf (stderr, dlerror ());
+      fprintf (stderr, "%s\n", dlerror ());
       exit (1);
     }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]