widl [6/6]: Generate an error for "int f(void a)"

Dan Hipschman dsh at linux.ucla.edu
Tue Aug 29 16:29:06 CDT 2006


This fixes the bug Rob pointed out.

ChangeLog:
* Make "int f(void a)" an error.  Rob Shearman found this bug.
---
 tools/widl/parser.y |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 0121bca..8cbddcd 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -106,6 +106,7 @@ static void write_iid(type_t *iface);
 static int compute_method_indexes(type_t *iface);
 static char *gen_name(void);
 static void process_typedefs(var_t *names);
+static void check_arg(var_t *arg);
 
 #define tsENUM   1
 #define tsSTRUCT 2
@@ -319,8 +320,8 @@ m_args:						{ $$ = NULL; }
 no_args:  tVOID					{ $$ = NULL; }
 	;
 
-args:	  arg
-	| args ',' arg				{ LINK($3, $1); $$ = $3; }
+args:	  arg					{ check_arg($1); $$ = $1; }
+	| args ',' arg				{ check_arg($3); LINK($3, $1); $$ = $3; }
 	| no_args
 	;
 
@@ -1678,3 +1679,11 @@ static void process_typedefs(var_t *name
     names = next;
   }
 }
+
+static void check_arg(var_t *arg)
+{
+  type_t *t = arg->type;
+
+  if (t->type == 0 && ! is_var_ptr(arg))
+    yyerror("argument '%s' has void type", arg->name);
+}



More information about the wine-patches mailing list