diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-02-06 20:40:18 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-02-06 20:40:18 +0000 |
commit | af8579421c955f1d7a2c5e0fcc9c2cfd2d250c16 (patch) | |
tree | 9c61da9c4a64edc8cbc210d2755ecb06d031534b /gcc/testsuite | |
parent | 0e62d8da8abc63fed2972043163030fd5b27df22 (diff) | |
download | gcc-af8579421c955f1d7a2c5e0fcc9c2cfd2d250c16.tar.gz |
* c-decl.c (finish_function): Warn about a non-void function with
no return statement and no abnormal exit.
(current_function_returns_abnormally): New variable.
(start_function): Clear it.
(struct c_language_function): Add returns_abnormally.
(push_c_function_context): Save it.
(pop_c_function_context): Restore it.
(builtin_function): Set TREE_THIS_VOLATILE on return fns.
(grokdeclarator): Set C_FUNCTION_IMPLICIT_INT on functions without
an explicit return type.
* c-tree.h: Declare current_function_returns_abnormally.
(C_FUNCTION_IMPLICIT_INT): New macro.
* c-typeck.c (build_function_call): Set it.
(c_expand_return): Set current_function_returns_value even if the
value is erroneous.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49551 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/gcc.dg/20011029-2.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/980816-1.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/990117-1.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/990213-2.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/990214-1.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/990524-1.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/991214-1.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/asm-2.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/asm-3.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/attr-invalid.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/attr-noinline.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/deprecated.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/struct-ret-2.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.misc-tests/bprob-1.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.misc-tests/gcov-4.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.misc-tests/gcov-4b.c | 2 |
16 files changed, 24 insertions, 16 deletions
diff --git a/gcc/testsuite/gcc.dg/20011029-2.c b/gcc/testsuite/gcc.dg/20011029-2.c index 77a5b0776cd..b184af088d1 100644 --- a/gcc/testsuite/gcc.dg/20011029-2.c +++ b/gcc/testsuite/gcc.dg/20011029-2.c @@ -20,4 +20,5 @@ int foo (int s) : "cc"); r; })) continue; } + return 0; } diff --git a/gcc/testsuite/gcc.dg/980816-1.c b/gcc/testsuite/gcc.dg/980816-1.c index 2a96ef4bcc9..8581d999dbd 100644 --- a/gcc/testsuite/gcc.dg/980816-1.c +++ b/gcc/testsuite/gcc.dg/980816-1.c @@ -17,4 +17,5 @@ div_and_round_double (lden_orig, hden_orig) quo[i] = work / (unsigned int ) lden; carry = work % (unsigned int ) lden; } + return 0; } diff --git a/gcc/testsuite/gcc.dg/990117-1.c b/gcc/testsuite/gcc.dg/990117-1.c index 2e7ea5a1551..606ba440ca8 100644 --- a/gcc/testsuite/gcc.dg/990117-1.c +++ b/gcc/testsuite/gcc.dg/990117-1.c @@ -18,4 +18,5 @@ foo () for (i = 0; i < 10; i++) ; fabs (x - y); + return 0; } diff --git a/gcc/testsuite/gcc.dg/990213-2.c b/gcc/testsuite/gcc.dg/990213-2.c index 6e6b924ed89..a0a13b560f9 100644 --- a/gcc/testsuite/gcc.dg/990213-2.c +++ b/gcc/testsuite/gcc.dg/990213-2.c @@ -12,4 +12,5 @@ XmlInitUnknownEncoding(void *mem) struct unknown_encoding *e = mem; for (i = 0; i < sizeof(struct normal_encoding); i++) ((char *)mem)[i] = ((char *)&latin1_encoding)[i]; + return 0; } diff --git a/gcc/testsuite/gcc.dg/990214-1.c b/gcc/testsuite/gcc.dg/990214-1.c index 492c6a7dcea..7ad81b6b90b 100644 --- a/gcc/testsuite/gcc.dg/990214-1.c +++ b/gcc/testsuite/gcc.dg/990214-1.c @@ -12,4 +12,6 @@ bar (int64_t which) case 5 : case 2 : ; } + + return 0; } diff --git a/gcc/testsuite/gcc.dg/990524-1.c b/gcc/testsuite/gcc.dg/990524-1.c index b87b5883a11..8b101724503 100644 --- a/gcc/testsuite/gcc.dg/990524-1.c +++ b/gcc/testsuite/gcc.dg/990524-1.c @@ -34,5 +34,5 @@ p_frames_to_multilayer(t_anim_info *ainfo_ptr, break; l_cur_frame_nr += l_step; } + return 0; } - diff --git a/gcc/testsuite/gcc.dg/991214-1.c b/gcc/testsuite/gcc.dg/991214-1.c index 5b9f56c277e..c8e3a04049d 100644 --- a/gcc/testsuite/gcc.dg/991214-1.c +++ b/gcc/testsuite/gcc.dg/991214-1.c @@ -3,8 +3,8 @@ /* Test against a problem with the combiner substituting explicit hard reg references when it shouldn't. */ -int foo (int, int) __attribute__ ((regparm (3))); -int foo (int x, int y) +void foo (int, int) __attribute__ ((regparm (3))); +void foo (int x, int y) { __asm__ __volatile__("" : : "d" (x), "r" (y)); } diff --git a/gcc/testsuite/gcc.dg/asm-2.c b/gcc/testsuite/gcc.dg/asm-2.c index 5adee41b9c6..9c464ce8941 100644 --- a/gcc/testsuite/gcc.dg/asm-2.c +++ b/gcc/testsuite/gcc.dg/asm-2.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "" } */ -int f() +void f() { asm volatile ("foo%%bar" : : ); } diff --git a/gcc/testsuite/gcc.dg/asm-3.c b/gcc/testsuite/gcc.dg/asm-3.c index e7db804c18a..917942d7b69 100644 --- a/gcc/testsuite/gcc.dg/asm-3.c +++ b/gcc/testsuite/gcc.dg/asm-3.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "" } */ -int f() +void f() { asm ("foo%%bar"); } diff --git a/gcc/testsuite/gcc.dg/attr-invalid.c b/gcc/testsuite/gcc.dg/attr-invalid.c index 768921d8b18..a999c267c3a 100644 --- a/gcc/testsuite/gcc.dg/attr-invalid.c +++ b/gcc/testsuite/gcc.dg/attr-invalid.c @@ -21,13 +21,14 @@ int ATSYM(var) ATTR; /* { dg-warning "attribute ignored" "" } */ int ATSYM(fn_knrarg) (arg) int arg ATTR; /* { dg-warning "attribute ignored" "" } */ -{} +{ return 0; } -int ATSYM(fn_isoarg) (int arg ATTR) {} /* { dg-warning "attribute ignored" "" } */ +int ATSYM(fn_isoarg) (int arg ATTR) { return 0; } /* { dg-warning "attribute ignored" "" } */ int ATSYM(fn_vars) (void) { static int svar ATTR; /* { dg-warning "attribute ignored" "" } */ auto int lvar ATTR; /* { dg-warning "attribute ignored" "" } */ + return 0; } @@ -46,11 +47,12 @@ int ATSYM(var) ATTR; /* { dg-warning "attribute ignored" "" } */ int ATSYM(fn_knrarg) (arg) int arg ATTR; /* { dg-warning "attribute ignored" "" } */ -{} +{ return 0; } -int ATSYM(fn_isoarg) (int arg ATTR) {} /* { dg-warning "attribute ignored" "" } */ +int ATSYM(fn_isoarg) (int arg ATTR) { return 0; } /* { dg-warning "attribute ignored" "" } */ int ATSYM(fn_vars) (void) { static int svar ATTR; /* { dg-warning "attribute ignored" "" } */ auto int lvar ATTR; /* { dg-warning "attribute ignored" "" } */ + return 0; } diff --git a/gcc/testsuite/gcc.dg/attr-noinline.c b/gcc/testsuite/gcc.dg/attr-noinline.c index 903959e09f1..ee48eb9ed7e 100644 --- a/gcc/testsuite/gcc.dg/attr-noinline.c +++ b/gcc/testsuite/gcc.dg/attr-noinline.c @@ -43,7 +43,7 @@ static inline void function_declaration_noinline_inline_before(void); /* { dg-wa static void function_declaration_noinline_inline_before(void) {} -int f () { +void f () { function_definition (); function_declaration_both_before (); function_declaration_both_after (); diff --git a/gcc/testsuite/gcc.dg/deprecated.c b/gcc/testsuite/gcc.dg/deprecated.c index bc82c6d6200..83557475c44 100644 --- a/gcc/testsuite/gcc.dg/deprecated.c +++ b/gcc/testsuite/gcc.dg/deprecated.c @@ -13,10 +13,10 @@ INT1 should_be_unavailable; /* { dg-warning "`INT1' is deprecated" "" } */ INT1a should_not_be_deprecated; INT1 f1(void) __attribute__ ((deprecated)); -INT1 f2(void) {} /* { dg-warning "`INT1' is deprecated" "" } */ +INT1 f2(void) { return 0; } /* { dg-warning "`INT1' is deprecated" "" } */ INT2 f3(void) __attribute__ ((__deprecated__)); -INT2 f4(void) {} /* { dg-warning "`INT2' is deprecated" "" } */ +INT2 f4(void) { return 0; } /* { dg-warning "`INT2' is deprecated" "" } */ int f5(INT2 x); /* { dg-warning "`INT2' is deprecated" "" } */ int f6(INT2 x) __attribute__ ((__deprecated__)); /* { dg-warning "`INT2' is deprecated" "" } */ diff --git a/gcc/testsuite/gcc.dg/struct-ret-2.c b/gcc/testsuite/gcc.dg/struct-ret-2.c index b440bcfb914..0d9b86f6fe5 100644 --- a/gcc/testsuite/gcc.dg/struct-ret-2.c +++ b/gcc/testsuite/gcc.dg/struct-ret-2.c @@ -4,7 +4,7 @@ Copyright (C) 1999 Free Software Foundation */ /* { dg-do compile } */ -/* { dg-options "-O3" } */ +/* { dg-options "-O3 -w" } */ struct { unsigned i[4]; diff --git a/gcc/testsuite/gcc.misc-tests/bprob-1.c b/gcc/testsuite/gcc.misc-tests/bprob-1.c index 3d6055a2f9f..94202504fb5 100644 --- a/gcc/testsuite/gcc.misc-tests/bprob-1.c +++ b/gcc/testsuite/gcc.misc-tests/bprob-1.c @@ -68,7 +68,7 @@ test_for2 (int m, int n, int o) return for_temp; /* count(6) */ } -int +void call_for () { for_val1 += test_for1 (0); diff --git a/gcc/testsuite/gcc.misc-tests/gcov-4.c b/gcc/testsuite/gcc.misc-tests/gcov-4.c index d5986fe4b8b..27ef508cfe6 100644 --- a/gcc/testsuite/gcc.misc-tests/gcov-4.c +++ b/gcc/testsuite/gcc.misc-tests/gcov-4.c @@ -68,7 +68,7 @@ test_for2 (int m, int n, int o) return for_temp; /* count(6) */ } -int +void call_for () { for_val1 += test_for1 (0); diff --git a/gcc/testsuite/gcc.misc-tests/gcov-4b.c b/gcc/testsuite/gcc.misc-tests/gcov-4b.c index 6bc20e0005a..72870b20952 100644 --- a/gcc/testsuite/gcc.misc-tests/gcov-4b.c +++ b/gcc/testsuite/gcc.misc-tests/gcov-4b.c @@ -41,7 +41,7 @@ test_for2 (int m, int n, int o) return for_temp; } -int +void call_for () { for_val1 += test_for1 (0); |