summaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-13 17:57:47 +0000
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-13 17:57:47 +0000
commit23efcc0264e7ed4273163d8f5f2057cc19639a17 (patch)
treed1fe225e6b0637a6333ddd4ed28cd99d4d43c234 /gcc/c-common.c
parent2c49840da24137b7b3f695a320c8e4517acacbd8 (diff)
downloadgcc-23efcc0264e7ed4273163d8f5f2057cc19639a17.tar.gz
2008-08-13 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR 30551 * doc/invoke.texi (Wmain): Update. * c-decl.c (start_decl): warn_main is only 0 or 1. (start_function): Likewise. Fix formatting. (finish_function): Delete redundant warning. * c.opt (Wmain): Add Var(warn_main) and Init(-1). * c-opts (c_common_handle_option): -Wall only has effect if warn_main is uninitialized. OPT_Wmain is automatically handled. -pedantic also enables Wmain. (c_common_post_options): Handle all logic for Wmain here. * c-common.c (warn_main): Delete. (check_main_parameter_types): Make pedwarns conditional on OPT_Wmain. * c-common.h (warn_main): Delete. cp/ * decl.c (grokfndecl): Call check_main_parameters_type only if -Wmain. testsuite/ * gcc.dg/pr30551.c: New. * gcc.dg/pr30551-2.c: New. * gcc.dg/pr30551-3.c: New. * gcc.dg/pr30551-4.c: New. * gcc.dg/pr30551-5.c: New. * gcc.dg/pr30551-6.c: New. * gcc.dg/tree-ssa/reassoc-3.c: Don't compile with -pedantic-errors. * g++.dg/warn/pr30551.C: New. * g++.dg/warn/pr30551-2.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139063 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 93021820cd6..8bac9cb4f03 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -342,10 +342,6 @@ int flag_isoc99;
int flag_hosted = 1;
-/* Warn if main is suspicious. */
-
-int warn_main;
-
/* ObjC language option variables. */
@@ -1363,7 +1359,8 @@ check_main_parameter_types (tree decl)
{
case 1:
if (TYPE_MAIN_VARIANT (type) != integer_type_node)
- pedwarn (0, "first argument of %q+D should be %<int%>", decl);
+ pedwarn (OPT_Wmain, "first argument of %q+D should be %<int%>",
+ decl);
break;
case 2:
@@ -1371,8 +1368,8 @@ check_main_parameter_types (tree decl)
|| TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE
|| (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type)))
!= char_type_node))
- pedwarn (0, "second argument of %q+D should be %<char **%>",
- decl);
+ pedwarn (OPT_Wmain, "second argument of %q+D should be %<char **%>",
+ decl);
break;
case 3:
@@ -1380,8 +1377,8 @@ check_main_parameter_types (tree decl)
|| TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE
|| (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type)))
!= char_type_node))
- pedwarn (0, "third argument of %q+D should probably be "
- "%<char **%>", decl);
+ pedwarn (OPT_Wmain, "third argument of %q+D should probably be "
+ "%<char **%>", decl);
break;
}
}
@@ -1390,7 +1387,7 @@ check_main_parameter_types (tree decl)
argument because it's only mentioned in an appendix of the
standard. */
if (argct > 0 && (argct < 2 || argct > 3))
- pedwarn (0, "%q+D takes only zero or two arguments", decl);
+ pedwarn (OPT_Wmain, "%q+D takes only zero or two arguments", decl);
}
/* True if pointers to distinct types T1 and T2 can be converted to