summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/gcc/c-common.h4
-rw-r--r--contrib/gcc/c-decl.c14
2 files changed, 17 insertions, 1 deletions
diff --git a/contrib/gcc/c-common.h b/contrib/gcc/c-common.h
index 4d2d476..c89b9aa 100644
--- a/contrib/gcc/c-common.h
+++ b/contrib/gcc/c-common.h
@@ -415,6 +415,10 @@ extern int warn_sequence_point;
extern int warn_missing_format_attribute;
+/* Nonzero means do not warn that K&R style main() is not a function prototype. */
+
+extern int flag_bsd_no_warn_kr_main;
+
/* Nonzero means warn about sizeof (function) or addition/subtraction
of function pointers. */
diff --git a/contrib/gcc/c-decl.c b/contrib/gcc/c-decl.c
index 46685e2..e6a2293 100644
--- a/contrib/gcc/c-decl.c
+++ b/contrib/gcc/c-decl.c
@@ -379,6 +379,11 @@ int warn_traditional;
int warn_pointer_arith;
+
+/* Nonzero means do not warn that K&R style main() is not a function prototype. */
+
+int flag_bsd_no_warn_kr_main;
+
/* Nonzero means warn for non-prototype function decls
or non-prototyped defs without previous prototype. */
@@ -531,6 +536,7 @@ c_decode_option (argc, argv)
flag_noniso_default_format_attributes = 0;
flag_isoc99 = 0;
flag_bsd_format = 0;
+ flag_bsd_no_warn_kr_main = 0;
}
else if (!strcmp (argstart, "iso9899:199409"))
{
@@ -550,6 +556,7 @@ c_decode_option (argc, argv)
flag_isoc99 = 1;
flag_isoc94 = 1;
flag_bsd_format = 0;
+ flag_bsd_no_warn_kr_main = 0;
}
else if (!strcmp (argstart, "gnu89"))
{
@@ -561,6 +568,7 @@ c_decode_option (argc, argv)
flag_isoc99 = 0;
flag_isoc94 = 0;
flag_bsd_format = 0;
+ flag_bsd_no_warn_kr_main = 0;
}
else if (!strcmp (argstart, "gnu9x") || !strcmp (argstart, "gnu99"))
{
@@ -572,6 +580,7 @@ c_decode_option (argc, argv)
flag_isoc99 = 1;
flag_isoc94 = 1;
flag_bsd_format = 0;
+ flag_bsd_no_warn_kr_main = 0;
}
else if (!strcmp (argstart, "bsd"))
{
@@ -584,6 +593,7 @@ c_decode_option (argc, argv)
flag_isoc94 = 0;
flag_isoc94 = 0;
flag_bsd_format = 1;
+ flag_bsd_no_warn_kr_main = 1;
}
else
error ("unknown C standard `%s'", argstart);
@@ -6313,7 +6323,9 @@ start_function (declspecs, declarator, attributes)
&& !(old_decl != 0
&& (TYPE_ARG_TYPES (TREE_TYPE (old_decl)) != 0
|| (DECL_BUILT_IN (old_decl)
- && ! C_DECL_ANTICIPATED (old_decl)))))
+ && ! C_DECL_ANTICIPATED (old_decl))))
+ && !(flag_bsd_no_warn_kr_main && 0 ==
+ strcmp ("main", IDENTIFIER_POINTER (DECL_NAME (decl1)))))
warning ("function declaration isn't a prototype");
/* Optionally warn of any global def with no previous prototype. */
else if (warn_missing_prototypes
OpenPOWER on IntegriCloud