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: remove assertion about saving and ...



details:   https://anonhg.NetBSD.org/src/rev/20350fdc786a
branches:  trunk
changeset: 366422:20350fdc786a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu May 26 12:27:25 2022 +0000

description:
lint: remove assertion about saving and restoring warning flags

The assertion only triggers in debug mode, which is generally not used
as it adds lots of debug logging.  In production mode, the assumption
didn't hold for many years now, so remove the assertion.

diffstat:

 usr.bin/xlint/lint1/cgram.y |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r bb38ab07cd2d -r 20350fdc786a usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Thu May 26 12:04:56 2022 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Thu May 26 12:27:25 2022 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.416 2022/05/20 21:18:55 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.417 2022/05/26 12:27:25 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: cgram.y,v 1.416 2022/05/20 21:18:55 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.417 2022/05/26 12:27:25 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -83,7 +83,12 @@
 static void
 SAVE_WARN_FLAGS(const char *file, size_t line)
 {
-       lint_assert(olwarn == LWARN_BAD);
+       /*
+        * There used to be an assertion for 'olwarn == LWARN_BAD' here,
+        * but that triggered for the following code:
+        *
+        * void function(int x) { if (x > 0) if (x > 1) return; }
+        */
        debug_step("%s:%zu: saving flags %d", file, line, lwarn);
        olwarn = lwarn;
 }



Home | Main Index | Thread Index | Old Index