Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 lint: fix assertion failure after syntax...



details:   https://anonhg.NetBSD.org/src/rev/c4cffa07b6be
branches:  trunk
changeset: 1021815:c4cffa07b6be
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jun 19 14:28:04 2021 +0000

description:
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.

diffstat:

 usr.bin/xlint/lint1/decl.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r afd125d37cca -r c4cffa07b6be usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Sat Jun 19 14:08:45 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Sat Jun 19 14:28:04 2021 +0000
@@ -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 @@
 
        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);



Home | Main Index | Thread Index | Old Index