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: un-abbreviate unsigned integer types
details: https://anonhg.NetBSD.org/src/rev/705660a0cb0e
branches: trunk
changeset: 1023160:705660a0cb0e
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Aug 28 12:21:53 2021 +0000
description:
lint: un-abbreviate unsigned integer types
No functional change.
diffstat:
usr.bin/xlint/lint1/decl.c | 12 ++++++------
usr.bin/xlint/lint1/emit1.c | 6 +++---
usr.bin/xlint/lint1/func.c | 6 +++---
usr.bin/xlint/lint1/lex.c | 18 +++++++++---------
usr.bin/xlint/lint1/lint1.h | 18 +++++++++---------
usr.bin/xlint/lint1/tree.c | 16 +++++++++-------
usr.bin/xlint/lint2/hash.c | 16 ++++++++--------
usr.bin/xlint/lint2/lint2.h | 18 +++++++++---------
usr.bin/xlint/lint2/msg.c | 6 +++---
usr.bin/xlint/lint2/read.c | 42 +++++++++++++++++++++---------------------
10 files changed, 80 insertions(+), 78 deletions(-)
diffs (truncated from 550 to 300 lines):
diff -r 020a9d1e8d94 -r 705660a0cb0e usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Sat Aug 28 12:06:08 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c Sat Aug 28 12:21:53 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.223 2021/08/28 12:06:08 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.224 2021/08/28 12:21:53 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.223 2021/08/28 12:06:08 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.224 2021/08/28 12:21:53 rillig Exp $");
#endif
#include <sys/param.h>
@@ -64,7 +64,7 @@
static type_t *tdeferr(type_t *, tspec_t);
static void settdsym(type_t *, sym_t *);
-static void align(u_int, u_int);
+static void align(unsigned int, unsigned int);
static sym_t *newtag(sym_t *, scl_t, bool, bool);
static bool eqargs(const type_t *, const type_t *, bool *);
static bool mnoarg(const type_t *, bool *);
@@ -1180,7 +1180,7 @@
type_t *tp;
tspec_t t;
int sz;
- u_int o = 0; /* Appease GCC */
+ unsigned int o = 0; /* Appease GCC */
lint_assert(dsym->s_scl == MOS || dsym->s_scl == MOU);
@@ -1257,9 +1257,9 @@
* al contains the required alignment, len the length of a bit-field.
*/
static void
-align(u_int al, u_int len)
+align(unsigned int al, unsigned int len)
{
- u_int no;
+ unsigned int no;
/*
* The alignment of the current element becomes the alignment of
diff -r 020a9d1e8d94 -r 705660a0cb0e usr.bin/xlint/lint1/emit1.c
--- a/usr.bin/xlint/lint1/emit1.c Sat Aug 28 12:06:08 2021 +0000
+++ b/usr.bin/xlint/lint1/emit1.c Sat Aug 28 12:21:53 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.50 2021/08/23 06:21:59 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.51 2021/08/28 12:21:53 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.50 2021/08/23 06:21:59 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.51 2021/08/28 12:21:53 rillig Exp $");
#endif
#include "lint1.h"
@@ -462,7 +462,7 @@
{
unsigned char c, oc;
bool first;
- u_char *cp;
+ unsigned char *cp;
lint_assert(strg->st_tspec == CHAR);
diff -r 020a9d1e8d94 -r 705660a0cb0e usr.bin/xlint/lint1/func.c
--- a/usr.bin/xlint/lint1/func.c Sat Aug 28 12:06:08 2021 +0000
+++ b/usr.bin/xlint/lint1/func.c Sat Aug 28 12:21:53 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: func.c,v 1.120 2021/08/22 13:52:19 rillig Exp $ */
+/* $NetBSD: func.c,v 1.121 2021/08/28 12:21:53 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.120 2021/08/22 13:52:19 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.121 2021/08/28 12:21:53 rillig Exp $");
#endif
#include <stdlib.h>
@@ -541,7 +541,7 @@
}
if (cl != NULL && is_uinteger(nv.v_tspec)) {
/* duplicate case in switch: %lu */
- error(200, (u_long)nv.v_quad);
+ error(200, (unsigned long)nv.v_quad);
} else if (cl != NULL) {
/* duplicate case in switch: %ld */
error(199, (long)nv.v_quad);
diff -r 020a9d1e8d94 -r 705660a0cb0e usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Sat Aug 28 12:06:08 2021 +0000
+++ b/usr.bin/xlint/lint1/lex.c Sat Aug 28 12:21:53 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.70 2021/08/25 22:48:40 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.71 2021/08/28 12:21:53 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: lex.c,v 1.70 2021/08/25 22:48:40 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.71 2021/08/28 12:21:53 rillig Exp $");
#endif
#include <ctype.h>
@@ -72,7 +72,7 @@
static sbuf_t *allocsb(void);
static void freesb(sbuf_t *);
static int inpc(void);
-static u_int hash(const char *);
+static unsigned int hash(const char *);
static sym_t * search(sbuf_t *);
static int keyw(sym_t *);
static int get_escaped_char(int);
@@ -393,14 +393,14 @@
return c;
}
-static u_int
+static unsigned int
hash(const char *s)
{
- u_int v;
- const u_char *us;
+ unsigned int v;
+ const unsigned char *us;
v = 0;
- for (us = (const u_char *)s; *us != '\0'; us++) {
+ for (us = (const unsigned char *)s; *us != '\0'; us++) {
v = (v << sizeof(v)) + *us;
v ^= v >> (sizeof(v) * CHAR_BIT - sizeof(v));
}
@@ -460,7 +460,7 @@
static sym_t *
search(sbuf_t *sb)
{
- u_int h;
+ unsigned int h;
sym_t *sym;
const struct kwtab *kw;
@@ -1276,7 +1276,7 @@
int
lex_string(void)
{
- u_char *s;
+ unsigned char *s;
int c;
size_t len, max;
strg_t *strg;
diff -r 020a9d1e8d94 -r 705660a0cb0e usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h Sat Aug 28 12:06:08 2021 +0000
+++ b/usr.bin/xlint/lint1/lint1.h Sat Aug 28 12:21:53 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.125 2021/08/23 17:03:23 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.126 2021/08/28 12:21:53 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -89,8 +89,8 @@
tspec_t st_tspec; /* CHAR or WCHAR */
size_t st_len; /* length without trailing NUL */
union {
- u_char *_st_cp;
- wchar_t *_st_wcp;
+ unsigned char *_st_cp;
+ wchar_t *_st_wcp;
} st_u;
} strg_t;
@@ -134,8 +134,8 @@
* the structure type in pass 2.
*/
typedef struct {
- u_int sou_size_in_bits;
- u_short sou_align_in_bits;
+ unsigned int sou_size_in_bits;
+ unsigned short sou_align_in_bits;
bool sou_incomplete : 1;
struct sym *sou_first_member;
struct sym *sou_tag;
@@ -183,8 +183,8 @@
struct sym *_t_args; /* arguments (if t_proto) */
} t_u;
struct {
- u_int _t_flen : 8; /* length of bit-field */
- u_int _t_foffs : 24; /* offset of bit-field */
+ unsigned int _t_flen : 8; /* length of bit-field */
+ unsigned int _t_foffs : 24; /* offset of bit-field */
} t_b;
struct lint1_type *t_subt; /* element type (if ARRAY),
* return value (if FUNC),
@@ -361,8 +361,8 @@
type_t *d_type; /* after end_type() pointer to the type used
for all declarators */
sym_t *d_redeclared_symbol;
- u_int d_offset; /* offset of next structure member */
- u_short d_sou_align_in_bits; /* alignment required for current
+ unsigned int d_offset; /* offset of next structure member */
+ unsigned short d_sou_align_in_bits; /* alignment required for current
* structure */
scl_t d_ctx; /* context of declaration */
bool d_const : 1; /* const in declaration specifiers */
diff -r 020a9d1e8d94 -r 705660a0cb0e usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c Sat Aug 28 12:06:08 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c Sat Aug 28 12:21:53 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.352 2021/08/25 22:00:26 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.353 2021/08/28 12:21:53 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.352 2021/08/25 22:00:26 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.353 2021/08/28 12:21:53 rillig Exp $");
#endif
#include <float.h>
@@ -1761,7 +1761,7 @@
{
tspec_t t;
type_t *ntp;
- u_int len;
+ unsigned int len;
t = tn->tn_type->t_tspec;
@@ -2215,11 +2215,11 @@
case INT:
max = TARG_INT_MAX; min = TARG_INT_MIN; break;
case UINT:
- max = (u_int)TARG_UINT_MAX;min = 0; break;
+ max = (unsigned int)TARG_UINT_MAX; min = 0; break;
case LONG:
max = TARG_LONG_MAX; min = TARG_LONG_MIN; break;
case ULONG:
- max = (u_long)TARG_ULONG_MAX; min = 0; break;
+ max = (unsigned long)TARG_ULONG_MAX; min = 0; break;
case QUAD:
max = QUAD_MAX; min = QUAD_MIN; break;
case UQUAD:
@@ -4224,9 +4224,11 @@
* struct foo {
* unsigned char a;
* } f = {
- * (u_char)(u_long)(&(((struct foo *)0)->a))
+ * (unsigned char)(unsigned long)
+ * (&(((struct foo *)0)->a))
* };
- * since psize(u_long) != psize(u_char) this fails.
+ * since psize(unsigned long) != psize(unsigned char),
+ * this fails.
*/
else if (psize(t) != psize(ot))
return -1;
diff -r 020a9d1e8d94 -r 705660a0cb0e usr.bin/xlint/lint2/hash.c
--- a/usr.bin/xlint/lint2/hash.c Sat Aug 28 12:06:08 2021 +0000
+++ b/usr.bin/xlint/lint2/hash.c Sat Aug 28 12:21:53 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hash.c,v 1.16 2021/08/22 13:12:39 rillig Exp $ */
+/* $NetBSD: hash.c,v 1.17 2021/08/28 12:21:53 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: hash.c,v 1.16 2021/08/22 13:12:39 rillig Exp $");
+__RCSID("$NetBSD: hash.c,v 1.17 2021/08/28 12:21:53 rillig Exp $");
#endif
/*
@@ -54,7 +54,7 @@
/* pointer to hash table, initialized in inithash() */
static hte_t **htab;
-static u_int hash(const char *);
+static unsigned int hash(const char *);
/*
Home |
Main Index |
Thread Index |
Old Index