Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/xlint lint: miscellaneous clean-ups
details: https://anonhg.NetBSD.org/src/rev/a0ef19b5b380
branches: trunk
changeset: 376294:a0ef19b5b380
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Jun 09 15:36:31 2023 +0000
description:
lint: miscellaneous clean-ups
No binary change, except for line numbers in assertions.
diffstat:
usr.bin/xlint/common/param.h | 11 +----------
usr.bin/xlint/lint1/decl.c | 10 +++++-----
usr.bin/xlint/lint1/emit1.c | 40 +++++++++-------------------------------
usr.bin/xlint/lint1/err.c | 8 ++++----
usr.bin/xlint/lint1/func.c | 11 +++++------
usr.bin/xlint/lint1/lex.c | 6 +++---
usr.bin/xlint/lint1/lint1.h | 8 ++++----
usr.bin/xlint/lint1/tree.c | 34 +++++++++++++++++-----------------
8 files changed, 48 insertions(+), 80 deletions(-)
diffs (truncated from 451 to 300 lines):
diff -r c0662f2e18df -r a0ef19b5b380 usr.bin/xlint/common/param.h
--- a/usr.bin/xlint/common/param.h Fri Jun 09 13:31:11 2023 +0000
+++ b/usr.bin/xlint/common/param.h Fri Jun 09 15:36:31 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.10 2023/01/14 09:21:58 rillig Exp $ */
+/* $NetBSD: param.h,v 1.11 2023/06/09 15:36:31 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -53,12 +53,3 @@
* Make sure this matches wchar_t.
*/
#define WCHAR INT
-
-/*
- * The sparc64 long double code generation is broken in old gcc.
- */
-#if !(defined(__sparc64__) && defined(__GNUC__) && __GNUC__ <= 2)
-typedef long double ldbl_t;
-#else
-typedef double ldbl_t;
-#endif
diff -r c0662f2e18df -r a0ef19b5b380 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Fri Jun 09 13:31:11 2023 +0000
+++ b/usr.bin/xlint/lint1/decl.c Fri Jun 09 15:36:31 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.316 2023/06/09 13:03:49 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.317 2023/06/09 15:36:31 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.316 2023/06/09 13:03:49 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.317 2023/06/09 15:36:31 rillig Exp $");
#endif
#include <sys/param.h>
@@ -1601,7 +1601,7 @@ declarator_name(sym_t *sym)
case DK_AUTO:
if ((sc = dcs->d_scl) == NOSCL) {
/*
- * XXX somewhat ugly because we dont know whether
+ * XXX somewhat ugly because we don't know whether
* this is AUTO or EXTERN (functions). If we are
* wrong it must be corrected in declare_local(),
* where we have the necessary type information.
@@ -1893,7 +1893,7 @@ enumeration_constant(sym_t *sym, int val
/* redeclaration of '%s' */
error(27, sym->s_name);
/*
- * inside blocks it should not be too
+ * Inside blocks, it should not be too
* complicated to find the position of the
* previous declaration
*/
@@ -2845,7 +2845,7 @@ declare_external_in_block(sym_t *dsym)
if (compatible) {
/*
- * Remember the external symbol so we can update usage
+ * Remember the external symbol, so we can update usage
* information at the end of the block.
*/
dsym->s_ext_sym = esym;
diff -r c0662f2e18df -r a0ef19b5b380 usr.bin/xlint/lint1/emit1.c
--- a/usr.bin/xlint/lint1/emit1.c Fri Jun 09 13:31:11 2023 +0000
+++ b/usr.bin/xlint/lint1/emit1.c Fri Jun 09 15:36:31 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.67 2023/06/09 13:03:49 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.68 2023/06/09 15:36:31 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: emit1.c,v 1.67 2023/06/09 13:03:49 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.68 2023/06/09 15:36:31 rillig Exp $");
#endif
#include "lint1.h"
@@ -193,12 +193,8 @@ outsym(const sym_t *sym, scl_t sc, def_t
/* reset buffer */
outclr();
- /*
- * line number of .c source, 'd' for declaration, Id of current
- * source (.c or .h), and line in current source.
- */
outint(csrc_pos.p_line);
- outchar('d');
+ outchar('d'); /* declaration */
outint(get_filename_id(sym->s_def_pos.p_file));
outchar('.');
outint(sym->s_def_pos.p_line);
@@ -239,10 +235,8 @@ outsym(const sym_t *sym, scl_t sc, def_t
}
/*
- * write information about function definition
- *
- * this is also done for static functions so we are able to check if
- * they are called with proper argument types
+ * Write information about a function definition. This is also done for static
+ * functions, to later check if they are called with proper argument types.
*/
void
outfdef(const sym_t *fsym, const pos_t *posp, bool rval, bool osdef,
@@ -254,20 +248,12 @@ outfdef(const sym_t *fsym, const pos_t *
/* reset the buffer */
outclr();
- /*
- * line number of .c source, 'd' for declaration, Id of current
- * source (.c or .h), and line in current source
- *
- * we are already at the end of the function. If we are in the
- * .c source, posp->p_line is correct, otherwise csrc_pos.p_line
- * (for functions defined in header files).
- */
if (posp->p_file == csrc_pos.p_file) {
outint(posp->p_line);
} else {
outint(csrc_pos.p_line);
}
- outchar('d');
+ outchar('d'); /* declaration */
outint(get_filename_id(posp->p_file));
outchar('.');
outint(posp->p_line);
@@ -359,12 +345,8 @@ outcall(const tnode_t *tn, bool retval_u
/* reset buffer */
outclr();
- /*
- * line number of .c source, 'c' for function call, Id of current
- * source (.c or .h), and line in current source
- */
outint(csrc_pos.p_line);
- outchar('c');
+ outchar('c'); /* function call */
outint(get_filename_id(curr_pos.p_file));
outchar('.');
outint(curr_pos.p_line);
@@ -587,18 +569,14 @@ outfstrg(strg_t *strg)
void
outusg(const sym_t *sym)
{
- if (ch_isdigit(sym->s_name[0])) /* 00000000_tmp */
+ if (ch_isdigit(sym->s_name[0])) /* 00000000_tmp, from mktempsym */
return;
/* reset buffer */
outclr();
- /*
- * line number of .c source, 'u' for used, Id of current
- * source (.c or .h), and line in current source
- */
outint(csrc_pos.p_line);
- outchar('u');
+ outchar('u'); /* used */
outint(get_filename_id(curr_pos.p_file));
outchar('.');
outint(curr_pos.p_line);
diff -r c0662f2e18df -r a0ef19b5b380 usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Fri Jun 09 13:31:11 2023 +0000
+++ b/usr.bin/xlint/lint1/err.c Fri Jun 09 15:36:31 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: err.c,v 1.198 2023/06/09 13:03:49 rillig Exp $ */
+/* $NetBSD: err.c,v 1.199 2023/06/09 15:36:31 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: err.c,v 1.198 2023/06/09 13:03:49 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.199 2023/06/09 15:36:31 rillig Exp $");
#endif
#include <limits.h>
@@ -435,7 +435,7 @@ suppress_messages(const char *p)
if (*end == '\0')
return;
}
- errx(1, "invalid message ID '%.*s'", (int)(strcspn(p, ",")), p);
+ errx(1, "invalid message ID '%.*s'", (int)strcspn(p, ","), p);
}
void
@@ -746,5 +746,5 @@ enable_queries(const char *p)
if (*end == '\0')
return;
}
- errx(1, "invalid query ID '%.*s'", (int)(strcspn(p, ",")), p);
+ errx(1, "invalid query ID '%.*s'", (int)strcspn(p, ","), p);
}
diff -r c0662f2e18df -r a0ef19b5b380 usr.bin/xlint/lint1/func.c
--- a/usr.bin/xlint/lint1/func.c Fri Jun 09 13:31:11 2023 +0000
+++ b/usr.bin/xlint/lint1/func.c Fri Jun 09 15:36:31 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: func.c,v 1.155 2023/06/09 13:03:49 rillig Exp $ */
+/* $NetBSD: func.c,v 1.156 2023/06/09 15:36:31 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: func.c,v 1.155 2023/06/09 13:03:49 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.156 2023/06/09 15:36:31 rillig Exp $");
#endif
#include <stdlib.h>
@@ -287,8 +287,7 @@ begin_function(sym_t *fsym)
/*
* We must also remember the position. s_def_pos is overwritten
- * if this is an old-style definition and we had already a
- * prototype.
+ * if this is an old-style definition, and we had already a prototype.
*/
dcs->d_func_def_pos = fsym->s_def_pos;
@@ -380,7 +379,7 @@ end_function(void)
/*
* This warning is printed only if the return value was implicitly
- * declared to be int. Otherwise the wrong return statement
+ * declared to be int. Otherwise, the wrong return statement
* has already printed a warning.
*/
if (cstmt->c_had_return_noval && cstmt->c_had_return_value &&
@@ -1363,7 +1362,7 @@ bitfieldtype(int n)
/*
* PROTOLIB in conjunction with LINTLIBRARY can be used to handle
* prototypes like function definitions. This is done if the argument
- * to PROTOLIB is nonzero. Otherwise prototypes are handled normally.
+ * to PROTOLIB is nonzero. Otherwise, prototypes are handled normally.
*/
void
protolib(int n)
diff -r c0662f2e18df -r a0ef19b5b380 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Fri Jun 09 13:31:11 2023 +0000
+++ b/usr.bin/xlint/lint1/lex.c Fri Jun 09 15:36:31 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.159 2023/06/09 13:03:49 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.160 2023/06/09 15:36:31 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.159 2023/06/09 13:03:49 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.160 2023/06/09 15:36:31 rillig Exp $");
#endif
#include <ctype.h>
@@ -1115,7 +1115,7 @@ lex_comment(void)
}
}
arg[l] = '\0';
- a = l != 0 ? atoi(arg) : -1;
+ a = l != 0 ? (int)atoi(arg) : -1;
/* skip whitespace after the argument */
while (isspace(c))
diff -r c0662f2e18df -r a0ef19b5b380 usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h Fri Jun 09 13:31:11 2023 +0000
+++ b/usr.bin/xlint/lint1/lint1.h Fri Jun 09 15:36:31 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.164 2023/04/22 17:49:15 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.165 2023/06/09 15:36:31 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -110,8 +110,8 @@ typedef struct {
*/
bool v_unsigned_since_c90;
union {
- int64_t _v_quad; /* integers */
- ldbl_t _v_ldbl; /* floats */
+ int64_t _v_quad; /* integers */
+ long double _v_ldbl; /* floats */
} v_u;
} val_t;
@@ -375,7 +375,7 @@ typedef struct dinfo {
bool d_nonempty_decl:1; /* if at least one tag is declared
* ... in the current function decl. */
bool d_vararg:1;
Home |
Main Index |
Thread Index |
Old Index