Module Name:    src
Committed By:   rillig
Date:           Sun Sep  5 18:17:15 UTC 2021

Modified Files:
        src/tests/usr.bin/xlint/lint2: t_lint2.sh
        src/usr.bin/xlint/common: inittyp.c lint.h
        src/usr.bin/xlint/lint2: externs2.h main2.c
        src/usr.bin/xlint/xlint: xlint.c

Log Message:
lint: hide irrelevant type information from lint2

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint2/t_lint2.sh
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/xlint/common/inittyp.c
cvs rdiff -u -r1.31 -r1.32 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/xlint/lint2/externs2.h
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/xlint/lint2/main2.c
cvs rdiff -u -r1.81 -r1.82 src/usr.bin/xlint/xlint/xlint.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint2/t_lint2.sh
diff -u src/tests/usr.bin/xlint/lint2/t_lint2.sh:1.7 src/tests/usr.bin/xlint/lint2/t_lint2.sh:1.8
--- src/tests/usr.bin/xlint/lint2/t_lint2.sh:1.7	Sat Sep  4 20:39:17 2021
+++ src/tests/usr.bin/xlint/lint2/t_lint2.sh	Sun Sep  5 18:17:15 2021
@@ -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"

Index: src/usr.bin/xlint/common/inittyp.c
diff -u src/usr.bin/xlint/common/inittyp.c:1.29 src/usr.bin/xlint/common/inittyp.c:1.30
--- src/usr.bin/xlint/common/inittyp.c:1.29	Sat Sep  4 15:39:41 2021
+++ src/usr.bin/xlint/common/inittyp.c	Sun Sep  5 18:17:15 2021
@@ -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/
 
 #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/
 		(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

Index: src/usr.bin/xlint/common/lint.h
diff -u src/usr.bin/xlint/common/lint.h:1.31 src/usr.bin/xlint/common/lint.h:1.32
--- src/usr.bin/xlint/common/lint.h:1.31	Sun Aug 29 09:29:32 2021
+++ src/usr.bin/xlint/common/lint.h	Sun Sep  5 18:17:15 2021
@@ -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;
 

Index: src/usr.bin/xlint/lint2/externs2.h
diff -u src/usr.bin/xlint/lint2/externs2.h:1.14 src/usr.bin/xlint/lint2/externs2.h:1.15
--- src/usr.bin/xlint/lint2/externs2.h:1.14	Sat Aug 28 17:18:42 2021
+++ src/usr.bin/xlint/lint2/externs2.h	Sun Sep  5 18:17:15 2021
@@ -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 *);
 

Index: src/usr.bin/xlint/lint2/main2.c
diff -u src/usr.bin/xlint/lint2/main2.c:1.21 src/usr.bin/xlint/lint2/main2.c:1.22
--- src/usr.bin/xlint/lint2/main2.c:1.21	Sat Aug 28 19:49:28 2021
+++ src/usr.bin/xlint/lint2/main2.c	Sun Sep  5 18:17:15 2021
@@ -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]);
 

Index: src/usr.bin/xlint/xlint/xlint.c
diff -u src/usr.bin/xlint/xlint/xlint.c:1.81 src/usr.bin/xlint/xlint/xlint.c:1.82
--- src/usr.bin/xlint/xlint/xlint.c:1.81	Sun Sep  5 16:15:05 2021
+++ src/usr.bin/xlint/xlint/xlint.c	Sun Sep  5 18:17:15 2021
@@ -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

Reply via email to