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: verify that comment above warning_...
details: https://anonhg.NetBSD.org/src/rev/c02efe2bd18d
branches: trunk
changeset: 368287:c02efe2bd18d
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jul 03 07:33:08 2022 +0000
description:
lint: verify that comment above warning_at matches the message
No binary change.
diffstat:
usr.bin/xlint/lint1/check-msgs.lua | 19 +++++++++++++------
usr.bin/xlint/lint1/func.c | 6 +++---
2 files changed, 16 insertions(+), 9 deletions(-)
diffs (68 lines):
diff -r b593e46aa4ba -r c02efe2bd18d usr.bin/xlint/lint1/check-msgs.lua
--- a/usr.bin/xlint/lint1/check-msgs.lua Sun Jul 03 06:30:31 2022 +0000
+++ b/usr.bin/xlint/lint1/check-msgs.lua Sun Jul 03 07:33:08 2022 +0000
@@ -1,5 +1,5 @@
#! /usr/bin/lua
--- $NetBSD: check-msgs.lua,v 1.13 2021/12/16 21:14:58 rillig Exp $
+-- $NetBSD: check-msgs.lua,v 1.14 2022/07/03 07:33:08 rillig Exp $
--[[
@@ -61,6 +61,15 @@
fname, lineno, id, msg, comment)
end
+local is_message_function = {
+ error = true,
+ error_at = true,
+ warning = true,
+ warning_at = true,
+ c99ism = true,
+ c11ism = true,
+ gnuism = true,
+}
local function check_file(fname, msgs)
local f = assert(io.open(fname, "r"))
@@ -69,11 +78,9 @@
for line in f:lines() do
lineno = lineno + 1
- local func, id = line:match("^%s+(%w+)%((%d+)[),]")
- id = tonumber(id)
- if func == "error" or func == "warning" or
- func == "c99ism" or func == "c11ism" or
- func == "gnuism" or func == "message" then
+ local func, id = line:match("^%s+([%w_]+)%((%d+)[),]")
+ if is_message_function[func] then
+ id = tonumber(id)
local comment = prev:match("^%s+/%* (.+) %*/$")
if comment ~= nil then
check_message(fname, lineno, id, comment, msgs)
diff -r b593e46aa4ba -r c02efe2bd18d usr.bin/xlint/lint1/func.c
--- a/usr.bin/xlint/lint1/func.c Sun Jul 03 06:30:31 2022 +0000
+++ b/usr.bin/xlint/lint1/func.c Sun Jul 03 07:33:08 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: func.c,v 1.142 2022/06/22 19:23:17 rillig Exp $ */
+/* $NetBSD: func.c,v 1.143 2022/07/03 07:33:08 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: func.c,v 1.142 2022/06/22 19:23:17 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.143 2022/07/03 07:33:08 rillig Exp $");
#endif
#include <stdlib.h>
@@ -1152,7 +1152,7 @@
}
if (scanflike_argnum != -1) {
if (!silent) {
- /* must precede function definition: ** %s ** */
+ /* comment ** %s ** must precede function definition */
warning_at(282, &scanflike_pos, "SCANFLIKE");
}
scanflike_argnum = -1;
Home |
Main Index |
Thread Index |
Old Index