Module Name: src Committed By: rillig Date: Sat Aug 28 12:21:53 UTC 2021
Modified Files: src/usr.bin/xlint/lint1: decl.c emit1.c func.c lex.c lint1.h tree.c src/usr.bin/xlint/lint2: hash.c lint2.h msg.c read.c Log Message: lint: un-abbreviate unsigned integer types No functional change. To generate a diff of this commit: cvs rdiff -u -r1.223 -r1.224 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.50 -r1.51 src/usr.bin/xlint/lint1/emit1.c cvs rdiff -u -r1.120 -r1.121 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.70 -r1.71 src/usr.bin/xlint/lint1/lex.c cvs rdiff -u -r1.125 -r1.126 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.352 -r1.353 src/usr.bin/xlint/lint1/tree.c cvs rdiff -u -r1.16 -r1.17 src/usr.bin/xlint/lint2/hash.c \ src/usr.bin/xlint/lint2/lint2.h cvs rdiff -u -r1.15 -r1.16 src/usr.bin/xlint/lint2/msg.c cvs rdiff -u -r1.55 -r1.56 src/usr.bin/xlint/lint2/read.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.223 src/usr.bin/xlint/lint1/decl.c:1.224 --- src/usr.bin/xlint/lint1/decl.c:1.223 Sat Aug 28 12:06:08 2021 +++ src/usr.bin/xlint/lint1/decl.c Sat Aug 28 12:21:53 2021 @@ -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 @@ dinfo_t *dcs; 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 @@ declarator_1_struct_union(sym_t *dsym) 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 @@ declarator_1_struct_union(sym_t *dsym) * 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 Index: src/usr.bin/xlint/lint1/emit1.c diff -u src/usr.bin/xlint/lint1/emit1.c:1.50 src/usr.bin/xlint/lint1/emit1.c:1.51 --- src/usr.bin/xlint/lint1/emit1.c:1.50 Mon Aug 23 06:21:59 2021 +++ src/usr.bin/xlint/lint1/emit1.c Sat Aug 28 12:21:53 2021 @@ -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 @@ outfstrg(strg_t *strg) { unsigned char c, oc; bool first; - u_char *cp; + unsigned char *cp; lint_assert(strg->st_tspec == CHAR); Index: src/usr.bin/xlint/lint1/func.c diff -u src/usr.bin/xlint/lint1/func.c:1.120 src/usr.bin/xlint/lint1/func.c:1.121 --- src/usr.bin/xlint/lint1/func.c:1.120 Sun Aug 22 13:52:19 2021 +++ src/usr.bin/xlint/lint1/func.c Sat Aug 28 12:21:53 2021 @@ -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 @@ check_case_label(tnode_t *tn, control_st } 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); Index: src/usr.bin/xlint/lint1/lex.c diff -u src/usr.bin/xlint/lint1/lex.c:1.70 src/usr.bin/xlint/lint1/lex.c:1.71 --- src/usr.bin/xlint/lint1/lex.c:1.70 Wed Aug 25 22:48:40 2021 +++ src/usr.bin/xlint/lint1/lex.c Sat Aug 28 12:21:53 2021 @@ -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 @@ bool in_system_header = false; 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 @@ inpc(void) 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 @@ lex_name(const char *yytext, size_t yyle static sym_t * search(sbuf_t *sb) { - u_int h; + unsigned int h; sym_t *sym; const struct kwtab *kw; @@ -1276,7 +1276,7 @@ clear_warn_flags(void) int lex_string(void) { - u_char *s; + unsigned char *s; int c; size_t len, max; strg_t *strg; Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.125 src/usr.bin/xlint/lint1/lint1.h:1.126 --- src/usr.bin/xlint/lint1/lint1.h:1.125 Mon Aug 23 17:03:23 2021 +++ src/usr.bin/xlint/lint1/lint1.h Sat Aug 28 12:21:53 2021 @@ -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 @@ typedef struct strg { 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 @@ typedef struct { * 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 lint1_type { 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 @@ typedef struct dinfo { 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 */ Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.352 src/usr.bin/xlint/lint1/tree.c:1.353 --- src/usr.bin/xlint/lint1/tree.c:1.352 Wed Aug 25 22:00:26 2021 +++ src/usr.bin/xlint/lint1/tree.c Sat Aug 28 12:21:53 2021 @@ -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 @@ promote(op_t op, bool farg, tnode_t *tn) { tspec_t t; type_t *ntp; - u_int len; + unsigned int len; t = tn->tn_type->t_tspec; @@ -2215,11 +2215,11 @@ convert_constant_floating(op_t op, int a 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 @@ constant_addr(const tnode_t *tn, const s * 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; Index: src/usr.bin/xlint/lint2/hash.c diff -u src/usr.bin/xlint/lint2/hash.c:1.16 src/usr.bin/xlint/lint2/hash.c:1.17 --- src/usr.bin/xlint/lint2/hash.c:1.16 Sun Aug 22 13:12:39 2021 +++ src/usr.bin/xlint/lint2/hash.c Sat Aug 28 12:21:53 2021 @@ -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 @@ __RCSID("$NetBSD: hash.c,v 1.16 2021/08/ /* pointer to hash table, initialized in inithash() */ static hte_t **htab; -static u_int hash(const char *); +static unsigned int hash(const char *); /* * Initialize hash table. @@ -72,14 +72,14 @@ _inithash(hte_t ***tablep) /* * Compute hash value from a string. */ -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)); } @@ -93,7 +93,7 @@ hash(const char *s) hte_t * _hsearch(hte_t **table, const char *s, bool mknew) { - u_int h; + unsigned int h; hte_t *hte; if (table == NULL) Index: src/usr.bin/xlint/lint2/lint2.h diff -u src/usr.bin/xlint/lint2/lint2.h:1.16 src/usr.bin/xlint/lint2/lint2.h:1.17 --- src/usr.bin/xlint/lint2/lint2.h:1.16 Sun Aug 22 13:01:47 2021 +++ src/usr.bin/xlint/lint2/lint2.h Sat Aug 28 12:21:53 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lint2.h,v 1.16 2021/08/22 13:01:47 rillig Exp $ */ +/* $NetBSD: lint2.h,v 1.17 2021/08/28 12:21:53 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -95,12 +95,12 @@ typedef struct arginf { * Keeps information about position in source file. */ typedef struct { - u_short p_src; /* index of name of translation unit + unsigned short p_src; /* index of name of translation unit (the name which was specified at the command line) */ - u_short p_line; /* line number in p_src */ - u_short p_isrc; /* index of (included) file */ - u_short p_iline; /* line number in p_iline */ + unsigned short p_line; /* line number in p_src */ + unsigned short p_isrc; /* index of (included) file */ + unsigned short p_iline; /* line number in p_iline */ } pos_t; /* @@ -115,7 +115,7 @@ typedef struct sym { struct { pos_t s_pos; /* pos of def./decl. */ #ifndef lint - u_char s_def; /* DECL, TDEF or DEF */ + unsigned char s_def; /* DECL, TDEF or DEF */ #else def_t s_def; #endif @@ -126,7 +126,7 @@ typedef struct sym { bool s_va : 1; /* check only first s_nva arguments */ bool s_prfl : 1; /* printflike */ bool s_scfl : 1; /* scanflike */ - u_short s_type; /* type */ + unsigned short s_type; /* type */ struct sym *s_next; /* next symbol with same name */ } s_s; short s_nva; @@ -153,7 +153,7 @@ typedef struct fcall { pos_t f_pos; /* position of call */ bool f_rused : 1; /* return value used */ bool f_rdisc : 1; /* return value discarded (casted to void) */ - u_short f_type; /* types of expected return value and args */ + unsigned short f_type; /* types of expected return value and args */ arginf_t *f_args; /* information about constant arguments */ struct fcall *f_next; /* next call of same function */ } fcall_t; @@ -189,7 +189,7 @@ typedef struct hte { /* maps type indices into pointers to type structs */ static inline type_t * -TP(u_short type_id) { +TP(unsigned short type_id) { /* force sequence point for newly parsed type_id */ return tlst[type_id]; } Index: src/usr.bin/xlint/lint2/msg.c diff -u src/usr.bin/xlint/lint2/msg.c:1.15 src/usr.bin/xlint/lint2/msg.c:1.16 --- src/usr.bin/xlint/lint2/msg.c:1.15 Sat Mar 27 11:08:00 2021 +++ src/usr.bin/xlint/lint2/msg.c Sat Aug 28 12:21:53 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msg.c,v 1.15 2021/03/27 11:08:00 rillig Exp $ */ +/* $NetBSD: msg.c,v 1.16 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: msg.c,v 1.15 2021/03/27 11:08:00 rillig Exp $"); +__RCSID("$NetBSD: msg.c,v 1.16 2021/08/28 12:21:53 rillig Exp $"); #endif #include <stdarg.h> @@ -127,7 +127,7 @@ mkpos(pos_t *posp) qm = !Hflag && posp->p_src != posp->p_isrc; len = strlen(fn = lbasename(fnames[src])); - len += 3 * sizeof(u_short) + 4; + len += 3 * sizeof(unsigned short) + 4; if (len > blen) buf = xrealloc(buf, blen = len); Index: src/usr.bin/xlint/lint2/read.c diff -u src/usr.bin/xlint/lint2/read.c:1.55 src/usr.bin/xlint/lint2/read.c:1.56 --- src/usr.bin/xlint/lint2/read.c:1.55 Sun Aug 22 13:21:48 2021 +++ src/usr.bin/xlint/lint2/read.c Sat Aug 28 12:21:53 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: read.c,v 1.55 2021/08/22 13:21:48 rillig Exp $ */ +/* $NetBSD: read.c,v 1.56 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: read.c,v 1.55 2021/08/22 13:21:48 rillig Exp $"); +__RCSID("$NetBSD: read.c,v 1.56 2021/08/28 12:21:53 rillig Exp $"); #endif #include <ctype.h> @@ -77,9 +77,9 @@ static size_t nfnames; * types. */ typedef struct thtab { - const char *th_name; - u_short th_idx; - struct thtab *th_next; + const char *th_name; + unsigned short th_idx; + struct thtab *th_next; } thtab_t; static thtab_t **thtab; /* hash table */ type_t **tlst; /* array for indexed access */ @@ -99,10 +99,10 @@ static void setfnid(int, const char *); static void funccall(pos_t *, const char *); static void decldef(pos_t *, const char *); static void usedsym(pos_t *, const char *); -static u_short inptype(const char *, const char **); +static unsigned short inptype(const char *, const char **); static int gettlen(const char *, const char **); -static u_short findtype(const char *, size_t, int); -static u_short storetyp(type_t *, const char *, size_t, int); +static unsigned short findtype(const char *, size_t, int); +static unsigned short storetyp(type_t *, const char *, size_t, int); static int thash(const char *, size_t); static char *inpqstrg(const char *, const char **); static const char *inpname(const char *, const char **); @@ -206,10 +206,10 @@ readfile(const char *name) inperr("bad line number"); iline = parse_int(&cp); - pos.p_src = (u_short)csrcfile; - pos.p_line = (u_short)cline; - pos.p_isrc = (u_short)isrc; - pos.p_iline = (u_short)iline; + pos.p_src = (unsigned short)csrcfile; + pos.p_line = (unsigned short)cline; + pos.p_isrc = (unsigned short)isrc; + pos.p_iline = (unsigned short)iline; /* process rest of this record */ switch (rt) { @@ -286,7 +286,7 @@ setfnid(int fid, const char *cp) */ if ((size_t)fid >= ninpfns) errx(1, "internal error: setfnid()"); - inpfns[fid] = (u_short)getfnidx(cp); + inpfns[fid] = (unsigned short)getfnidx(cp); } /* @@ -616,7 +616,7 @@ parse_tspec(const char **pp, char c, boo /* * Read a type and return the index of this type. */ -static u_short +static unsigned short inptype(const char *cp, const char **epp) { char c; @@ -625,7 +625,7 @@ inptype(const char *cp, const char **epp int narg, i; bool osdef = false; size_t tlen; - u_short tidx; + unsigned short tidx; int h; /* If we have this type already, return its index. */ @@ -908,7 +908,7 @@ gettlen(const char *cp, const char **epp /* * Search a type by its type string. */ -static u_short +static unsigned short findtype(const char *cp, size_t len, int h) { thtab_t *thte; @@ -927,10 +927,10 @@ findtype(const char *cp, size_t len, int * Store a type and its type string, so we can later share this type * if we read the same type string from the input file. */ -static u_short +static unsigned short storetyp(type_t *tp, const char *cp, size_t len, int h) { - static u_int tidx = 1; /* 0 is reserved */ + static unsigned int tidx = 1; /* 0 is reserved */ thtab_t *thte; char *name; @@ -956,7 +956,7 @@ storetyp(type_t *tp, const char *cp, siz thte->th_next = thtab[h]; thtab[h] = thte; - return (u_short)tidx++; + return (unsigned short)tidx++; } /* @@ -965,11 +965,11 @@ storetyp(type_t *tp, const char *cp, siz static int thash(const char *s, size_t len) { - u_int v; + unsigned int v; v = 0; while (len-- != 0) { - v = (v << sizeof(v)) + (u_char)*s++; + v = (v << sizeof(v)) + (unsigned char)*s++; v ^= v >> (sizeof(v) * CHAR_BIT - sizeof(v)); } return v % THSHSIZ2;