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 restrict...



details:   https://anonhg.NetBSD.org/src/rev/567d2be59fd1
branches:  trunk
changeset: 950157:567d2be59fd1
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Jan 18 17:43:43 2021 +0000

description:
lint: fix assertion failure for restrict and _Thread_local

diffstat:

 tests/usr.bin/xlint/lint1/msg_010.c |   4 ++--
 usr.bin/xlint/lint1/decl.c          |  12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

diffs (56 lines):

diff -r c4f8a35691a1 -r 567d2be59fd1 tests/usr.bin/xlint/lint1/msg_010.c
--- a/tests/usr.bin/xlint/lint1/msg_010.c       Mon Jan 18 17:41:04 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_010.c       Mon Jan 18 17:43:43 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_010.c,v 1.3 2021/01/18 17:41:04 rillig Exp $       */
+/*     $NetBSD: msg_010.c,v 1.4 2021/01/18 17:43:44 rillig Exp $       */
 # 3 "msg_010.c"
 
 // Test for message: duplicate '%s' [10]
@@ -21,7 +21,7 @@
 }
 
 int
-restrict_pointer(const int * /*restrict*/ p) // FIXME: assertion "== VOLATILE" failed
+restrict_pointer(const int *restrict p)
 {
        return *p;
 }
diff -r c4f8a35691a1 -r 567d2be59fd1 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Mon Jan 18 17:41:04 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Mon Jan 18 17:43:43 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.127 2021/01/17 16:25:30 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.128 2021/01/18 17:43:43 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.127 2021/01/17 16:25:30 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.128 2021/01/18 17:43:43 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -565,15 +565,15 @@
                        warning(10, "const");
                }
                dcs->d_const = true;
-       } else {
-               if (q == THREAD)
-                       return;
-               lint_assert(q == VOLATILE);
+       } else if (q == VOLATILE) {
                if (dcs->d_volatile) {
                        /* duplicate '%s' */
                        warning(10, "volatile");
                }
                dcs->d_volatile = true;
+       } else {
+               lint_assert(q == RESTRICT || q == THREAD);
+               /* Silently ignore these qualifiers. */
        }
 }
 



Home | Main Index | Thread Index | Old Index