lint: hide irrelevant type information from lint2

No functional change.
This commit is contained in:
rillig 2021-09-05 18:17:15 +00:00
parent 1f92077950
commit 6ac96e0f0b
6 changed files with 31 additions and 28 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: t_lint2.sh,v 1.7 2021/09/04 20:39:17 rillig Exp $ # $NetBSD: t_lint2.sh,v 1.8 2021/09/05 18:17:15 rillig Exp $
# #
# Copyright (c) 2021 The NetBSD Foundation, Inc. # Copyright (c) 2021 The NetBSD Foundation, Inc.
# All rights reserved. # All rights reserved.
@ -43,7 +43,7 @@ std_body()
> "$1.ln" > "$1.ln"
atf_check -o "file:$srcdir/$1.exp" \ atf_check -o "file:$srcdir/$1.exp" \
"$lint2" -h -p -x "$1.ln" "$lint2" -h -x "$1.ln"
} }
std_emit_body() std_emit_body()
@ -60,7 +60,7 @@ std_emit_body()
> "$1.exp-ln" > "$1.exp-ln"
atf_check \ atf_check \
"$lint2" -h -p -x -C "$1" "$1.ln" "$lint2" -h -x -C "$1" "$1.ln"
atf_check -o "file:$1.exp-ln" \ atf_check -o "file:$1.exp-ln" \
cat "llib-l$1.ln" cat "llib-l$1.ln"

View File

@ -1,4 +1,4 @@
/* $NetBSD: inittyp.c,v 1.29 2021/09/04 15:39:41 rillig Exp $ */ /* $NetBSD: inittyp.c,v 1.30 2021/09/05 18:17:15 rillig Exp $ */
/* /*
* Copyright (c) 1994, 1995 Jochen Pohl * Copyright (c) 1994, 1995 Jochen Pohl
@ -37,7 +37,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint) #if defined(__RCSID) && !defined(lint)
__RCSID("$NetBSD: inittyp.c,v 1.29 2021/09/04 15:39:41 rillig Exp $"); __RCSID("$NetBSD: inittyp.c,v 1.30 2021/09/05 18:17:15 rillig Exp $");
#endif #endif
#if defined(IS_LINT1) #if defined(IS_LINT1)
@ -48,6 +48,7 @@ __RCSID("$NetBSD: inittyp.c,v 1.29 2021/09/04 15:39:41 rillig Exp $");
#define INT_RSIZE (/*CONSTCOND*/INTPTR_TSPEC == LONG ? 3 : 4) #define INT_RSIZE (/*CONSTCOND*/INTPTR_TSPEC == LONG ? 3 : 4)
#ifdef IS_LINT1
#define typeinfo( \ #define typeinfo( \
name, signed_type, unsigned_type, \ name, signed_type, unsigned_type, \
size_in_bits, portable_size_in_bits, \ size_in_bits, portable_size_in_bits, \
@ -60,6 +61,18 @@ __RCSID("$NetBSD: inittyp.c,v 1.29 2021/09/04 15:39:41 rillig Exp $");
(is_arithmetic) > 0, (is_scalar) > 0, (is_complex) > 0, \ (is_arithmetic) > 0, (is_scalar) > 0, (is_complex) > 0, \
name, \ name, \
} }
#else
#define typeinfo( \
name, signed_type, unsigned_type, \
size_in_bits, portable_size_in_bits, \
is_integer, is_unsigned, is_floating, is_arithmetic, \
is_scalar, is_complex) \
{ \
signed_type, unsigned_type, \
(is_integer) > 0, \
name, \
}
#endif
/* various type information */ /* various type information */
ttab_t ttab[NTSPEC] = { ttab_t ttab[NTSPEC] = {
@ -121,6 +134,7 @@ ttab_t ttab[NTSPEC] = {
}; };
#undef typeinfo #undef typeinfo
#ifdef IS_LINT1
void void
inittyp(void) inittyp(void)
{ {
@ -138,3 +152,4 @@ inittyp(void)
ttab[BOOL].tt_is_arithmetic = false; ttab[BOOL].tt_is_arithmetic = false;
} }
} }
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: lint.h,v 1.31 2021/08/29 09:29:32 rillig Exp $ */ /* $NetBSD: lint.h,v 1.32 2021/09/05 18:17:15 rillig Exp $ */
/* /*
* Copyright (c) 1994, 1995 Jochen Pohl * Copyright (c) 1994, 1995 Jochen Pohl
@ -92,17 +92,21 @@ typedef enum {
* size of types, name and classification * size of types, name and classification
*/ */
typedef struct { typedef struct {
#ifdef IS_LINT1
unsigned int tt_size_in_bits; unsigned int tt_size_in_bits;
unsigned int tt_portable_size_in_bits; /* different from unsigned int tt_portable_size_in_bits; /* different from
* tt_size_in_bits if pflag is set */ * tt_size_in_bits if pflag is set */
#endif
tspec_t tt_signed_counterpart; tspec_t tt_signed_counterpart;
tspec_t tt_unsigned_counterpart; tspec_t tt_unsigned_counterpart;
bool tt_is_integer : 1; /* integer type */ bool tt_is_integer : 1; /* integer type */
#ifdef IS_LINT1
bool tt_is_uinteger : 1; /* unsigned integer type */ bool tt_is_uinteger : 1; /* unsigned integer type */
bool tt_is_floating : 1; /* floating point type */ bool tt_is_floating : 1; /* floating point type */
bool tt_is_arithmetic : 1; /* arithmetic type */ bool tt_is_arithmetic : 1; /* arithmetic type */
bool tt_is_scalar : 1; /* scalar type */ bool tt_is_scalar : 1; /* scalar type */
bool tt_is_complex : 1; /* complex type */ bool tt_is_complex : 1; /* complex type */
#endif
const char *tt_name; /* name of the type */ const char *tt_name; /* name of the type */
} ttab_t; } ttab_t;

View File

@ -1,4 +1,4 @@
/* $NetBSD: externs2.h,v 1.14 2021/08/28 17:18:42 rillig Exp $ */ /* $NetBSD: externs2.h,v 1.15 2021/09/05 18:17:15 rillig Exp $ */
/* /*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@ -44,8 +44,6 @@ extern bool tflag;
extern bool Hflag; extern bool Hflag;
extern bool hflag; extern bool hflag;
extern bool Fflag; extern bool Fflag;
extern bool pflag;
extern bool Tflag;
/* /*
* hash.c * hash.c
@ -77,7 +75,6 @@ extern void *xalloc(size_t);
/* /*
* chk.c * chk.c
*/ */
extern void inittyp(void);
extern void mainused(void); extern void mainused(void);
extern void chkname(const hte_t *); extern void chkname(const hte_t *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: main2.c,v 1.21 2021/08/28 19:49:28 rillig Exp $ */ /* $NetBSD: main2.c,v 1.22 2021/09/05 18:17:15 rillig Exp $ */
/* /*
* Copyright (c) 1994, 1995 Jochen Pohl * Copyright (c) 1994, 1995 Jochen Pohl
@ -37,7 +37,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint) #if defined(__RCSID) && !defined(lint)
__RCSID("$NetBSD: main2.c,v 1.21 2021/08/28 19:49:28 rillig Exp $"); __RCSID("$NetBSD: main2.c,v 1.22 2021/09/05 18:17:15 rillig Exp $");
#endif #endif
#include <stdio.h> #include <stdio.h>
@ -60,15 +60,12 @@ bool uflag = true;
bool Cflag; bool Cflag;
const char *libname; const char *libname;
bool pflag;
/* /*
* warnings for (tentative) definitions of the same name in more than * warnings for (tentative) definitions of the same name in more than
* one translation unit * one translation unit
*/ */
bool sflag; bool sflag;
bool Tflag;
bool tflag; bool tflag;
/* /*
@ -107,14 +104,11 @@ main(int argc, char *argv[])
libs = xcalloc(1, sizeof(*libs)); libs = xcalloc(1, sizeof(*libs));
opterr = 0; opterr = 0;
while ((c = getopt(argc, argv, "hpstxuC:HTFl:")) != -1) { while ((c = getopt(argc, argv, "hstxuC:HFl:")) != -1) {
switch (c) { switch (c) {
case 's': case 's':
sflag = true; sflag = true;
break; break;
case 'T':
Tflag = true;
break;
case 't': case 't':
tflag = true; tflag = true;
break; break;
@ -124,9 +118,6 @@ main(int argc, char *argv[])
case 'x': case 'x':
xflag = true; xflag = true;
break; break;
case 'p':
pflag = true;
break;
case 'C': case 'C':
len = strlen(optarg); len = strlen(optarg);
lname = xmalloc(len + 10); lname = xmalloc(len + 10);
@ -167,8 +158,6 @@ main(int argc, char *argv[])
/* initialize hash table */ /* initialize hash table */
inithash(); inithash();
inittyp();
for (i = 0; i < argc; i++) for (i = 0; i < argc; i++)
readfile(argv[i]); readfile(argv[i]);

View File

@ -1,4 +1,4 @@
/* $NetBSD: xlint.c,v 1.81 2021/09/05 16:15:05 rillig Exp $ */ /* $NetBSD: xlint.c,v 1.82 2021/09/05 18:17:15 rillig Exp $ */
/* /*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@ -38,7 +38,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint) #if defined(__RCSID) && !defined(lint)
__RCSID("$NetBSD: xlint.c,v 1.81 2021/09/05 16:15:05 rillig Exp $"); __RCSID("$NetBSD: xlint.c,v 1.82 2021/09/05 18:17:15 rillig Exp $");
#endif #endif
#include <sys/param.h> #include <sys/param.h>
@ -430,7 +430,6 @@ main(int argc, char *argv[])
list_add_copy(&deflibs, "c"); list_add_copy(&deflibs, "c");
} }
pass_flag_to_lint1(c); pass_flag_to_lint1(c);
pass_flag_to_lint2(c);
break; break;
case 's': case 's':
@ -455,7 +454,6 @@ main(int argc, char *argv[])
case 'T': case 'T':
pass_to_cpp("-I" PATH_STRICT_BOOL_INCLUDE); pass_to_cpp("-I" PATH_STRICT_BOOL_INCLUDE);
pass_flag_to_lint1(c); pass_flag_to_lint1(c);
pass_flag_to_lint2(c);
break; break;
#if !HAVE_NBTOOL_CONFIG_H #if !HAVE_NBTOOL_CONFIG_H