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 in declare_a...
details: https://anonhg.NetBSD.org/src/rev/bfbf80360659
branches: trunk
changeset: 984499:bfbf80360659
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Jul 10 12:10:39 2021 +0000
description:
lint: fix assertion failure in declare_argument
diffstat:
tests/usr.bin/xlint/lint1/d_lint_assert.c | 9 ++++++++-
tests/usr.bin/xlint/lint1/d_lint_assert.exp | 1 +
usr.bin/xlint/lint1/decl.c | 10 ++++++----
3 files changed, 15 insertions(+), 5 deletions(-)
diffs (64 lines):
diff -r 3380ba1cb262 -r bfbf80360659 tests/usr.bin/xlint/lint1/d_lint_assert.c
--- a/tests/usr.bin/xlint/lint1/d_lint_assert.c Sat Jul 10 11:22:19 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_lint_assert.c Sat Jul 10 12:10:39 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: d_lint_assert.c,v 1.3 2021/02/21 09:07:58 rillig Exp $ */
+/* $NetBSD: d_lint_assert.c,v 1.4 2021/07/10 12:10:39 rillig Exp $ */
# 3 "d_lint_assert.c"
/*
@@ -13,3 +13,10 @@
// near d_lint_assert.c:14
A = +++
}; /* expect: 249 */
+
+/*
+ * Before decl.c 1.196 from 2021-07-10, lint ran into an assertion failure
+ * for 'sym->s_type != NULL' in declare_argument.
+ */
+/* expect+1: warning: old style declaration; add 'int' [1] */
+c(void());
diff -r 3380ba1cb262 -r bfbf80360659 tests/usr.bin/xlint/lint1/d_lint_assert.exp
--- a/tests/usr.bin/xlint/lint1/d_lint_assert.exp Sat Jul 10 11:22:19 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_lint_assert.exp Sat Jul 10 12:10:39 2021 +0000
@@ -1,1 +1,2 @@
d_lint_assert.c(15): error: syntax error '}' [249]
+d_lint_assert.c(22): warning: old style declaration; add 'int' [1]
diff -r 3380ba1cb262 -r bfbf80360659 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Sat Jul 10 11:22:19 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c Sat Jul 10 12:10:39 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.195 2021/07/05 19:55:51 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.196 2021/07/10 12:10:39 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.195 2021/07/05 19:55:51 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.196 2021/07/10 12:10:39 rillig Exp $");
#endif
#include <sys/param.h>
@@ -2430,7 +2430,9 @@
error(52, sym->s_name);
}
- lint_assert(sym->s_type != NULL);
+ if (sym->s_type == NULL) /* for c(void()) */
+ sym->s_type = gettyp(VOID);
+
if ((t = sym->s_type->t_tspec) == ARRAY) {
sym->s_type = derive_type(sym->s_type->t_subt, PTR);
} else if (t == FUNC) {
@@ -2448,7 +2450,7 @@
warning(269, sym->s_name);
/*
- * Arguments must have complete types. lengths() prints the needed
+ * Arguments must have complete types. length() prints the needed
* error messages (null dimension is impossible because arrays are
* converted to pointers).
*/
Home |
Main Index |
Thread Index |
Old Index