aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorGreg McGary <greg@mcgary.org>2000-08-24 20:09:27 +0000
committerGreg McGary <gkm@gcc.gnu.org>2000-08-24 20:09:27 +0000
commit5b47282c68f4e38146f46b66d5e6d3d90fe25a4d (patch)
tree71324c35deb4c607104811c9294afcf32e897922 /gcc/c-decl.c
parent87ae0c74eb1e515d6d7c97892fdcaf11db61dea4 (diff)
downloadgcc-5b47282c68f4e38146f46b66d5e6d3d90fe25a4d.zip
gcc-5b47282c68f4e38146f46b66d5e6d3d90fe25a4d.tar.gz
gcc-5b47282c68f4e38146f46b66d5e6d3d90fe25a4d.tar.bz2
tree.h (enum tree_index): New member `TI_MAIN_IDENTIFIER'.
* tree.h (enum tree_index): New member `TI_MAIN_IDENTIFIER'. (MAIN_NAME_P, main_identifier_node): New macros. * c-common.c (c_common_nodes_and_builtins): Init main_identifier_node. * c-decl.c (start_decl, grokdeclarator, start_function, store_parm_decls, finish_function): Use MAIN_NAME_P. * config/avr/avr.c (function_prologue, function_epilogue): Likewise. * config/i386/cygwin.h (SUBTARGET_PROLOGUE): Likewise. * config/i386/win32.h (SUBTARGET_PROLOGUE): Likewise. * config/pdp11/pdp11.c (output_function_prologue): Likewise. From-SVN: r35945
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 17b131a..59b238b 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -3430,7 +3430,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
register tree tem;
if (warn_main > 0 && TREE_CODE (decl) != FUNCTION_DECL
- && !strcmp (IDENTIFIER_POINTER (DECL_NAME (decl)), "main"))
+ && MAIN_NAME_P (DECL_NAME (decl)))
warning_with_decl (decl, "`%s' is usually a function");
if (initialized)
@@ -4827,7 +4827,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
/* Record presence of `inline', if it is reasonable. */
if (inlinep)
{
- if (! strcmp (IDENTIFIER_POINTER (declarator), "main"))
+ if (MAIN_NAME_P (declarator))
warning ("cannot inline function `main'");
else
/* Assume that otherwise the function can be inlined. */
@@ -5892,7 +5892,7 @@ start_function (declspecs, declarator, prefix_attributes, attributes)
else if (warn_missing_prototypes
&& TREE_PUBLIC (decl1)
&& !(old_decl != 0 && TYPE_ARG_TYPES (TREE_TYPE (old_decl)) != 0)
- && strcmp ("main", IDENTIFIER_POINTER (DECL_NAME (decl1))))
+ && ! MAIN_NAME_P (DECL_NAME (decl1)))
warning_with_decl (decl1, "no previous prototype for `%s'");
/* Optionally warn of any def with no previous prototype
if the function has already been used. */
@@ -5905,7 +5905,7 @@ start_function (declspecs, declarator, prefix_attributes, attributes)
else if (warn_missing_declarations
&& TREE_PUBLIC (decl1)
&& old_decl == 0
- && strcmp ("main", IDENTIFIER_POINTER (DECL_NAME (decl1))))
+ && ! MAIN_NAME_P (DECL_NAME (decl1)))
warning_with_decl (decl1, "no previous declaration for `%s'");
/* Optionally warn of any def with no previous declaration
if the function has already been used. */
@@ -5934,8 +5934,7 @@ start_function (declspecs, declarator, prefix_attributes, attributes)
TREE_PUBLIC (decl1) = 0;
/* Warn for unlikely, improbable, or stupid declarations of `main'. */
- if (warn_main > 0
- && strcmp ("main", IDENTIFIER_POINTER (DECL_NAME (decl1))) == 0)
+ if (warn_main > 0 && MAIN_NAME_P (DECL_NAME (decl1)))
{
tree args;
int argct = 0;
@@ -6461,7 +6460,7 @@ store_parm_decls ()
/* If this function is `main', emit a call to `__main'
to run global initializers, etc. */
if (DECL_NAME (fndecl)
- && strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main") == 0
+ && MAIN_NAME_P (DECL_NAME (fndecl))
&& DECL_CONTEXT (fndecl) == NULL_TREE)
expand_main_function ();
}
@@ -6641,8 +6640,7 @@ finish_function (nested)
setjmp_protect_args ();
}
- if (! strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main")
- && flag_hosted)
+ if (MAIN_NAME_P (DECL_NAME (fndecl)) && flag_hosted)
{
if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (fndecl)))
!= integer_type_node)