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 for syntax e...
details: https://anonhg.NetBSD.org/src/rev/d15ccc2db3c7
branches: trunk
changeset: 979788:d15ccc2db3c7
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jan 10 18:13:42 2021 +0000
description:
lint: fix assertion failure for syntax error in enum declaration
diffstat:
tests/usr.bin/xlint/lint1/d_lint_assert.c | 10 +++-------
tests/usr.bin/xlint/lint1/d_lint_assert.exp | 2 +-
usr.bin/xlint/lint1/decl.c | 7 +++++--
3 files changed, 9 insertions(+), 10 deletions(-)
diffs (60 lines):
diff -r e8e63a2c9ce4 -r d15ccc2db3c7 tests/usr.bin/xlint/lint1/d_lint_assert.c
--- a/tests/usr.bin/xlint/lint1/d_lint_assert.c Sun Jan 10 18:06:38 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_lint_assert.c Sun Jan 10 18:13:42 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: d_lint_assert.c,v 1.1 2021/01/10 18:06:38 rillig Exp $ */
+/* $NetBSD: d_lint_assert.c,v 1.2 2021/01/10 18:13:43 rillig Exp $ */
# 3 "d_lint_assert.c"
/*
@@ -6,14 +6,10 @@
* just hard to trigger, but not impossible.
*/
-/* lint1-extra-flags: -p */
-
enum {
+ // Before decl.c 1.118 from 2021-01-10:
// lint: assertion "sym->s_scl == EXTERN || sym->s_scl == STATIC"
// failed in check_global_variable at decl.c:3135
// near d_lint_assert.c:14
- //A = +++
- DUMMY = 0
+ A = +++
};
-
-"syntax error to keep the .exp file."
diff -r e8e63a2c9ce4 -r d15ccc2db3c7 tests/usr.bin/xlint/lint1/d_lint_assert.exp
--- a/tests/usr.bin/xlint/lint1/d_lint_assert.exp Sun Jan 10 18:06:38 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_lint_assert.exp Sun Jan 10 18:13:42 2021 +0000
@@ -1,1 +1,1 @@
-d_lint_assert.c(19): syntax error '"' [249]
+d_lint_assert.c(15): syntax error '}' [249]
diff -r e8e63a2c9ce4 -r d15ccc2db3c7 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Sun Jan 10 18:06:38 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c Sun Jan 10 18:13:42 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.118 2021/01/10 14:12:48 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.119 2021/01/10 18:13:42 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.118 2021/01/10 14:12:48 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.119 2021/01/10 18:13:42 rillig Exp $");
#endif
#include <sys/param.h>
@@ -3132,6 +3132,9 @@
if (sym->s_scl == TYPEDEF || sym->s_scl == ENUMCON)
return;
+ if (sym->s_scl == NOSCL)
+ return; /* May be caused by a syntax error. */
+
lint_assert(sym->s_scl == EXTERN || sym->s_scl == STATIC);
check_global_variable_size(sym);
Home |
Main Index |
Thread Index |
Old Index