aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/c-decl.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index f4c4a067c6a..f9860e299af 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -5031,6 +5031,13 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
&& ! DECL_IN_SYSTEM_HEADER (decl))
pedwarn ("ANSI C forbids const or volatile functions");
+ if (pedantic
+ && TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl))) == void_type_node
+ && (TYPE_READONLY (TREE_TYPE (TREE_TYPE (decl)))
+ || TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (decl))))
+ && ! DECL_IN_SYSTEM_HEADER (decl))
+ pedwarn ("ANSI C forbids const or volatile void function return type");
+
if (volatilep
&& TREE_TYPE (TREE_TYPE (decl)) != void_type_node)
warning ("`noreturn' function returns non-void value");