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: separate error and warning for 27 ...
details: https://anonhg.NetBSD.org/src/rev/3d32a03ace52
branches: trunk
changeset: 979620:3d32a03ace52
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jan 03 17:11:19 2021 +0000
description:
lint: separate error and warning for 27 and 58
Even though this results in more lines of code, the benefit is that the
message text in the comment is verified by check-msgs.lua. The code is
also easier to read, the parentheses and asterisk were not needed.
diffstat:
usr.bin/xlint/lint1/decl.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diffs (48 lines):
diff -r 5fa24a1b0bf7 -r 3d32a03ace52 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Sun Jan 03 16:59:59 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c Sun Jan 03 17:11:19 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.104 2021/01/03 16:59:59 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.105 2021/01/03 17:11:19 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.104 2021/01/03 16:59:59 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.105 2021/01/03 17:11:19 rillig Exp $");
#endif
#include <sys/param.h>
@@ -1923,8 +1923,12 @@
if (!redec && !check_redeclaration(dsym, (dowarn = 0, &dowarn))) {
if (dowarn) {
- /* redeclaration of %s */
- (*(sflag ? error : warning))(27, dsym->s_name);
+ if (sflag)
+ /* redeclaration of %s */
+ error(27, dsym->s_name);
+ else
+ /* redeclaration of %s */
+ warning(27, dsym->s_name);
print_previous_declaration(-1, rdsym);
}
@@ -2534,8 +2538,12 @@
msg = 1;
}
} else if (dowarn) {
- /* type does not match prototype: %s */
- (*(sflag ? error : warning))(58, arg->s_name);
+ if (sflag)
+ /* type does not match prototype: %s */
+ error(58, arg->s_name);
+ else
+ /* type does not match prototype: %s */
+ warning(58, arg->s_name);
msg = 1;
}
Home |
Main Index |
Thread Index |
Old Index