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: rename prflstrg to printflike_argn...
details: https://anonhg.NetBSD.org/src/rev/22f7e02ff7fe
branches: trunk
changeset: 1017664:22f7e02ff7fe
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jan 03 20:14:38 2021 +0000
description:
lint: rename prflstrg to printflike_argnum, likewise for scflstrg
diffstat:
usr.bin/xlint/lint1/decl.c | 37 ++++++++++++++++++++-----------------
usr.bin/xlint/lint1/emit1.c | 22 +++++++++++-----------
usr.bin/xlint/lint1/externs1.h | 6 +++---
usr.bin/xlint/lint1/func.c | 30 +++++++++++++++---------------
4 files changed, 49 insertions(+), 46 deletions(-)
diffs (249 lines):
diff -r 4cec6c38346f -r 22f7e02ff7fe usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Sun Jan 03 20:04:08 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c Sun Jan 03 20:14:38 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.109 2021/01/03 19:15:36 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.110 2021/01/03 20:14:38 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.109 2021/01/03 19:15:36 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.110 2021/01/03 20:14:38 rillig Exp $");
#endif
#include <sys/param.h>
@@ -2389,14 +2389,16 @@
tspec_t t;
/* check for illegal combinations of lint directives */
- if (prflstrg != -1 && scflstrg != -1) {
+ if (printflike_argnum != -1 && scanflike_argnum != -1) {
/* can't be used together: ** PRINTFLIKE ** ** SCANFLIKE ** */
warning(289);
- prflstrg = scflstrg = -1;
+ printflike_argnum = scanflike_argnum = -1;
}
- if (nvararg != -1 && (prflstrg != -1 || scflstrg != -1)) {
+ if (nvararg != -1 &&
+ (printflike_argnum != -1 || scanflike_argnum != -1)) {
/* dubious use of ** VARARGS ** with ** %s ** */
- warning(288, prflstrg != -1 ? "PRINTFLIKE" : "SCANFLIKE");
+ warning(288,
+ printflike_argnum != -1 ? "PRINTFLIKE" : "SCANFLIKE");
nvararg = -1;
}
@@ -2417,22 +2419,23 @@
warning(283, "VARARGS");
nvararg = 0;
}
- if (prflstrg > narg) {
+ if (printflike_argnum > narg) {
/* argument number mismatch with directive: ** %s ** */
warning(283, "PRINTFLIKE");
- prflstrg = -1;
- } else if (prflstrg == 0) {
- prflstrg = -1;
+ printflike_argnum = -1;
+ } else if (printflike_argnum == 0) {
+ printflike_argnum = -1;
}
- if (scflstrg > narg) {
+ if (scanflike_argnum > narg) {
/* argument number mismatch with directive: ** %s ** */
warning(283, "SCANFLIKE");
- scflstrg = -1;
- } else if (scflstrg == 0) {
- scflstrg = -1;
+ scanflike_argnum = -1;
+ } else if (scanflike_argnum == 0) {
+ scanflike_argnum = -1;
}
- if (prflstrg != -1 || scflstrg != -1) {
- narg = prflstrg != -1 ? prflstrg : scflstrg;
+ if (printflike_argnum != -1 || scanflike_argnum != -1) {
+ narg = printflike_argnum != -1
+ ? printflike_argnum : scanflike_argnum;
arg = dcs->d_fargs;
for (n = 1; n < narg; n++)
arg = arg->s_next;
@@ -2441,7 +2444,7 @@
t != UCHAR && t != SCHAR)) {
/* arg. %d must be 'char *' for PRINTFLIKE/SCANFLIKE */
warning(293, narg);
- prflstrg = scflstrg = -1;
+ printflike_argnum = scanflike_argnum = -1;
}
}
}
diff -r 4cec6c38346f -r 22f7e02ff7fe usr.bin/xlint/lint1/emit1.c
--- a/usr.bin/xlint/lint1/emit1.c Sun Jan 03 20:04:08 2021 +0000
+++ b/usr.bin/xlint/lint1/emit1.c Sun Jan 03 20:14:38 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.32 2021/01/02 18:26:44 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.33 2021/01/03 20:14:38 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: emit1.c,v 1.32 2021/01/02 18:26:44 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.33 2021/01/03 20:14:38 rillig Exp $");
#endif
#include <ctype.h>
@@ -330,25 +330,25 @@
/* flags */
/* both SCANFLIKE and PRINTFLIKE imply VARARGS */
- if (prflstrg != -1) {
- nvararg = prflstrg;
- } else if (scflstrg != -1) {
- nvararg = scflstrg;
+ if (printflike_argnum != -1) {
+ nvararg = printflike_argnum;
+ } else if (scanflike_argnum != -1) {
+ nvararg = scanflike_argnum;
}
if (nvararg != -1) {
outchar('v');
outint(nvararg);
}
- if (scflstrg != -1) {
+ if (scanflike_argnum != -1) {
outchar('S');
- outint(scflstrg);
+ outint(scanflike_argnum);
}
- if (prflstrg != -1) {
+ if (printflike_argnum != -1) {
outchar('P');
- outint(prflstrg);
+ outint(printflike_argnum);
}
- nvararg = prflstrg = scflstrg = -1;
+ nvararg = printflike_argnum = scanflike_argnum = -1;
outchar('d');
diff -r 4cec6c38346f -r 22f7e02ff7fe usr.bin/xlint/lint1/externs1.h
--- a/usr.bin/xlint/lint1/externs1.h Sun Jan 03 20:04:08 2021 +0000
+++ b/usr.bin/xlint/lint1/externs1.h Sun Jan 03 20:14:38 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: externs1.h,v 1.45 2021/01/03 17:42:45 rillig Exp $ */
+/* $NetBSD: externs1.h,v 1.46 2021/01/03 20:14:38 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -232,9 +232,9 @@
extern pos_t argsused_pos;
extern int nvararg;
extern pos_t vapos;
-extern int prflstrg;
+extern int printflike_argnum;
extern pos_t printflike_pos;
-extern int scflstrg;
+extern int scanflike_argnum;
extern pos_t scanflike_pos;
extern int constcond_flag;
extern int llibflg;
diff -r 4cec6c38346f -r 22f7e02ff7fe usr.bin/xlint/lint1/func.c
--- a/usr.bin/xlint/lint1/func.c Sun Jan 03 20:04:08 2021 +0000
+++ b/usr.bin/xlint/lint1/func.c Sun Jan 03 20:14:38 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: func.c,v 1.48 2021/01/03 20:04:08 rillig Exp $ */
+/* $NetBSD: func.c,v 1.49 2021/01/03 20:14:38 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: func.c,v 1.48 2021/01/03 20:04:08 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.49 2021/01/03 20:14:38 rillig Exp $");
#endif
#include <stdlib.h>
@@ -97,15 +97,15 @@
pos_t vapos;
/*
- * Both prflstr and scflstrg contain the number of the argument which
- * shall be used to check the types of remaining arguments (for PRINTFLIKE
- * and SCANFLIKE).
+ * Both printflike_argnum and scanflike_argnum contain the 1-based number
+ * of the string argument which shall be used to check the types of remaining
+ * arguments (for PRINTFLIKE and SCANFLIKE).
*
* printflike_pos and scanflike_pos are the positions of the last PRINTFLIKE
* or SCANFLIKE comment.
*/
-int prflstrg = -1;
-int scflstrg = -1;
+int printflike_argnum = -1;
+int scanflike_argnum = -1;
pos_t printflike_pos;
pos_t scanflike_pos;
@@ -1061,21 +1061,21 @@
}
nvararg = -1;
}
- if (prflstrg != -1) {
+ if (printflike_argnum != -1) {
if (!silent) {
curr_pos = printflike_pos;
/* must precede function definition: ** %s ** */
warning(282, "PRINTFLIKE");
}
- prflstrg = -1;
+ printflike_argnum = -1;
}
- if (scflstrg != -1) {
+ if (scanflike_argnum != -1) {
if (!silent) {
curr_pos = scanflike_pos;
/* must precede function definition: ** %s ** */
warning(282, "SCANFLIKE");
}
- scflstrg = -1;
+ scanflike_argnum = -1;
}
curr_pos = cpos;
@@ -1153,11 +1153,11 @@
warning(280, "PRINTFLIKE");
return;
}
- if (prflstrg != -1) {
+ if (printflike_argnum != -1) {
/* duplicate use of ** %s ** */
warning(281, "PRINTFLIKE");
}
- prflstrg = n;
+ printflike_argnum = n;
printflike_pos = curr_pos;
}
@@ -1179,11 +1179,11 @@
warning(280, "SCANFLIKE");
return;
}
- if (scflstrg != -1) {
+ if (scanflike_argnum != -1) {
/* duplicate use of ** %s ** */
warning(281, "SCANFLIKE");
}
- scflstrg = n;
+ scanflike_argnum = n;
scanflike_pos = curr_pos;
}
Home |
Main Index |
Thread Index |
Old Index