diff options
author | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1996-11-12 19:17:33 +0000 |
---|---|---|
committer | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1996-11-12 19:17:33 +0000 |
commit | 65a8b580970a5a42d64fafdadc89519099c6ac41 (patch) | |
tree | 5554c1b2cad058621b49d3c369b0df95f770006c /gcc/c-decl.c | |
parent | 1185f0f7b373ddf790b375b25e401fdf62c2063d (diff) | |
download | gcc-65a8b580970a5a42d64fafdadc89519099c6ac41.tar.gz |
(grokdeclarator): Generate a warning if -Wimplicit, unless a warning
was already generated by -Wreturn-type.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@13135 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 13d6887d14d..accc0257e96 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -4277,10 +4277,20 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) if (type == 0) { - if (funcdef_flag && warn_return_type - && ! (specbits & ((1 << (int) RID_LONG) | (1 << (int) RID_SHORT) - | (1 << (int) RID_SIGNED) | (1 << (int) RID_UNSIGNED)))) - warn_about_return_type = 1; + if (! (specbits & ((1 << (int) RID_LONG) | (1 << (int) RID_SHORT) + | (1 << (int) RID_SIGNED) + | (1 << (int) RID_UNSIGNED)))) + { + /* C9x will probably require a diagnostic here. + For now, issue a warning if -Wreturn-type and this is a function, + or if -Wimplicit; prefer the former warning since it is more + explicit. */ + if ((warn_implicit || warn_return_type) && funcdef_flag) + warn_about_return_type = 1; + else if (warn_implicit) + warning ("type defaults to `int' in declaration of `%s'", name); + } + defaulted_int = 1; type = integer_type_node; } |