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: migrate check_tag_usage to warning_at
details: https://anonhg.NetBSD.org/src/rev/49c878a4f638
branches: trunk
changeset: 961404:49c878a4f638
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Apr 18 09:07:36 2021 +0000
description:
lint: migrate check_tag_usage to warning_at
This one is already a little trickier since it does not restore the
original curr_pos. This function is only called in a few places, and
these either restore curr_pos themselves or only call functions
afterwards that immediately overwrite curr_pos.
Except for lint_assert, which may now report a different location.
The call to check_global_variable that is related to check_tag_usage was
the function that started this whole refactoring since its lint_assert
reported a completely wrong location when using a compound literal in an
initializer expression at block level 0.
diffstat:
usr.bin/xlint/lint1/decl.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diffs (41 lines):
diff -r 7b9f5f5d7a64 -r 49c878a4f638 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Sun Apr 18 08:57:57 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c Sun Apr 18 09:07:36 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.173 2021/04/18 08:57:57 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.174 2021/04/18 09:07:36 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.173 2021/04/18 08:57:57 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.174 2021/04/18 09:07:36 rillig Exp $");
#endif
#include <sys/param.h>
@@ -3142,19 +3142,18 @@
if (!zflag || dcs->d_ctx != EXTERN)
return;
- curr_pos = sym->s_def_pos;
switch (sym->s_type->t_tspec) {
case STRUCT:
/* struct %s never defined */
- warning(233, sym->s_name);
+ warning_at(233, sym->s_def_pos, sym->s_name);
break;
case UNION:
/* union %s never defined */
- warning(234, sym->s_name);
+ warning_at(234, sym->s_def_pos, sym->s_name);
break;
case ENUM:
/* enum %s never defined */
- warning(235, sym->s_name);
+ warning_at(235, sym->s_def_pos, sym->s_name);
break;
default:
lint_assert(/*CONSTCOND*/false);
Home |
Main Index |
Thread Index |
Old Index