Module Name:    src
Committed By:   rillig
Date:           Fri Jan  1 14:11:20 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: decl.c

Log Message:
lint: combine duplicate case branches in popdecl

This works around GCC 9, which didn't see that the following statement
cannot terminate normally, even though 0 is obviously a constant expression
and assert_failed is marked as __attribute__((__noreturn__)).

        do {
                if (!(0))
                        assert_failed(...);
        } while (0)


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/usr.bin/xlint/lint1/decl.c

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/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.96 src/usr.bin/xlint/lint1/decl.c:1.97
--- src/usr.bin/xlint/lint1/decl.c:1.96	Fri Jan  1 13:43:34 2021
+++ src/usr.bin/xlint/lint1/decl.c	Fri Jan  1 14:11:20 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.96 2021/01/01 13:43:34 kre Exp $ */
+/* $NetBSD: decl.c,v 1.97 2021/01/01 14:11:20 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.96 2021/01/01 13:43:34 kre Exp $");
+__RCSID("$NetBSD: decl.c,v 1.97 2021/01/01 14:11:20 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -612,11 +612,6 @@ popdecl(void)
 	di = dcs;
 	dcs = di->d_next;
 	switch (di->d_ctx) {
-	case EXTERN:
-		/* there is nothing after external declarations */
-		lint_assert(0);
-		/* NOTREACHED */
-		/* XXX gcc is stupid enough not to know that, hence: */ break;
 	case MOS:
 	case MOU:
 	case ENUMCON:
@@ -662,6 +657,9 @@ popdecl(void)
 		/* usage of arguments will be checked by funcend() */
 		rmsyms(di->d_dlsyms);
 		break;
+	case EXTERN:
+		/* there is nothing after external declarations */
+		/* FALLTHROUGH */
 	default:
 		lint_assert(0);
 	}

Reply via email to