]> gcc.gnu.org Git - gcc.git/commitdiff
(finish_function): If return type of `main' is not `int',
authorRichard Stallman <rms@gnu.org>
Tue, 7 Jul 1992 01:09:25 +0000 (01:09 +0000)
committerRichard Stallman <rms@gnu.org>
Tue, 7 Jul 1992 01:09:25 +0000 (01:09 +0000)
warn instead of doing DEFAULT_MAIN_RETURN.

From-SVN: r1486

gcc/c-decl.c

index c9d2815b3af3ca003fa5a014fd1203ca365d4b94..4f00471628079516eea7eda931edbf0dab33e3fb 100644 (file)
@@ -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
 
This page took 0.064568 seconds and 5 git commands to generate.