Module Name:    src
Committed By:   rillig
Date:           Sun Jan 10 13:54:13 UTC 2021

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

Log Message:
lint: use message 232 for unused label in function

This message had been defined but not used before.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_232.c \
    src/tests/usr.bin/xlint/lint1/msg_232.exp
cvs rdiff -u -r1.114 -r1.115 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/tests/usr.bin/xlint/lint1/msg_232.c
diff -u src/tests/usr.bin/xlint/lint1/msg_232.c:1.1 src/tests/usr.bin/xlint/lint1/msg_232.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_232.c:1.1	Sat Jan  2 10:22:44 2021
+++ src/tests/usr.bin/xlint/lint1/msg_232.c	Sun Jan 10 13:54:13 2021
@@ -1,7 +1,14 @@
-/*	$NetBSD: msg_232.c,v 1.1 2021/01/02 10:22:44 rillig Exp $	*/
+/*	$NetBSD: msg_232.c,v 1.2 2021/01/10 13:54:13 rillig Exp $	*/
 # 3 "msg_232.c"
 
 // Test for message: label %s unused in function %s [232]
 
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+void
+example(void)
+{
+	goto used_label;
+unused_label:
+	return;
+used_label:
+	return;
+}
Index: src/tests/usr.bin/xlint/lint1/msg_232.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_232.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_232.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_232.exp:1.1	Sat Jan  2 10:22:44 2021
+++ src/tests/usr.bin/xlint/lint1/msg_232.exp	Sun Jan 10 13:54:13 2021
@@ -1 +1 @@
-msg_232.c(6): syntax error ':' [249]
+msg_232.c(10): warning: label unused_label unused in function example [232]

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.114 src/usr.bin/xlint/lint1/decl.c:1.115
--- src/usr.bin/xlint/lint1/decl.c:1.114	Sun Jan 10 00:05:46 2021
+++ src/usr.bin/xlint/lint1/decl.c	Sun Jan 10 13:54:13 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.114 2021/01/10 00:05:46 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.115 2021/01/10 13:54:13 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.114 2021/01/10 00:05:46 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.115 2021/01/10 13:54:13 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -3051,8 +3051,8 @@ check_label_usage(sym_t *lab)
 
 	if (lab->s_set && !lab->s_used) {
 		curr_pos = lab->s_set_pos;
-		/* %s unused in function %s */
-		warning(192, lab->s_name, funcsym->s_name);
+		/* label %s unused in function %s */
+		warning(232, lab->s_name, funcsym->s_name);
 	} else if (!lab->s_set) {
 		curr_pos = lab->s_use_pos;
 		/* undefined label %s */

Reply via email to