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.
# All rights reserved.
@ -43,7 +43,7 @@ std_body()
> "$1.ln"
atf_check -o "file:$srcdir/$1.exp" \
"$lint2" -h -p -x "$1.ln"
"$lint2" -h -x "$1.ln"
}
std_emit_body()
@ -60,7 +60,7 @@ std_emit_body()
> "$1.exp-ln"
atf_check \
"$lint2" -h -p -x -C "$1" "$1.ln"
"$lint2" -h -x -C "$1" "$1.ln"
atf_check -o "file:$1.exp-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
@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#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
#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)
#ifdef IS_LINT1
#define typeinfo( \
name, signed_type, unsigned_type, \
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, \
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 */
ttab_t ttab[NTSPEC] = {
@ -121,6 +134,7 @@ ttab_t ttab[NTSPEC] = {
};
#undef typeinfo
#ifdef IS_LINT1
void
inittyp(void)
{
@ -138,3 +152,4 @@ inittyp(void)
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
@ -92,17 +92,21 @@ typedef enum {
* size of types, name and classification
*/
typedef struct {
#ifdef IS_LINT1
unsigned int tt_size_in_bits;
unsigned int tt_portable_size_in_bits; /* different from
* tt_size_in_bits if pflag is set */
#endif
tspec_t tt_signed_counterpart;
tspec_t tt_unsigned_counterpart;
bool tt_is_integer : 1; /* integer type */
#ifdef IS_LINT1
bool tt_is_uinteger : 1; /* unsigned integer type */
bool tt_is_floating : 1; /* floating point type */
bool tt_is_arithmetic : 1; /* arithmetic type */
bool tt_is_scalar : 1; /* scalar type */
bool tt_is_complex : 1; /* complex type */
#endif
const char *tt_name; /* name of the type */
} 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.
@ -44,8 +44,6 @@ extern bool tflag;
extern bool Hflag;
extern bool hflag;
extern bool Fflag;
extern bool pflag;
extern bool Tflag;
/*
* hash.c
@ -77,7 +75,6 @@ extern void *xalloc(size_t);
/*
* chk.c
*/
extern void inittyp(void);
extern void mainused(void);
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
@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#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
#include <stdio.h>
@ -60,15 +60,12 @@ bool uflag = true;
bool Cflag;
const char *libname;
bool pflag;
/*
* warnings for (tentative) definitions of the same name in more than
* one translation unit
*/
bool sflag;
bool Tflag;
bool tflag;
/*
@ -107,14 +104,11 @@ main(int argc, char *argv[])
libs = xcalloc(1, sizeof(*libs));
opterr = 0;
while ((c = getopt(argc, argv, "hpstxuC:HTFl:")) != -1) {
while ((c = getopt(argc, argv, "hstxuC:HFl:")) != -1) {
switch (c) {
case 's':
sflag = true;
break;
case 'T':
Tflag = true;
break;
case 't':
tflag = true;
break;
@ -124,9 +118,6 @@ main(int argc, char *argv[])
case 'x':
xflag = true;
break;
case 'p':
pflag = true;
break;
case 'C':
len = strlen(optarg);
lname = xmalloc(len + 10);
@ -167,8 +158,6 @@ main(int argc, char *argv[])
/* initialize hash table */
inithash();
inittyp();
for (i = 0; i < argc; 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.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#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
#include <sys/param.h>
@ -430,7 +430,6 @@ main(int argc, char *argv[])
list_add_copy(&deflibs, "c");
}
pass_flag_to_lint1(c);
pass_flag_to_lint2(c);
break;
case 's':
@ -455,7 +454,6 @@ main(int argc, char *argv[])
case 'T':
pass_to_cpp("-I" PATH_STRICT_BOOL_INCLUDE);
pass_flag_to_lint1(c);
pass_flag_to_lint2(c);
break;
#if !HAVE_NBTOOL_CONFIG_H