diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-02-12 17:31:42 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-02-12 17:31:42 +0000 |
commit | 508469fee36069e92dc4b01adf6f0db001a71612 (patch) | |
tree | 1198d5daa5758bb57dfd972c4736717092539847 /gcc | |
parent | a6a4df66b06d5563c22185dd1065dc3b1355827c (diff) | |
download | ppe42-gcc-508469fee36069e92dc4b01adf6f0db001a71612.tar.gz ppe42-gcc-508469fee36069e92dc4b01adf6f0db001a71612.zip |
* c-decl.c (grokdeclarator): In C99 mode, give the more specific
"return type defaults" warning for functions with return type
defaulting to int.
* c-lang.c (c_init): In C99 mode, enable warnings for implicit
function declarations by default rather than only when pedantic.
testsuite:
* gcc.dg/c99-impl-int-1.c: Use stricter error string for implicit
return type.
* gcc.dg/cpp/digraphs.c: Declare puts.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@39608 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/c-decl.c | 3 | ||||
-rw-r--r-- | gcc/c-lang.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/c99-impl-int-1.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/digraphs.c | 1 |
6 files changed, 21 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c36eaf943d0..f72e73d7ef0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2001-02-12 Joseph S. Myers <jsm28@cam.ac.uk> + + * c-decl.c (grokdeclarator): In C99 mode, give the more specific + "return type defaults" warning for functions with return type + defaulting to int. + * c-lang.c (c_init): In C99 mode, enable warnings for implicit + function declarations by default rather than only when pedantic. + Mon Feb 12 17:28:48 CET 2001 Jan Hubicka <jh@suse.cz> * regclass.c (init_reg_sets_1): Optimize calculation of move_cost diff --git a/gcc/c-decl.c b/gcc/c-decl.c index ef5bb38f191..f0d229db69d 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3973,7 +3973,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) /* Issue a warning if this is an ISO C 99 program or if -Wreturn-type and this is a function, or if -Wimplicit; prefer the former warning since it is more explicit. */ - if ((warn_implicit_int || warn_return_type) && funcdef_flag) + if ((warn_implicit_int || warn_return_type || flag_isoc99) + && funcdef_flag) warn_about_return_type = 1; else if (warn_implicit_int || flag_isoc99) pedwarn_c99 ("type defaults to `int' in declaration of `%s'", diff --git a/gcc/c-lang.c b/gcc/c-lang.c index 87c65fbacae..53ebdabb546 100644 --- a/gcc/c-lang.c +++ b/gcc/c-lang.c @@ -70,10 +70,11 @@ c_init () { c_common_lang_init (); - /* If still unspecified, make it match pedantic && -std=c99. */ + /* If still unspecified, make it match -std=c99 + (allowing for -pedantic-errors). */ if (mesg_implicit_function_declaration < 0) { - if (pedantic && flag_isoc99) + if (flag_isoc99) mesg_implicit_function_declaration = flag_pedantic_errors ? 2 : 1; else mesg_implicit_function_declaration = 0; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 739250652ac..fc6c21921e6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2001-02-12 Joseph S. Myers <jsm28@cam.ac.uk> + + * gcc.dg/c99-impl-int-1.c: Use stricter error string for implicit + return type. + * gcc.dg/cpp/digraphs.c: Declare puts. + 2001-02-12 Nathan Sidwell <nathan@codesourcery.com> * g++.old-deja/g++.other/warn5.C: New test. diff --git a/gcc/testsuite/gcc.dg/c99-impl-int-1.c b/gcc/testsuite/gcc.dg/c99-impl-int-1.c index 2e5cad56d9e..dcc25203ae8 100644 --- a/gcc/testsuite/gcc.dg/c99-impl-int-1.c +++ b/gcc/testsuite/gcc.dg/c99-impl-int-1.c @@ -6,4 +6,4 @@ extern foo; /* { dg-bogus "warning" "warning in place of error" } */ /* { dg-error "type defaults" "C99 implicit int error" { target *-*-* } 6 } */ bar (void) { } /* { dg-bogus "warning" "warning in place of error" } */ -/* { dg-error "type defaults" "C99 implicit int error" { target *-*-* } 8 } */ +/* { dg-error "return type defaults" "C99 implicit int error" { target *-*-* } 8 } */ diff --git a/gcc/testsuite/gcc.dg/cpp/digraphs.c b/gcc/testsuite/gcc.dg/cpp/digraphs.c index e4ae0e03460..49a1bcd8604 100644 --- a/gcc/testsuite/gcc.dg/cpp/digraphs.c +++ b/gcc/testsuite/gcc.dg/cpp/digraphs.c @@ -8,6 +8,7 @@ extern int strcmp (const char *, const char *); extern void abort (void); +extern int puts (const char *); #define err(str) do { puts(str); abort(); } while (0) %:define glue(x, y) x %:%: y /* #define glue(x, y) x ## y. */ |