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: use message 232 for unused label i...
details: https://anonhg.NetBSD.org/src/rev/fefeb1640540
branches: trunk
changeset: 958557:fefeb1640540
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jan 10 13:54:13 2021 +0000
description:
lint: use message 232 for unused label in function
This message had been defined but not used before.
diffstat:
tests/usr.bin/xlint/lint1/msg_232.c | 13 ++++++++++---
tests/usr.bin/xlint/lint1/msg_232.exp | 2 +-
usr.bin/xlint/lint1/decl.c | 8 ++++----
3 files changed, 15 insertions(+), 8 deletions(-)
diffs (56 lines):
diff -r e904fc00cf0c -r fefeb1640540 tests/usr.bin/xlint/lint1/msg_232.c
--- a/tests/usr.bin/xlint/lint1/msg_232.c Sun Jan 10 13:44:57 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_232.c Sun Jan 10 13:54:13 2021 +0000
@@ -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;
+}
diff -r e904fc00cf0c -r fefeb1640540 tests/usr.bin/xlint/lint1/msg_232.exp
--- a/tests/usr.bin/xlint/lint1/msg_232.exp Sun Jan 10 13:44:57 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_232.exp Sun Jan 10 13:54:13 2021 +0000
@@ -1,1 +1,1 @@
-msg_232.c(6): syntax error ':' [249]
+msg_232.c(10): warning: label unused_label unused in function example [232]
diff -r e904fc00cf0c -r fefeb1640540 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Sun Jan 10 13:44:57 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c Sun Jan 10 13:54:13 2021 +0000
@@ -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 @@
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 */
Home |
Main Index |
Thread Index |
Old Index