Module Name:    src
Committed By:   rillig
Date:           Sat Jun 19 14:28:04 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: decl.c

Log Message:
lint: fix assertion failure after syntax error in declaration

The code to trigger this case is:

        (s)(int(int););

This only happens with BSD yacc, but not with Bison since they differ in
error handling.


To generate a diff of this commit:
cvs rdiff -u -r1.184 -r1.185 src/usr.bin/xlint/lint1/decl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.184 src/usr.bin/xlint/lint1/decl.c:1.185
--- src/usr.bin/xlint/lint1/decl.c:1.184	Sat Jun 19 14:08:45 2021
+++ src/usr.bin/xlint/lint1/decl.c	Sat Jun 19 14:28:04 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.184 2021/06/19 14:08:45 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.185 2021/06/19 14:28:04 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.184 2021/06/19 14:08:45 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.185 2021/06/19 14:28:04 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -2039,7 +2039,7 @@ declare(sym_t *decl, bool initflg, sbuf_
 
 	if (dcs->d_ctx == EXTERN) {
 		declare_extern(decl, initflg, renaming);
-	} else if (dcs->d_ctx == ARG) {
+	} else if (dcs->d_ctx == ARG || dcs->d_ctx == PROTO_ARG) {
 		if (renaming != NULL) {
 			/* symbol renaming can't be used on function arguments */
 			error(310);

Reply via email to