GDB testsuite: Fix warnings with -std=gnu11
authorAndreas Arnez <arnez@linux.vnet.ibm.com>
Tue, 28 Oct 2014 12:39:22 +0000 (12:39 +0000)
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>
Thu, 13 Nov 2014 09:20:44 +0000 (10:20 +0100)
Since upstream GCC has changed the default C language dialect to
'gnu11', it yields multiple warnings in the GDB testsuite for missing
function return types and implicit function declarations.  This patch
attempts to fix these.

gdb/testsuite/ChangeLog:

* gdb.ada/cond_lang/foo.c (callme): Add return type.
* gdb.base/call-sc.c (zed): Likewise.
* gdb.base/checkpoint.c (main): Likewise.
* gdb.base/dump.c (main): Likewise.
* gdb.base/gcore.c (main): Likewise.
* gdb.base/huge.c (main): Likewise.
* gdb.base/multi-forks.c (main): Likewise.
* gdb.base/pr10179-a.c (main): Likewise.
* gdb.base/savedregs.c (main): Likewise.
* gdb.base/sigaltstack.c (main): Likewise.
* gdb.base/siginfo.c (main): Likewise.
* gdb.base/structs.c (zed): Likewise.
* gdb.mi/mi-stack.c (callee3, callee2, callee1, main): Likewise.
* gdb.mi/mi-syn-frame.c (main): Likewise.
* gdb.mi/until.c (foo, main): Likewise.
* gdb.base/global-var-nested-by-dso.c (b_main, c_main): Declare.
* gdb.base/solib-weak.c (foo): Declare.
* gdb.base/attach-twice.c: Include stdio.h.
* gdb.base/weaklib1.c: Likewise.
* gdb.base/weaklib2.c: Likewise.
* gdb.base/catch-signal-fork.c: Include stdio.h and sys/wait.h.
* gdb.mi/mi-condbreak-call-thr-state-mt.c: Include stdio.h and
unistd.h.
* gdb.base/attach-pie-misread.c: Include stdlib.h.
* gdb.mi/mi-exit-code.c: Likewise.
* gdb.base/break-interp-lib.c: Include string.h.
* gdb.base/coremaker.c: Likewise.
* gdb.base/testenv.c: Likewise.
* gdb.python/py-finish-breakpoint.c: Likewise.
* gdb.base/inferior-died.c: Include sys/wait.h.
* gdb.base/fileio.c: Include time.h.
* gdb.base/async-shell.c: Include unistd.h.
* gdb.base/dprintf-non-stop.c: Likewise.
* gdb.base/info-os.c: Likewise.
* gdb.mi/mi-console.c: Likewise.
* gdb.mi/watch-nonstop.c: Likewise.
* gdb.python/py-events.c: Likewise.
* gdb.base/async.c (baz): Move up before its invocation.
* gdb.base/code_elim2.c (my_global_func): Likewise.
* gdb.base/skip-solib-lib.c (multiply): Likewise.
* gdb.base/advance.c (func2): Likewise.

41 files changed:
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/cond_lang/foo.c
gdb/testsuite/gdb.base/advance.c
gdb/testsuite/gdb.base/async-shell.c
gdb/testsuite/gdb.base/async.c
gdb/testsuite/gdb.base/attach-pie-misread.c
gdb/testsuite/gdb.base/attach-twice.c
gdb/testsuite/gdb.base/break-interp-lib.c
gdb/testsuite/gdb.base/call-sc.c
gdb/testsuite/gdb.base/catch-signal-fork.c
gdb/testsuite/gdb.base/checkpoint.c
gdb/testsuite/gdb.base/code_elim2.c
gdb/testsuite/gdb.base/coremaker.c
gdb/testsuite/gdb.base/dprintf-non-stop.c
gdb/testsuite/gdb.base/dump.c
gdb/testsuite/gdb.base/fileio.c
gdb/testsuite/gdb.base/gcore.c
gdb/testsuite/gdb.base/global-var-nested-by-dso.c
gdb/testsuite/gdb.base/huge.c
gdb/testsuite/gdb.base/inferior-died.c
gdb/testsuite/gdb.base/info-os.c
gdb/testsuite/gdb.base/multi-forks.c
gdb/testsuite/gdb.base/pr10179-a.c
gdb/testsuite/gdb.base/savedregs.c
gdb/testsuite/gdb.base/sigaltstack.c
gdb/testsuite/gdb.base/siginfo.c
gdb/testsuite/gdb.base/skip-solib-lib.c
gdb/testsuite/gdb.base/solib-weak.c
gdb/testsuite/gdb.base/structs.c
gdb/testsuite/gdb.base/testenv.c
gdb/testsuite/gdb.base/weaklib1.c
gdb/testsuite/gdb.base/weaklib2.c
gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state-mt.c
gdb/testsuite/gdb.mi/mi-console.c
gdb/testsuite/gdb.mi/mi-exit-code.c
gdb/testsuite/gdb.mi/mi-stack.c
gdb/testsuite/gdb.mi/mi-syn-frame.c
gdb/testsuite/gdb.mi/until.c
gdb/testsuite/gdb.mi/watch-nonstop.c
gdb/testsuite/gdb.python/py-events.c
gdb/testsuite/gdb.python/py-finish-breakpoint.c

index a3ee49338674bb315d2e132b3ce90a8f92624974..405548e3944bd54c779ca81ea6a284c6209e03a6 100644 (file)
@@ -1,3 +1,47 @@
+2014-11-13  Andreas Arnez  <arnez@linux.vnet.ibm.com>
+
+       * gdb.ada/cond_lang/foo.c (callme): Add return type.
+       * gdb.base/call-sc.c (zed): Likewise.
+       * gdb.base/checkpoint.c (main): Likewise.
+       * gdb.base/dump.c (main): Likewise.
+       * gdb.base/gcore.c (main): Likewise.
+       * gdb.base/huge.c (main): Likewise.
+       * gdb.base/multi-forks.c (main): Likewise.
+       * gdb.base/pr10179-a.c (main): Likewise.
+       * gdb.base/savedregs.c (main): Likewise.
+       * gdb.base/sigaltstack.c (main): Likewise.
+       * gdb.base/siginfo.c (main): Likewise.
+       * gdb.base/structs.c (zed): Likewise.
+       * gdb.mi/mi-stack.c (callee3, callee2, callee1, main): Likewise.
+       * gdb.mi/mi-syn-frame.c (main): Likewise.
+       * gdb.mi/until.c (foo, main): Likewise.
+       * gdb.base/global-var-nested-by-dso.c (b_main, c_main): Declare.
+       * gdb.base/solib-weak.c (foo): Declare.
+       * gdb.base/attach-twice.c: Include stdio.h.
+       * gdb.base/weaklib1.c: Likewise.
+       * gdb.base/weaklib2.c: Likewise.
+       * gdb.base/catch-signal-fork.c: Include stdio.h and sys/wait.h.
+       * gdb.mi/mi-condbreak-call-thr-state-mt.c: Include stdio.h and
+       unistd.h.
+       * gdb.base/attach-pie-misread.c: Include stdlib.h.
+       * gdb.mi/mi-exit-code.c: Likewise.
+       * gdb.base/break-interp-lib.c: Include string.h.
+       * gdb.base/coremaker.c: Likewise.
+       * gdb.base/testenv.c: Likewise.
+       * gdb.python/py-finish-breakpoint.c: Likewise.
+       * gdb.base/inferior-died.c: Include sys/wait.h.
+       * gdb.base/fileio.c: Include time.h.
+       * gdb.base/async-shell.c: Include unistd.h.
+       * gdb.base/dprintf-non-stop.c: Likewise.
+       * gdb.base/info-os.c: Likewise.
+       * gdb.mi/mi-console.c: Likewise.
+       * gdb.mi/watch-nonstop.c: Likewise.
+       * gdb.python/py-events.c: Likewise.
+       * gdb.base/async.c (baz): Move up before its invocation.
+       * gdb.base/code_elim2.c (my_global_func): Likewise.
+       * gdb.base/skip-solib-lib.c (multiply): Likewise.
+       * gdb.base/advance.c (func2): Likewise.
+
 2014-11-13  Andreas Arnez  <arnez@linux.vnet.ibm.com>
 
        * gdb.base/annota1.c: Remove #ifdef PROTOTYPES, keep prototyped
index 3861da77ab6df809a76ad5ea2211622dc7530b89..d701f62c320b3fa1082be6246b2bd2f636e9b50e 100644 (file)
@@ -15,7 +15,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-extern callme (void);
+extern void callme (void);
 
 void
 c_function (void)
index 8066deec421d0a1253eba604b1c7d7c1d9d1575b..ab86b0e56962853bdbc9012e8f6c7a445f72ddf7 100644 (file)
@@ -13,15 +13,15 @@ int bar (int y)
   return z;
 }
 
-void func()
+int func2 ()
 {
-  x = x + 5;
-  func2 ();
+  x = 6;
 }
 
-int func2 ()
+void func()
 {
-  x = 6;
+  x = x + 5;
+  func2 ();
 }
 
 int func3 ()
index 3629d770fecf9642adb51753b13b2a520787a96f..1b63be12e7d7e5bd17233c62d1d7bbd1cd72f954 100644 (file)
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include <unistd.h>
+
 int
 main (void)
 {
index 32779d97b934423dd48091157121abebad0f1546..9148b1913d37880ab3e370cc479e9681a6c6034d 100644 (file)
@@ -12,6 +12,12 @@ foo (void)
  return x + y;
 }
 
+int
+baz (void)
+{
+  return 5;
+}
+
 int
 main (void)
 {
@@ -25,10 +31,3 @@ main (void)
  y = baz ();
  return 0; /* until here */
 }
-
-
-int
-baz (void)
-{ 
-  return 5;
-}
index 7de2ad380ead956eeaf29cc5d8687fcef02261d6..08789d0011ca88e0ac14fe02fb4295c6e5fbd9c3 100644 (file)
@@ -16,6 +16,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 
 const char stub[] = {
index 74ee33268d44669b2a53dcbcb8764a13e97c11b4..efe14f060253b47feb6ffa2b81d8a419fcd63f13 100644 (file)
@@ -15,6 +15,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/ptrace.h>
index 314dc6659c3f7b71bb644816e0978f4d7c3ad580..0df293433842f9b196f9d288e8a11d8daa858668 100644 (file)
@@ -19,6 +19,7 @@
 #include <unistd.h>
 #include <assert.h>
 #include <stdio.h>
+#include <string.h>
 
 /* Force REL->RELA conversion on i386, see "Prelink", March 4, 2004.  */
 volatile int v[2];
index 56c18da38440128a98d915296207c5c2ef824f07..98c0229c85f4a2b21d2bdb87d101f6c74805a2f3 100644 (file)
@@ -46,7 +46,7 @@ void Fun(T foo)
   L = foo;
 }
 
-zed ()
+void zed ()
 {
   L = 'Z';
 }
index 87fe417ca626b5f8fece3007d321795b5e8e5e93..5ae83d641b7e11b07949fd3a29e4745a89181d7d 100644 (file)
 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+#include <stdio.h>
 #include <stdlib.h>
 #include <signal.h>
+#include <sys/wait.h>
 #include <unistd.h>
 
 void
index b6f7ecd9fa68337c619fdd8d01ecc6a6d140e557..8f9d6da526a952666a8720ee4989d37a045d15b2 100644 (file)
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <unistd.h>
 
 long lines = 0;
 
-main()
+int main()
 {
   char linebuf[128];
   FILE *in, *out;
@@ -34,7 +35,7 @@ main()
   if (!in || !out)
     {
       fprintf (stderr, "File open failed\n");
-      exit (1);
+      return 1;
     }
 
   for (i = 0; ; i++)
@@ -55,5 +56,5 @@ main()
   fclose (out);
   printf ("Deleting copy.\n"); /* breakpoint 3 */
   unlink (COPY1_TXT);
-  exit (0);                    /* breakpoint 4 */
+  return 0;                    /* breakpoint 4 */
 }
index 64ecc04df60bb7a299ee511c097e0c826219340f..875228ae338dfce4529953db058150af43d8caf0 100644 (file)
@@ -19,12 +19,6 @@ int my_global_symbol = 42;
 
 static int my_static_symbol;
 
-int
-main ()
-{
-  return my_global_func ();
-}
-
 int
 my_global_func ()
 {
@@ -32,3 +26,9 @@ my_global_func ()
   my_global_symbol = my_static_symbol + my_global_symbol;
   return my_global_symbol;
 }
+
+int
+main ()
+{
+  return my_global_func ();
+}
index f05a111921f29407bd45fa8468ddd4700575912d..22c14427adc7e1fec1c757d28f3025c32b964559 100644 (file)
@@ -25,6 +25,7 @@
 #include <signal.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <string.h>
 
 #ifndef __STDC__
 #define        const   /**/
index 23c55fac1292f833e3c76050675d8532a23a4fab..c7eeca9ac2feb43e5c7f610d6c5e303bef7dce2a 100644 (file)
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include <unistd.h>
+
 void
 foo ()
 {
index bc68778ee7aba457391b5e69f1152202355ce6ab..bdcafbffe0e8b3ed7c93c07c210b1eeee0cde32a 100644 (file)
@@ -27,6 +27,7 @@ zero_all ()
   memset ((char *) &intstruct2, 0, sizeof (intstruct2));
 }
 
+int
 main()
 {
   int i;
@@ -43,4 +44,5 @@ main()
   intstruct.g = 12 * 7;
 
   checkpoint1 ();
+  return 0;
 }
index 29c32e00439d43d3864db9245e4c26992b94ad70..e44317344a2bffa82b5fbf3e5d969a72f3a55824 100644 (file)
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <sys/wait.h>
 #include <unistd.h>
+#include <time.h>
 /* TESTS :
  * - open(const char *pathname, int flags, mode_t mode);
 1) Attempt to create file that already exists - EEXIST
index ee826a5048ae003b062b2d79ebb7ea3c008cd173..f74516d3b23129b5b3777e85227b786548b7e18f 100644 (file)
@@ -58,6 +58,7 @@ int factorial_func (int value)
   return (value);
 }
 
+int
 main()
 {
   factorial_func (6);
index 3b6309694ea29060ddf74c9f234d087ae29af31f..a77b8c29a006391afe33a001f7c71b42042ed94d 100644 (file)
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+extern void b_main (void);
+extern void c_main (void);
+
 int
 main (int argc, char *argv[])
 {
index 27ba04eb2cae0317011f5f91b1856d84fd672eef..57727e9f9f8e0521543341f4d08d6142a9ca231b 100644 (file)
@@ -12,6 +12,7 @@
 #endif
 static int a[CRASH_GDB], b[CRASH_GDB];
 
+int
 main()
 {
   memcpy (a, b, sizeof (a));
index 5c4c5b242d4c00d3222bbb101431f538d2ebfa25..bb635c0034926434905ec4ddb93289dc0e794aed 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <stdlib.h>
 #include <sys/types.h>
+#include <sys/wait.h>
 #include <unistd.h>
 
 void function(void)
index 1a523480e605bad2b9a0cc37d8181536ca7c43b1..23257d4ba67711aa557ef7b2321148df385cc5f2 100644 (file)
@@ -22,6 +22,7 @@
 #include <pthread.h>
 #include <arpa/inet.h>
 #include <sys/socket.h>
+#include <unistd.h>
 
 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
 
index c090c57b4c074f53d4c1dcbef0c766462dde81be..bbe06c3a6a3cdcb6973aaef265556536df054fcd 100644 (file)
@@ -22,6 +22,7 @@
 
 pid_t pids[4];
 
+int
 main()
 {
   int i;
@@ -32,5 +33,5 @@ main()
   printf ("%d ready\n", getpid ());
   sleep (2);
   printf ("%d done\n", getpid ());
-  exit (0);    /* Set exit breakpoint here.  */
+  return 0;    /* Set exit breakpoint here.  */
 }
index de5dcdeb031c63f19a7af5806ee9ab6deb83c37a..56bce9df92ed4a05b17c677758154f5991bf50b5 100644 (file)
@@ -12,6 +12,7 @@ bar1()
 {
 }
 
+int
 main()
 {
 }
index b88678729af68d5ca8806699d4e3437bdf047e04..7b93b9ba01832fec76e4382017ac783833563daf 100644 (file)
@@ -61,9 +61,11 @@ thrower (void)
 
 }
 
+int
 main ()
 {
   signal (SIGILL, catcher);
   signal (SIGSEGV, catcher);
   thrower ();
+  return 0;
 }
index 338501bdf39c3296064c7596e93a54e6bd6473ee..2ee1b1d23f07b1ca8677b99919d1a101450788f1 100644 (file)
@@ -72,6 +72,7 @@ catcher (int signal)
 }
 
 
+int
 main ()
 {
   /* Set up the altstack.  */
@@ -90,4 +91,5 @@ main ()
   }
   level = MAIN;
   catcher (0);
+  return 0;
 }
index 518083cc1adf1a9e407975debbdeec52cb19c25c..041102febcb5b75030759bce3737406b46714001 100644 (file)
@@ -38,6 +38,7 @@ handler (int sig)
 } /* handler */
 #endif
 
+int
 main ()
 {
   /* Set up the signal handler.  */
index 792cd01b6b6a530d36603ebaad106eef7d625290..b2c4d86d7039a39c434df9e7e923ff982623b087 100644 (file)
@@ -1,11 +1,11 @@
 /* Simple shared library */
 
-int square(int num)
+int multiply(int a, int b)
 {
-  return multiply(num, num);
+  return a * b;
 }
 
-int multiply(int a, int b)
+int square(int num)
 {
-  return a * b;
+  return multiply(num, num);
 }
index f54ea3d71d4da9bdac358c18d6f3f6bca6f99b9f..c1ee8d4fe4852d09be53752e0d7b46d236184e69 100644 (file)
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+extern void foo (void);
+
 int
 main()
 {
index 1fb4250f277d25361e2c2821b5ff8741ef761fa1..1f45239af2fc1b4c309822bc1cbe15e618275754 100644 (file)
@@ -266,6 +266,7 @@ void Fun18(struct struct18 foo18)
   L18 = foo18; 
 }
 
+void
 zed ()
 {
 
index ef8035a7dccb67f8c6eefa719672384f402d3ef9..3eb9dd440695b95d0ff6aa912568bd218ca61453 100644 (file)
@@ -22,6 +22,7 @@
     inferior environment list.  */
 
 #include <stdio.h>
+#include <string.h>
 
 int main (int argc, char **argv, char **envp)
 
index 95360ac20a88cb5a2953150e5e51ce4c7514303b..8782be14c5f764fd700236403511ea6f15aec30f 100644 (file)
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include <stdio.h>
+
 void __attribute__((weak))
 bar (void)
 {
index ecd8321b06e899e8b94a69a254d4fe54a2587146..b6458c04221a155e8142ae06e35ee276cdd04f6b 100644 (file)
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include <stdio.h>
+
 void bar (void);
 void
 foo (void)
index e9ca92d6cf9edc6dd11ef6f9cafaf5c9ed246769..a466c5491722d51c69e6310806d7219525db1ec1 100644 (file)
@@ -19,6 +19,8 @@
 
 #include <stdlib.h>
 #include <pthread.h>
+#include <stdio.h>
+#include <unistd.h>
 
 extern int test (void);
 
index 0cd2243c4f25fbb5af603340d3657b8740a81446..5ca046f52d45a51ae389fa5af03ad139c58ea860 100644 (file)
@@ -1,3 +1,5 @@
+#include <unistd.h>
+
 void
 hello ()
 {
index df711a6a4e511c2e11bf25a07de850b63595ff66..47bf15c60465183eaa27263be9cbeea79f433a70 100644 (file)
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see http://www.gnu.org/licenses/>.  */
 
+#include <stdlib.h>
+
 int exit_code = 0;
 
 int
index 5f2452c17b9f30d1ae24057b09251e935beedf4a..d41f9a08f4efa790a0cfcaf966188dbf13293162 100644 (file)
@@ -32,22 +32,23 @@ int callee4 (void)
   C = A + B;
   return 0;
 }
-callee3 (char *strarg)
+
+void callee3 (char *strarg)
 {
   callee4 ();
 }
 
-callee2 (int intarg, char *strarg)
+void callee2 (int intarg, char *strarg)
 {
   callee3 (strarg);
 }
 
-callee1 (int intarg, char *strarg, double fltarg)
+void callee1 (int intarg, char *strarg, double fltarg)
 {
   callee2 (intarg, strarg);
 }
 
-main ()
+int main ()
 {
   callee1 (2, "A string argument.", 3.5);
   callee1 (2, "A string argument.", 3.5);
index 332f246a78840cfff33bbf36de47db2e8bed9292..c260112b3fd1c7d0003b99f0050e20561d830abc 100644 (file)
@@ -9,12 +9,14 @@ void subroutine (int);
 void handler (int);
 void have_a_very_merry_interrupt (void);
 
+int
 main ()
 {
   foo ();   /* Put a breakpoint on foo() and call it to see a dummy frame */
 
 
   have_a_very_merry_interrupt ();
+  return 0;
 }
 
 void
index df4a68d930ff4ffb54c070e03c783b5c95a986d0..21bdedaf3e62105ca832458b594ce4e9b430df83 100644 (file)
@@ -1,3 +1,4 @@
+void
 foo (void)
 {
  int i, x, y, z;
@@ -17,6 +18,7 @@ foo (void)
  y = 10;
 }
 
+int
 main ()
 {
   int a = 1;
index 3f8a18c05438cc107111bd8cde657b63cd7aebd4..ea4406bb385baeb2ef27fd357d4703e7f9c9089f 100644 (file)
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include <unistd.h>
+
 int global;
 
 int main ()
index 17e9f21adc6d99a922391cebbfbbffdd31493b53..2dabdbdb8fd1e190c21eaf84bd4ea59b0d308f90 100644 (file)
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see  <http://www.gnu.org/licenses/>.  */
 
+#include <unistd.h>
+
 extern void do_nothing (void);
 
 int second(){
index 0eda8b93a5afefcd7693f80b5825034c213073e8..5c8663ab86f9283b0097ad05aa5de2fed363f731 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <setjmp.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 
 /* Defined in py-events-shlib.h.  */
This page took 0.044621 seconds and 4 git commands to generate.