summaryrefslogtreecommitdiffstats
path: root/gcc/c-typeck.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-typeck.c')
-rw-r--r--gcc/c-typeck.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index cd9da659e53..c882dd90386 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -6623,8 +6623,9 @@ c_expand_return (retval)
if (!retval)
{
current_function_returns_null = 1;
- if (warn_return_type && valtype != 0 && TREE_CODE (valtype) != VOID_TYPE)
- warning ("`return' with no value, in function returning non-void");
+ if ((warn_return_type || flag_isoc99)
+ && valtype != 0 && TREE_CODE (valtype) != VOID_TYPE)
+ pedwarn_c99 ("`return' with no value, in function returning non-void");
expand_null_return ();
}
else if (valtype == 0 || TREE_CODE (valtype) == VOID_TYPE)
@@ -6752,3 +6753,27 @@ c_expand_start_case (exp)
return exp;
}
+
+/* Issue an ISO C99 pedantic warning MSGID. */
+
+void
+pedwarn_c99 VPARAMS ((const char *msgid, ...))
+{
+#ifndef ANSI_PROTOTYPES
+ const char *msgid;
+#endif
+ va_list ap;
+
+ VA_START (ap, msgid);
+
+#ifndef ANSI_PROTOTYPES
+ msgid = va_arg (ap, const char *);
+#endif
+
+ if (flag_isoc99)
+ vpedwarn (msgid, ap);
+ else
+ vwarning (msgid, ap);
+
+ va_end (ap);
+}
OpenPOWER on IntegriCloud