diff options
author | Richard Stallman <rms@gnu.org> | 1992-07-07 01:09:25 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1992-07-07 01:09:25 +0000 |
commit | 8e077183b4b711155a3270b25bd7e901b3546fb9 (patch) | |
tree | be495d82a5e98ee67f3ad011b3f83a444013caa7 | |
parent | de86a82ecadcc2cb2b5df9c4d31843707209955b (diff) | |
download | gcc-8e077183b4b711155a3270b25bd7e901b3546fb9.zip gcc-8e077183b4b711155a3270b25bd7e901b3546fb9.tar.gz gcc-8e077183b4b711155a3270b25bd7e901b3546fb9.tar.bz2 |
(finish_function): If return type of `main' is not `int',
warn instead of doing DEFAULT_MAIN_RETURN.
From-SVN: r1486
-rw-r--r-- | gcc/c-decl.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index c9d2815..4f00471 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -5786,8 +5786,13 @@ finish_function (nested) #ifdef DEFAULT_MAIN_RETURN if (! strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main")) { - /* Make it so that `main' always returns success by default. */ - DEFAULT_MAIN_RETURN; + if (TREE_TYPE (fndecl) != integer_type_node) + warning_with_decl (fndecl, "return type of `%s' is not `int'"); + else + { + /* Make it so that `main' always returns success by default. */ + DEFAULT_MAIN_RETURN; + } } #endif |