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: pass pos_t via const pointer
details: https://anonhg.NetBSD.org/src/rev/3b50e5636207
branches: trunk
changeset: 982612:3b50e5636207
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Apr 18 17:36:18 2021 +0000
description:
lint: pass pos_t via const pointer
Thanks for the suggestion, christos@.
diffstat:
usr.bin/xlint/lint1/ckgetopt.c | 6 ++--
usr.bin/xlint/lint1/decl.c | 44 +++++++++++++++++++++---------------------
usr.bin/xlint/lint1/err.c | 44 +++++++++++++++++++++---------------------
usr.bin/xlint/lint1/externs1.h | 8 +++---
usr.bin/xlint/lint1/func.c | 12 +++++-----
5 files changed, 57 insertions(+), 57 deletions(-)
diffs (truncated from 409 to 300 lines):
diff -r e57da059a5f6 -r 3b50e5636207 usr.bin/xlint/lint1/ckgetopt.c
--- a/usr.bin/xlint/lint1/ckgetopt.c Sun Apr 18 14:01:29 2021 +0000
+++ b/usr.bin/xlint/lint1/ckgetopt.c Sun Apr 18 17:36:18 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ckgetopt.c,v 1.8 2021/04/18 08:53:35 rillig Exp $ */
+/* $NetBSD: ckgetopt.c,v 1.9 2021/04/18 17:36:18 rillig Exp $ */
/*-
* Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: ckgetopt.c,v 1.8 2021/04/18 08:53:35 rillig Exp $");
+__RCSID("$NetBSD: ckgetopt.c,v 1.9 2021/04/18 17:36:18 rillig Exp $");
#endif
#include <stdbool.h>
@@ -135,7 +135,7 @@
continue;
/* option '%c' should be handled in the switch */
- warning_at(338, ck.options_pos, *opt);
+ warning_at(338, &ck.options_pos, *opt);
}
}
diff -r e57da059a5f6 -r 3b50e5636207 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Sun Apr 18 14:01:29 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c Sun Apr 18 17:36:18 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.177 2021/04/18 09:37:18 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.178 2021/04/18 17:36:18 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.177 2021/04/18 09:37:18 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.178 2021/04/18 17:36:18 rillig Exp $");
#endif
#include <sys/param.h>
@@ -3033,7 +3033,7 @@
if (!arg->s_used && vflag) {
/* argument '%s' unused in function '%s' */
- warning_at(231, arg->s_def_pos, arg->s_name, funcsym->s_name);
+ warning_at(231, &arg->s_def_pos, arg->s_name, funcsym->s_name);
}
}
@@ -3065,17 +3065,17 @@
if (sc == EXTERN) {
if (!sym->s_used && !sym->s_set) {
/* '%s' unused in function '%s' */
- warning_at(192, sym->s_def_pos,
+ warning_at(192, &sym->s_def_pos,
sym->s_name, funcsym->s_name);
}
} else {
if (sym->s_set && !sym->s_used) {
/* '%s' set but not used in function '%s' */
- warning_at(191, sym->s_set_pos,
+ warning_at(191, &sym->s_set_pos,
sym->s_name, funcsym->s_name);
} else if (!sym->s_used) {
/* '%s' unused in function '%s' */
- warning_at(192, sym->s_def_pos,
+ warning_at(192, &sym->s_def_pos,
sym->s_name, funcsym->s_name);
}
}
@@ -3113,10 +3113,10 @@
if (lab->s_set && !lab->s_used) {
/* label %s unused in function %s */
- warning_at(232, lab->s_set_pos, lab->s_name, funcsym->s_name);
+ warning_at(232, &lab->s_set_pos, lab->s_name, funcsym->s_name);
} else if (!lab->s_set) {
/* undefined label %s */
- warning_at(23, lab->s_use_pos, lab->s_name);
+ warning_at(23, &lab->s_use_pos, lab->s_name);
}
}
@@ -3134,15 +3134,15 @@
switch (sym->s_type->t_tspec) {
case STRUCT:
/* struct %s never defined */
- warning_at(233, sym->s_def_pos, sym->s_name);
+ warning_at(233, &sym->s_def_pos, sym->s_name);
break;
case UNION:
/* union %s never defined */
- warning_at(234, sym->s_def_pos, sym->s_name);
+ warning_at(234, &sym->s_def_pos, sym->s_name);
break;
case ENUM:
/* enum %s never defined */
- warning_at(235, sym->s_def_pos, sym->s_name);
+ warning_at(235, &sym->s_def_pos, sym->s_name);
break;
default:
lint_assert(/*CONSTCOND*/false);
@@ -3185,17 +3185,17 @@
if (sym->s_def == DEF) {
if (!sym->s_inline)
/* static function %s unused */
- warning_at(236, sym->s_def_pos, sym->s_name);
+ warning_at(236, &sym->s_def_pos, sym->s_name);
} else {
/* static function %s declared but not defined */
- warning_at(290, sym->s_def_pos, sym->s_name);
+ warning_at(290, &sym->s_def_pos, sym->s_name);
}
} else if (!sym->s_set) {
/* static variable %s unused */
- warning_at(226, sym->s_def_pos, sym->s_name);
+ warning_at(226, &sym->s_def_pos, sym->s_name);
} else {
/* static variable %s set but not used */
- warning_at(307, sym->s_def_pos, sym->s_name);
+ warning_at(307, &sym->s_def_pos, sym->s_name);
}
}
@@ -3204,7 +3204,7 @@
{
if (sym->s_type->t_tspec == FUNC && sym->s_used && sym->s_def != DEF) {
/* static function called but not defined: %s() */
- error_at(225, sym->s_use_pos, sym->s_name);
+ error_at(225, &sym->s_use_pos, sym->s_name);
}
if (!sym->s_used)
@@ -3212,7 +3212,7 @@
if (!tflag && sym->s_def == TDEF && sym->s_type->t_const) {
/* const object %s should have initializer */
- warning_at(227, sym->s_def_pos, sym->s_name);
+ warning_at(227, &sym->s_def_pos, sym->s_name);
}
}
@@ -3258,10 +3258,10 @@
sym->s_type->t_tspec == ARRAY && sym->s_type->t_dim == 0) {
if (tflag || (sym->s_scl == EXTERN && !sflag)) {
/* empty array declaration: %s */
- warning_at(190, sym->s_def_pos, sym->s_name);
+ warning_at(190, &sym->s_def_pos, sym->s_name);
} else {
/* empty array declaration: %s */
- error_at(190, sym->s_def_pos, sym->s_name);
+ error_at(190, &sym->s_def_pos, sym->s_name);
}
}
}
@@ -3277,13 +3277,13 @@
return;
if (msg != -1) {
- (message_at)(msg, psym->s_def_pos);
+ (message_at)(msg, &psym->s_def_pos);
} else if (psym->s_def == DEF || psym->s_def == TDEF) {
/* previous definition of %s */
- message_at(261, psym->s_def_pos, psym->s_name);
+ message_at(261, &psym->s_def_pos, psym->s_name);
} else {
/* previous declaration of %s */
- message_at(260, psym->s_def_pos, psym->s_name);
+ message_at(260, &psym->s_def_pos, psym->s_name);
}
}
diff -r e57da059a5f6 -r 3b50e5636207 usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Sun Apr 18 14:01:29 2021 +0000
+++ b/usr.bin/xlint/lint1/err.c Sun Apr 18 17:36:18 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: err.c,v 1.115 2021/04/18 10:09:49 rillig Exp $ */
+/* $NetBSD: err.c,v 1.116 2021/04/18 17:36:18 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: err.c,v 1.115 2021/04/18 10:09:49 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.116 2021/04/18 17:36:18 rillig Exp $");
#endif
#include <sys/types.h>
@@ -484,15 +484,15 @@
}
static void
-verror_at(int msgid, pos_t pos, va_list ap)
+verror_at(int msgid, const pos_t *pos, va_list ap)
{
const char *fn;
if (ERR_ISSET(msgid, &msgset))
return;
- fn = lbasename(pos.p_file);
- (void)printf("%s(%d): error: ", fn, pos.p_line);
+ fn = lbasename(pos->p_file);
+ (void)printf("%s(%d): error: ", fn, pos->p_line);
(void)vprintf(msgs[msgid], ap);
(void)printf(" [%d]\n", msgid);
nerr++;
@@ -500,7 +500,7 @@
}
static void
-vwarning_at(int msgid, pos_t pos, va_list ap)
+vwarning_at(int msgid, const pos_t *pos, va_list ap)
{
const char *fn;
@@ -514,8 +514,8 @@
/* this warning is suppressed by a LINTED comment */
return;
- fn = lbasename(pos.p_file);
- (void)printf("%s(%d): warning: ", fn, pos.p_line);
+ fn = lbasename(pos->p_file);
+ (void)printf("%s(%d): warning: ", fn, pos->p_line);
(void)vprintf(msgs[msgid], ap);
(void)printf(" [%d]\n", msgid);
if (wflag)
@@ -524,22 +524,22 @@
}
static void
-vmessage_at(int msgid, pos_t pos, va_list ap)
+vmessage_at(int msgid, const pos_t *pos, va_list ap)
{
const char *fn;
if (ERR_ISSET(msgid, &msgset))
return;
- fn = lbasename(pos.p_file);
- (void)printf("%s(%d): ", fn, pos.p_line);
+ fn = lbasename(pos->p_file);
+ (void)printf("%s(%d): ", fn, pos->p_line);
(void)vprintf(msgs[msgid], ap);
(void)printf(" [%d]\n", msgid);
print_stack_trace();
}
void
-(error_at)(int msgid, pos_t pos, ...)
+(error_at)(int msgid, const pos_t *pos, ...)
{
va_list ap;
@@ -554,7 +554,7 @@
va_list ap;
va_start(ap, msgid);
- verror_at(msgid, curr_pos, ap);
+ verror_at(msgid, &curr_pos, ap);
va_end(ap);
}
@@ -589,7 +589,7 @@
}
void
-(warning_at)(int msgid, pos_t pos, ...)
+(warning_at)(int msgid, const pos_t *pos, ...)
{
va_list ap;
@@ -604,12 +604,12 @@
va_list ap;
va_start(ap, msgid);
- vwarning_at(msgid, curr_pos, ap);
+ vwarning_at(msgid, &curr_pos, ap);
va_end(ap);
}
void
-(message_at)(int msgid, pos_t pos, ...)
+(message_at)(int msgid, const pos_t *pos, ...)
{
va_list ap;
@@ -624,7 +624,7 @@
va_list ap;
va_start(ap, msgid);
- vmessage_at(msgid, curr_pos, ap);
+ vmessage_at(msgid, &curr_pos, ap);
Home |
Main Index |
Thread Index |
Old Index