pkgsrc-ng/lang/gcc45/patches/patch-gcc_c-decl.c
Lionel Sambuc 612ad0a18c lang/gcc45
2016-01-22 00:09:29 +01:00

24 lines
713 B
C

$NetBSD$
--- gcc/c-decl.c.orig Thu Nov 11 20:40:32 2010
+++ gcc/c-decl.c
@@ -3909,7 +3909,7 @@ start_decl (struct c_declarator *declarator, struct c_
return 0;
if (expr)
- add_stmt (expr);
+ add_stmt (fold_convert (void_type_node, expr));
if (TREE_CODE (decl) != FUNCTION_DECL && MAIN_NAME_P (DECL_NAME (decl)))
warning (OPT_Wmain, "%q+D is usually a function", decl);
@@ -7385,7 +7385,8 @@ start_function (struct c_declspecs *declspecs, struct
/* If the declarator is not suitable for a function definition,
cause a syntax error. */
- if (decl1 == 0)
+ if (decl1 == 0
+ || TREE_CODE (decl1) != FUNCTION_DECL)
return 0;
loc = DECL_SOURCE_LOCATION (decl1);