GDB testsuite: Fix warnings with -std=gnu11

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.
This commit is contained in:
Andreas Arnez 2014-10-28 12:39:22 +00:00 committed by Andreas Krebbel
parent 3b5d599733
commit a59add0c2e
41 changed files with 128 additions and 33 deletions

View 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

View 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)

View File

@ -13,17 +13,17 @@ int bar (int y)
return z;
}
int func2 ()
{
x = 6;
}
void func()
{
x = x + 5;
func2 ();
}
int func2 ()
{
x = 6;
}
int func3 ()
{
x = 4;

View 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)
{

View 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;
}

View 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[] = {

View 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>

View 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];

View File

@ -46,7 +46,7 @@ void Fun(T foo)
L = foo;
}
zed ()
void zed ()
{
L = 'Z';
}

View File

@ -14,8 +14,10 @@
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

View File

@ -17,10 +17,11 @@
#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 */
}

View 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 ();
}

View File

@ -25,6 +25,7 @@
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#ifndef __STDC__
#define const /**/

View 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 ()
{

View 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;
}

View 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

View File

@ -58,6 +58,7 @@ int factorial_func (int value)
return (value);
}
int
main()
{
factorial_func (6);

View 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[])
{

View File

@ -12,6 +12,7 @@
#endif
static int a[CRASH_GDB], b[CRASH_GDB];
int
main()
{
memcpy (a, b, sizeof (a));

View File

@ -17,6 +17,7 @@
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
void function(void)

View 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;

View 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. */
}

View File

@ -12,6 +12,7 @@ bar1()
{
}
int
main()
{
}

View File

@ -61,9 +61,11 @@ thrower (void)
}
int
main ()
{
signal (SIGILL, catcher);
signal (SIGSEGV, catcher);
thrower ();
return 0;
}

View 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;
}

View File

@ -38,6 +38,7 @@ handler (int sig)
} /* handler */
#endif
int
main ()
{
/* Set up the signal handler. */

View File

@ -1,11 +1,11 @@
/* Simple shared library */
int square(int num)
{
return multiply(num, num);
}
int multiply(int a, int b)
{
return a * b;
}
int square(int num)
{
return multiply(num, num);
}

View 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()
{

View File

@ -266,6 +266,7 @@ void Fun18(struct struct18 foo18)
L18 = foo18;
}
void
zed ()
{

View File

@ -22,6 +22,7 @@
inferior environment list. */
#include <stdio.h>
#include <string.h>
int main (int argc, char **argv, char **envp)

View 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)
{

View 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)

View File

@ -19,6 +19,8 @@
#include <stdlib.h>
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
extern int test (void);

View File

@ -1,3 +1,5 @@
#include <unistd.h>
void
hello ()
{

View 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

View 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);

View 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

View 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;

View 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 ()

View 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(){

View File

@ -17,6 +17,7 @@
#include <setjmp.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/* Defined in py-events-shlib.h. */