* c-decl.c (grokdeclarator): Pedwarn qualified void function return type.
authorDoug Evans <dje@gnu.org>
Tue, 25 Mar 1997 21:39:09 +0000 (21:39 +0000)
committerDoug Evans <dje@gnu.org>
Tue, 25 Mar 1997 21:39:09 +0000 (21:39 +0000)
From-SVN: r13802

gcc/c-decl.c

index f4c4a06..f9860e2 100644 (file)
@@ -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");