Commit f22967f3 by Mark Mitchell Committed by Mark Mitchell

decl.c (grokfndecl): Require that `main' return an `int'.

	* decl.c (grokfndecl): Require that `main' return an `int'.
	* mangle.c (write_encoding): Don't mangle return types for
	conversion functions.

From-SVN: r35972
parent 036cfb36
2000-08-25 Mark Mitchell <mark@codesourcery.com>
* decl.c (grokfndecl): Require that `main' return an `int'.
* mangle.c (write_encoding): Don't mangle return types for
conversion functions.
2000-08-25 Gabriel Dos Reis <gdr@codesourcery.com>
* error.c (tree_formatting_info): New data type.
......
......@@ -8819,8 +8819,11 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
error ("cannot declare `::main' to be a template");
if (inlinep)
error ("cannot declare `::main' to be inline");
else if (! publicp)
if (!publicp)
error ("cannot declare `::main' to be static");
if (!same_type_p (TREE_TYPE (TREE_TYPE (decl)),
integer_type_node))
error ("`main' must return `int'");
inlinep = 0;
publicp = 1;
}
......
......@@ -643,6 +643,7 @@ write_encoding (decl)
write_bare_function_type (fn_type,
(!DECL_CONSTRUCTOR_P (decl)
&& !DECL_DESTRUCTOR_P (decl)
&& !DECL_CONV_FN_P (decl)
&& decl_is_template_id (decl, NULL)));
}
}
......
// Build don't link:
// Origin: Mark Mitchell <mark@codesourcery.com>
double main () {} // ERROR - main must return `int'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment