Module Name:    src
Committed By:   rillig
Date:           Thu May 26 12:27:25 UTC 2022

Modified Files:
        src/usr.bin/xlint/lint1: cgram.y

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.416 -r1.417 src/usr.bin/xlint/lint1/cgram.y

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.416 src/usr.bin/xlint/lint1/cgram.y:1.417
--- src/usr.bin/xlint/lint1/cgram.y:1.416	Fri May 20 21:18:55 2022
+++ src/usr.bin/xlint/lint1/cgram.y	Thu May 26 12:27:25 2022
@@ -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 @@ CLEAR_WARN_FLAGS(const char *file, size_
 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;
 }

Reply via email to