diff options
author | mueller <mueller@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-30 23:15:42 +0000 |
---|---|---|
committer | mueller <mueller@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-30 23:15:42 +0000 |
commit | 3f08e399af88be2efbeb9d5769ef3891b4633102 (patch) | |
tree | c6184d67a07b7d5535a9f3989cc07f65cb9eace4 /gcc/c-decl.c | |
parent | 82cae756aba72dc929e7ba4c886fca908d0bb9a9 (diff) | |
download | gcc-3f08e399af88be2efbeb9d5769ef3891b4633102.tar.gz |
2006-10-30 Dirk Mueller <dmueller@suse.de>
PR c++/6321
* cp/decl.c (grokfndecl): Use check_main_parameter_types.
* c-common.h (strict_aliasing_warning): Fix whitespace.
* c-decl (start_function): Move code for main decl warning ..
* c-common.c (check_main_parameter_types): .. here.
* c-common.h (check_main_parameter_types): Declare.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118206 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 45 |
1 files changed, 1 insertions, 44 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index e740fcac917..7ebb8b9c4f1 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6133,54 +6133,11 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator, /* Warn for unlikely, improbable, or stupid declarations of `main'. */ if (warn_main > 0 && MAIN_NAME_P (DECL_NAME (decl1))) { - tree args; - int argct = 0; - if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl1))) != integer_type_node) pedwarn ("return type of %q+D is not %<int%>", decl1); - for (args = TYPE_ARG_TYPES (TREE_TYPE (decl1)); args; - args = TREE_CHAIN (args)) - { - tree type = args ? TREE_VALUE (args) : 0; - - if (type == void_type_node) - break; - - ++argct; - switch (argct) - { - case 1: - if (TYPE_MAIN_VARIANT (type) != integer_type_node) - pedwarn ("first argument of %q+D should be %<int%>", decl1); - break; - - case 2: - if (TREE_CODE (type) != POINTER_TYPE - || TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE - || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type))) - != char_type_node)) - pedwarn ("second argument of %q+D should be %<char **%>", - decl1); - break; - - case 3: - if (TREE_CODE (type) != POINTER_TYPE - || TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE - || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type))) - != char_type_node)) - pedwarn ("third argument of %q+D should probably be " - "%<char **%>", decl1); - break; - } - } - - /* It is intentional that this message does not mention the third - argument because it's only mentioned in an appendix of the - standard. */ - if (argct > 0 && (argct < 2 || argct > 3)) - pedwarn ("%q+D takes only zero or two arguments", decl1); + check_main_parameter_types(decl1); if (!TREE_PUBLIC (decl1)) pedwarn ("%q+D is normally a non-static function", decl1); |