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: miscellaneous cleanup
details: https://anonhg.NetBSD.org/src/rev/44e4649d0d35
branches: trunk
changeset: 371245:44e4649d0d35
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Oct 01 10:04:06 2022 +0000
description:
lint: miscellaneous cleanup
No functional change.
diffstat:
tests/usr.bin/xlint/lint2/emit.ln | 6 +++---
tests/usr.bin/xlint/lint2/msg_001.ln | 4 ++--
usr.bin/xlint/lint1/decl.c | 23 ++++++++++++-----------
usr.bin/xlint/lint1/lex.c | 20 +++++++++-----------
usr.bin/xlint/lint1/tree.c | 5 +++--
5 files changed, 29 insertions(+), 29 deletions(-)
diffs (213 lines):
diff -r 67aa1e6c176e -r 44e4649d0d35 tests/usr.bin/xlint/lint2/emit.ln
--- a/tests/usr.bin/xlint/lint2/emit.ln Sat Oct 01 09:59:40 2022 +0000
+++ b/tests/usr.bin/xlint/lint2/emit.ln Sat Oct 01 10:04:06 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: emit.ln,v 1.5 2022/01/15 17:33:42 rillig Exp $
+# $NetBSD: emit.ln,v 1.6 2022/10/01 10:04:06 rillig Exp $
#
# Test emitting a lint library file.
@@ -25,8 +25,8 @@
122 d 0.122 e 38return_implicit_int_unknown_parameters F I
125 d 0.125 e 32extern_return_void_no_parameters F0 V
-# Function calls are not part of a library's interface, therefore they are
-# omitted from the output.
+# Function calls are written as 'c'. They are not part of a library's
+# interface, therefore they are omitted from the output.
161 c 0.161 s2"%" i 9my_printf f2 PcC PC V
# Function definitions are copied to the output.
diff -r 67aa1e6c176e -r 44e4649d0d35 tests/usr.bin/xlint/lint2/msg_001.ln
--- a/tests/usr.bin/xlint/lint2/msg_001.ln Sat Oct 01 09:59:40 2022 +0000
+++ b/tests/usr.bin/xlint/lint2/msg_001.ln Sat Oct 01 10:04:06 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: msg_001.ln,v 1.4 2021/08/24 23:38:51 rillig Exp $
+# $NetBSD: msg_001.ln,v 1.5 2022/10/01 10:04:06 rillig Exp $
#
# Test data for message 1 of lint2:
# %s defined( %s ), but never used
@@ -16,7 +16,7 @@
# extern main() {}
12 d 0.12 e 4main F I
-# If a function is declared once in old style and once with prototype,
+# If a function is declared once in old-style and once with prototype,
# the prototype definition is preferred; see chkname.
#
# extern merge_old_style_and_prototype();
diff -r 67aa1e6c176e -r 44e4649d0d35 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Sat Oct 01 09:59:40 2022 +0000
+++ b/usr.bin/xlint/lint1/decl.c Sat Oct 01 10:04:06 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.301 2022/10/01 09:59:40 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.302 2022/10/01 10:04:06 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.301 2022/10/01 09:59:40 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.302 2022/10/01 10:04:06 rillig Exp $");
#endif
#include <sys/param.h>
@@ -252,8 +252,8 @@
* dcs_end_type to build the type used for all declarators in this
* declaration.
*
- * If tp->t_typedef is 1, the type comes from a previously defined typename.
- * Otherwise it comes from a type specifier (int, long, ...) or a
+ * If tp->t_typedef is true, the type comes from a previously defined
+ * typename. Otherwise, it comes from a type specifier (int, long, ...) or a
* struct/union/enum tag.
*/
void
@@ -596,6 +596,7 @@
lint_assert(dcs->d_enclosing != NULL);
di = dcs;
dcs = di->d_enclosing;
+
switch (di->d_kind) {
case DK_MOS:
case DK_MOU:
@@ -642,7 +643,7 @@
rmsyms(di->d_dlsyms);
break;
case DK_EXTERN:
- /* there is nothing after external declarations */
+ /* there is nothing around an external declarations */
/* FALLTHROUGH */
default:
lint_assert(/*CONSTCOND*/false);
@@ -1862,11 +1863,11 @@
}
type_t *
-complete_tag_enum(type_t *tp, sym_t *fmem)
+complete_tag_enum(type_t *tp, sym_t *first_enumerator)
{
tp->t_enum->en_incomplete = false;
- tp->t_enum->en_first_enumerator = fmem;
+ tp->t_enum->en_first_enumerator = first_enumerator;
return tp;
}
@@ -2974,11 +2975,11 @@
UNIQUE_CURR_POS(sym->s_use_pos);
}
/*
- * for function calls another record is written
+ * For function calls, another record is written.
*
- * XXX Should symbols used in sizeof() be treated as used or not?
- * Probably not, because there is no sense to declare an
- * external variable only to get their size.
+ * XXX: Should symbols used in sizeof() be treated as used or not?
+ * Probably not, because there is no point in declaring an external
+ * variable only to get its size.
*/
if (!fcall && !szof && sym->s_kind == FVFT && sym->s_scl == EXTERN)
outusg(sym);
diff -r 67aa1e6c176e -r 44e4649d0d35 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Sat Oct 01 09:59:40 2022 +0000
+++ b/usr.bin/xlint/lint1/lex.c Sat Oct 01 10:04:06 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.133 2022/08/25 19:03:47 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.134 2022/10/01 10:04:06 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: lex.c,v 1.133 2022/08/25 19:03:47 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.134 2022/10/01 10:04:06 rillig Exp $");
#endif
#include <ctype.h>
@@ -636,18 +636,17 @@
/*
* Extend or truncate q to match t. If t is signed, sign-extend.
*
- * len is the number of significant bits. If len is -1, len is set
+ * len is the number of significant bits. If len is 0, len is set
* to the width of type t.
*/
int64_t
convert_integer(int64_t q, tspec_t t, unsigned int len)
{
- uint64_t vbits;
if (len == 0)
len = size_in_bits(t);
- vbits = value_bits(len);
+ uint64_t vbits = value_bits(len);
return t == PTR || is_uinteger(t) || ((q & bit(len - 1)) == 0)
? (int64_t)(q & vbits)
: (int64_t)(q | ~vbits);
@@ -710,8 +709,8 @@
errno = 0;
break;
default:
- INTERNAL_ERROR("lex_floating_constant(%s->%s)",
- cp, eptr);
+ INTERNAL_ERROR("lex_floating_constant(%.*s)",
+ (int)(eptr - cp), cp);
}
}
if (errno != 0)
@@ -729,11 +728,10 @@
yylval.y_val = xcalloc(1, sizeof(*yylval.y_val));
yylval.y_val->v_tspec = typ;
- if (typ == FLOAT) {
+ if (typ == FLOAT)
yylval.y_val->v_ldbl = f;
- } else {
+ else
yylval.y_val->v_ldbl = d;
- }
return T_CON;
}
@@ -863,7 +861,7 @@
return -2;
}
return c;
- case 0:
+ case '\0':
/* syntax error '%s' */
error(249, "EOF or null byte in literal");
return -2;
diff -r 67aa1e6c176e -r 44e4649d0d35 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c Sat Oct 01 09:59:40 2022 +0000
+++ b/usr.bin/xlint/lint1/tree.c Sat Oct 01 10:04:06 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.481 2022/10/01 09:42:40 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.482 2022/10/01 10:04:06 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.481 2022/10/01 09:42:40 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.482 2022/10/01 10:04:06 rillig Exp $");
#endif
#include <float.h>
@@ -3357,6 +3357,7 @@
return ntn;
}
+/* TODO: check for varargs */
static bool
is_cast_redundant(const tnode_t *tn)
{
Home |
Main Index |
Thread Index |
Old Index