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: do not modify curr_pos in check_gl...
details: https://anonhg.NetBSD.org/src/rev/e9efc7c27101
branches: trunk
changeset: 961406:e9efc7c27101
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Apr 18 09:20:43 2021 +0000
description:
lint: do not modify curr_pos in check_global_symbols
No functional change.
diffstat:
usr.bin/xlint/lint1/decl.c | 24 ++++++++----------------
1 files changed, 8 insertions(+), 16 deletions(-)
diffs (87 lines):
diff -r 213fa8b82a43 -r e9efc7c27101 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Sun Apr 18 09:15:16 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c Sun Apr 18 09:20:43 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.175 2021/04/18 09:15:16 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.176 2021/04/18 09:20:43 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.175 2021/04/18 09:15:16 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.176 2021/04/18 09:20:43 rillig Exp $");
#endif
#include <sys/param.h>
@@ -3172,13 +3172,10 @@
check_global_symbols(void)
{
sym_t *sym;
- pos_t cpos;
if (block_level != 0 || dcs->d_next != NULL)
norecover();
- cpos = curr_pos;
-
for (sym = dcs->d_dlsyms; sym != NULL; sym = sym->s_dlnxt) {
if (sym->s_block_level == -1)
continue;
@@ -3190,29 +3187,26 @@
lint_assert(sym->s_kind == FMEMBER);
}
}
-
- curr_pos = cpos;
}
static void
check_unused_static_global_variable(const sym_t *sym)
{
- curr_pos = sym->s_def_pos;
if (sym->s_type->t_tspec == FUNC) {
if (sym->s_def == DEF) {
if (!sym->s_inline)
/* static function %s unused */
- warning(236, sym->s_name);
+ warning_at(236, sym->s_def_pos, sym->s_name);
} else {
/* static function %s declared but not defined */
- warning(290, sym->s_name);
+ warning_at(290, sym->s_def_pos, sym->s_name);
}
} else if (!sym->s_set) {
/* static variable %s unused */
- warning(226, sym->s_name);
+ warning_at(226, sym->s_def_pos, sym->s_name);
} else {
/* static variable %s set but not used */
- warning(307, sym->s_name);
+ warning_at(307, sym->s_def_pos, sym->s_name);
}
}
@@ -3220,18 +3214,16 @@
check_static_global_variable(const sym_t *sym)
{
if (sym->s_type->t_tspec == FUNC && sym->s_used && sym->s_def != DEF) {
- curr_pos = sym->s_use_pos;
/* static function called but not defined: %s() */
- error(225, sym->s_name);
+ error_at(225, sym->s_use_pos, sym->s_name);
}
if (!sym->s_used)
check_unused_static_global_variable(sym);
if (!tflag && sym->s_def == TDEF && sym->s_type->t_const) {
- curr_pos = sym->s_def_pos;
/* const object %s should have initializer */
- warning(227, sym->s_name);
+ warning_at(227, sym->s_def_pos, sym->s_name);
}
}
Home |
Main Index |
Thread Index |
Old Index