mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-27 12:03:41 +08:00
gdb/testsuite: Explicitly return from main
I've been playing with a board file that forces every testcase to include a header file that does something like: #define main __gdb_testcase_main and then links an actual main() function that does some initialization and then jumps to __gdb_testcase_main. That runs into a number of testcases relying on main not having an explicit return statement, like e.g.,: gdb/build/gdb/testsuite/../../../src/gdb/testsuite/gdb.base/catch-follow-exec.c:27:1: warning: non-void function does not return a value [-Wreturn-type] gdb/build/gdb/testsuite/../../../src/gdb/testsuite/gdb.base/catch-signal.c:47:1: warning: non-void function does not return a value [-Wreturn-type] We don't get those warnings without my board because it is valid to not explicitly return from main. There's an implicit "return 0;". Since it doesn't hurt to be explicit, I've went ahead and added the explicit return statements. Also, a couple testcases either don't explicitly specify main's return type, or return void. Those are tweaked to explicitly return int. gdb/testsuite/ChangeLog: * gdb.base/catch-follow-exec.c (main): Add explicit return statement. * gdb.base/catch-signal.c (main): Likewise. * gdb.base/condbreak-call-false.c (main): Likewise. * gdb.base/consecutive.c (main): Add explicit return statement and return type. * gdb.base/cursal.c (main): Add explicit return statement. * gdb.base/cvexpr.c (main): Likewise. * gdb.base/display.c (main): Add explicit return statement and return type. * gdb.base/dprintf-detach.c (main): Add explicit return statement. * gdb.base/endianity.c (main): Likewise. * gdb.base/execd-prog.c (main): Likewise. * gdb.base/gdb1090.c (main): Likewise. * gdb.base/info_qt.c (main): Likewise. * gdb.base/lineinc.c (main): Likewise. * gdb.base/load-command.c (main): Likewise. * gdb.base/macscp1.c (main): Likewise. * gdb.base/pr10179-a.c (main): Likewise. * gdb.base/quit-live.c (main): Likewise. * gdb.base/scope0.c (main): Likewise. * gdb.base/settings.c (main): Likewise. * gdb.base/stack-checking.c (main): Return int. * gdb.base/varargs.c (main): Add explicit return statement. * gdb.cp/ambiguous.cc (main): Likewise. * gdb.cp/anon-struct.cc (main): Likewise. * gdb.cp/anon-union.cc (main): Likewise. * gdb.cp/bool.cc (main): Likewise. * gdb.cp/bs15503.cc (main): Likewise. * gdb.cp/cplusfuncs.cc (main): Likewise. * gdb.cp/cttiadd.cc (main): Likewise. * gdb.cp/extern-c.cc (main): Likewise. * gdb.cp/filename.cc (main): Likewise. * gdb.cp/formatted-ref.cc (main): Likewise. * gdb.cp/mb-ctor.cc (main): Likewise. * gdb.cp/member-ptr.cc (main): Likewise. * gdb.cp/minsym-fallback-main.cc (main): Likewise. * gdb.cp/overload-const.cc (main): Likewise. * gdb.cp/paren-type.cc (main): Likewise. * gdb.cp/parse-lang.cc (main): Likewise. * gdb.cp/pr-1023.cc (main): Likewise. * gdb.cp/psmang1.cc (main): Likewise. * gdb.cp/readnow-language.cc (main): Likewise. * gdb.cp/ref-params.cc (main): Likewise. * gdb.cp/rvalue-ref-params.cc (main): Likewise. * gdb.cp/virtbase2.cc (main): Likewise. * gdb.dwarf2/dw2-abs-hi-pc.c (main): Likewise. * gdb.dwarf2/dw2-namespaceless-anonymous.c (main): Likewise. * gdb.dwarf2/dw4-toplevel-types.cc (main): Likewise. * gdb.mi/mi-console.c (main): Likewise. * gdb.mi/mi-read-memory.c (main): Likewise. * gdb.modula2/multidim.c (main): Likewise. * gdb.opt/inline-small-func.c (main): Likewise. * gdb.python/py-rbreak.c (main): Likewise. * gdb.stabs/exclfwd1.c (main): Likewise. * gdb.trace/qtro.c (main): Likewise.
This commit is contained in:
parent
af26601c2f
commit
dc3a371e83
@ -1,3 +1,62 @@
|
||||
2020-09-13 Pedro Alves <pedro@palves.net>
|
||||
|
||||
* gdb.base/catch-follow-exec.c (main): Add explicit return
|
||||
statement.
|
||||
* gdb.base/catch-signal.c (main): Likewise.
|
||||
* gdb.base/condbreak-call-false.c (main): Likewise.
|
||||
* gdb.base/consecutive.c (main): Add explicit return
|
||||
statement and return type.
|
||||
* gdb.base/cursal.c (main): Add explicit return statement.
|
||||
* gdb.base/cvexpr.c (main): Likewise.
|
||||
* gdb.base/display.c (main): Add explicit return statement and
|
||||
return type.
|
||||
* gdb.base/dprintf-detach.c (main): Add explicit return statement.
|
||||
* gdb.base/endianity.c (main): Likewise.
|
||||
* gdb.base/execd-prog.c (main): Likewise.
|
||||
* gdb.base/gdb1090.c (main): Likewise.
|
||||
* gdb.base/info_qt.c (main): Likewise.
|
||||
* gdb.base/lineinc.c (main): Likewise.
|
||||
* gdb.base/load-command.c (main): Likewise.
|
||||
* gdb.base/macscp1.c (main): Likewise.
|
||||
* gdb.base/pr10179-a.c (main): Likewise.
|
||||
* gdb.base/quit-live.c (main): Likewise.
|
||||
* gdb.base/scope0.c (main): Likewise.
|
||||
* gdb.base/settings.c (main): Likewise.
|
||||
* gdb.base/stack-checking.c (main): Return int.
|
||||
* gdb.base/varargs.c (main): Add explicit return statement.
|
||||
* gdb.cp/ambiguous.cc (main): Likewise.
|
||||
* gdb.cp/anon-struct.cc (main): Likewise.
|
||||
* gdb.cp/anon-union.cc (main): Likewise.
|
||||
* gdb.cp/bool.cc (main): Likewise.
|
||||
* gdb.cp/bs15503.cc (main): Likewise.
|
||||
* gdb.cp/cplusfuncs.cc (main): Likewise.
|
||||
* gdb.cp/cttiadd.cc (main): Likewise.
|
||||
* gdb.cp/extern-c.cc (main): Likewise.
|
||||
* gdb.cp/filename.cc (main): Likewise.
|
||||
* gdb.cp/formatted-ref.cc (main): Likewise.
|
||||
* gdb.cp/mb-ctor.cc (main): Likewise.
|
||||
* gdb.cp/member-ptr.cc (main): Likewise.
|
||||
* gdb.cp/minsym-fallback-main.cc (main): Likewise.
|
||||
* gdb.cp/overload-const.cc (main): Likewise.
|
||||
* gdb.cp/paren-type.cc (main): Likewise.
|
||||
* gdb.cp/parse-lang.cc (main): Likewise.
|
||||
* gdb.cp/pr-1023.cc (main): Likewise.
|
||||
* gdb.cp/psmang1.cc (main): Likewise.
|
||||
* gdb.cp/readnow-language.cc (main): Likewise.
|
||||
* gdb.cp/ref-params.cc (main): Likewise.
|
||||
* gdb.cp/rvalue-ref-params.cc (main): Likewise.
|
||||
* gdb.cp/virtbase2.cc (main): Likewise.
|
||||
* gdb.dwarf2/dw2-abs-hi-pc.c (main): Likewise.
|
||||
* gdb.dwarf2/dw2-namespaceless-anonymous.c (main): Likewise.
|
||||
* gdb.dwarf2/dw4-toplevel-types.cc (main): Likewise.
|
||||
* gdb.mi/mi-console.c (main): Likewise.
|
||||
* gdb.mi/mi-read-memory.c (main): Likewise.
|
||||
* gdb.modula2/multidim.c (main): Likewise.
|
||||
* gdb.opt/inline-small-func.c (main): Likewise.
|
||||
* gdb.python/py-rbreak.c (main): Likewise.
|
||||
* gdb.stabs/exclfwd1.c (main): Likewise.
|
||||
* gdb.trace/qtro.c (main): Likewise.
|
||||
|
||||
2020-09-13 Pedro Alves <pedro@palves.net>
|
||||
|
||||
* gdb.base/share-env-with-gdbserver.c (main): Call my_getenv
|
||||
|
@ -24,4 +24,6 @@ main (void)
|
||||
{
|
||||
char *exec_args[] = { "/bin/ls", "ppp", NULL };
|
||||
execve (exec_args[0], exec_args, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -44,5 +44,7 @@ main ()
|
||||
raise (SIGHUP); /* fourth HUP */
|
||||
|
||||
raise (SIGINT); /* first INT */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -36,4 +36,6 @@ main (void)
|
||||
{
|
||||
foo ();
|
||||
bar ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -10,7 +10,9 @@ int foo ()
|
||||
return a[0] + a[1] + a[2] + a[3] + a[4] + a[5] + a[6];
|
||||
}
|
||||
|
||||
main()
|
||||
int
|
||||
main ()
|
||||
{
|
||||
foo ();
|
||||
return 0;
|
||||
}
|
||||
|
@ -34,4 +34,6 @@ main ()
|
||||
{
|
||||
int v0 = 0;
|
||||
func1 ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -427,4 +427,6 @@ int main ()
|
||||
|
||||
use (&v_float_func);
|
||||
use (&v_double_func);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -50,8 +50,10 @@ int do_vars()
|
||||
return *p_i;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
do_loops();
|
||||
do_vars();
|
||||
return 0;
|
||||
}
|
||||
|
@ -30,4 +30,6 @@ main (void)
|
||||
|
||||
for (i = 0; i < 30; i++)
|
||||
function ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -46,4 +46,6 @@ main (void)
|
||||
struct otherendian o = {3, 2, 7, 23.5, 1.25 + 7.25i, 75};
|
||||
|
||||
do_nothing (&o); /* START */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -25,4 +25,6 @@ int main (int argc, char **argv)
|
||||
}
|
||||
s = argv[1];
|
||||
printf ("argument received: %s\n", s);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -43,4 +43,6 @@ void foo ()
|
||||
int main ()
|
||||
{
|
||||
foo ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -75,4 +75,6 @@ main (int argc, char **argv, char **envp)
|
||||
(void) info_fun2bis ('b');
|
||||
(void) info_fun2xxx ('c', 1, 2);
|
||||
(void) info_fun2yyy ('d', 3, 4);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -27,4 +27,5 @@
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -19,4 +19,5 @@ int the_variable = 0x1234;
|
||||
|
||||
int main ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -111,4 +111,6 @@ main (int argc, char **argv)
|
||||
macscp3_2 ();
|
||||
macscp1_3 ();
|
||||
macscp_expr ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -17,4 +17,5 @@ bar1()
|
||||
int
|
||||
main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -24,4 +24,6 @@ main ()
|
||||
|
||||
while (secs--)
|
||||
sleep (1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ int main ()
|
||||
foo ();
|
||||
autovars (5, 6);
|
||||
localscopes (0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* On some systems, such as AIX, unreferenced variables are deleted
|
||||
|
@ -20,4 +20,5 @@ int xxx1= 123;
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -40,10 +40,11 @@ void big_frame ()
|
||||
small_frame ();
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main ()
|
||||
{
|
||||
small_frame ();
|
||||
medium_frame ();
|
||||
big_frame ();
|
||||
return 0;
|
||||
}
|
||||
|
@ -79,6 +79,8 @@ main (void)
|
||||
{
|
||||
gdb_unbuffer_output ();
|
||||
test ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Integer varargs, 1 declared arg */
|
||||
|
@ -103,8 +103,6 @@ int main()
|
||||
i += k.i + m.w + a1.x + a2.x + a3.x + x.z + l.z + n.r + j.j;
|
||||
|
||||
marker1();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -54,4 +54,5 @@ t3 v3;
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -53,4 +53,6 @@ int main()
|
||||
w = 45;
|
||||
|
||||
int j = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -34,4 +34,6 @@ main ()
|
||||
{
|
||||
return_true ();
|
||||
return_false ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -59,6 +59,8 @@ void StringTest <T>::testFunction() {
|
||||
int main() {
|
||||
StringTest<wchar_t> ts;
|
||||
ts.runTest();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* output:
|
||||
|
@ -60,6 +60,8 @@ public:
|
||||
|
||||
int main () {
|
||||
int z=3;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
foo::foo (int i) { ifoo = i;}
|
||||
|
@ -44,4 +44,6 @@ int main()
|
||||
add1();
|
||||
subr2();
|
||||
subr3();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -35,4 +35,6 @@ int main()
|
||||
c_func ();
|
||||
c_funcs_1 ();
|
||||
c_funcs_2 ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -52,5 +52,5 @@ int main() {
|
||||
D* pd = &d;
|
||||
d.m();
|
||||
|
||||
/* stop outside */
|
||||
return 0; /* stop outside */
|
||||
}
|
||||
|
@ -40,4 +40,5 @@ int main(void)
|
||||
|
||||
f1 (s1, e1, i1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -63,4 +63,6 @@ int main()
|
||||
Derived. Base is constructed separately by
|
||||
DeeplyDerived's ctor. */
|
||||
DeeplyDerived dd(15);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -230,4 +230,5 @@ int main ()
|
||||
|
||||
k += b.s;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -24,4 +24,6 @@ main ()
|
||||
{
|
||||
c.f ();
|
||||
c ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -25,4 +25,6 @@ int
|
||||
main ()
|
||||
{
|
||||
myclass::func (42);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -30,4 +30,6 @@ int
|
||||
main ()
|
||||
{
|
||||
C::f(1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -37,4 +37,6 @@ main ()
|
||||
|
||||
c.m ();
|
||||
marker ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -16,5 +16,6 @@ int main ()
|
||||
myClass mc;
|
||||
mc.performBlocking (0);
|
||||
mc.performUnblocking (0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -37,6 +37,8 @@ main (int argc, char **argv)
|
||||
|
||||
si.method1 ();
|
||||
si.method2 ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,4 +18,5 @@
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -69,4 +69,6 @@ int main(void)
|
||||
MultiChild& MQR = MQ;
|
||||
|
||||
mf2(MQ); /* Set breakpoint MQ here. */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -80,4 +80,6 @@ main ()
|
||||
MultiChild &MQR = MQ;
|
||||
|
||||
mf2 (std::move (MQ)); /* Set breakpoint MQ here. */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -46,4 +46,6 @@ int main()
|
||||
{
|
||||
derived().func_d();
|
||||
foo().func_f();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -25,4 +25,6 @@ main (void)
|
||||
{
|
||||
hello ();
|
||||
world ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -19,4 +19,5 @@ char _ZN12_GLOBAL__N_11vE = 1;
|
||||
|
||||
int main ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -18,4 +18,4 @@
|
||||
struct X {} x;
|
||||
struct Y {} y;
|
||||
struct Z {} z;
|
||||
int main() {}
|
||||
int main() { return 0; }
|
||||
|
@ -13,4 +13,6 @@ int
|
||||
main ()
|
||||
{
|
||||
hello ();
|
||||
} /* after-hello */
|
||||
|
||||
return 0; /* after-hello */
|
||||
}
|
||||
|
@ -17,4 +17,5 @@ int
|
||||
main ()
|
||||
{
|
||||
initialize ();
|
||||
return 0;
|
||||
}
|
||||
|
@ -36,4 +36,6 @@ main ()
|
||||
count += 1;
|
||||
}
|
||||
here ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -19,4 +19,5 @@ int
|
||||
main ()
|
||||
{ /* caller: before call. */
|
||||
callee (); /* caller: the call. */
|
||||
} /* caller: after call. */
|
||||
return 0; /* caller: after call. */
|
||||
}
|
||||
|
@ -67,4 +67,6 @@ main()
|
||||
func5 ();
|
||||
func6 ();
|
||||
outside_scope ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -30,4 +30,5 @@ a_t v1;
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -30,4 +30,6 @@ main ()
|
||||
{
|
||||
subr (1);
|
||||
end ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user