Module Name: src
Committed By: rillig
Date: Sat Jan 2 18:44:58 UTC 2021
Modified Files:
src/usr.bin/xlint/lint1: decl.c externs1.h func.c
Log Message:
lint: convert bitfieldtype_ok from int to bool
No functional change intended, except for the output in debug mode.
To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.43 -r1.44 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.46 -r1.47 src/usr.bin/xlint/lint1/func.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.102 src/usr.bin/xlint/lint1/decl.c:1.103
--- src/usr.bin/xlint/lint1/decl.c:1.102 Sat Jan 2 18:26:44 2021
+++ src/usr.bin/xlint/lint1/decl.c Sat Jan 2 18:44:58 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.102 2021/01/02 18:26:44 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.103 2021/01/02 18:44:58 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.102 2021/01/02 18:26:44 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.103 2021/01/02 18:44:58 rillig Exp $");
#endif
#include <sys/param.h>
@@ -1106,7 +1106,7 @@ declarator_1_struct_union(sym_t *dsym)
*/
if (t == CHAR || t == UCHAR || t == SCHAR ||
t == SHORT || t == USHORT || t == ENUM) {
- if (bitfieldtype_ok == 0) {
+ if (!bitfieldtype_ok) {
if (sflag) {
/* bit-field type '%s' invalid ... */
warning(273, type_name(tp));
@@ -1116,7 +1116,7 @@ declarator_1_struct_union(sym_t *dsym)
}
}
} else if (t == INT && dcs->d_smod == NOTSPEC) {
- if (pflag && bitfieldtype_ok == 0) {
+ if (pflag && !bitfieldtype_ok) {
/* nonportable bit-field type */
warning(34);
}
@@ -1127,7 +1127,7 @@ declarator_1_struct_union(sym_t *dsym)
* Integer types not dealt with above are
* okay only if BITFIELDTYPE is in effect.
*/
- if (bitfieldtype_ok == 0 || tspec_is_int(t) == 0) {
+ if (!bitfieldtype_ok || !tspec_is_int(t)) {
/* illegal bit-field type */
warning(35);
sz = tp->t_flen;
@@ -1194,7 +1194,7 @@ declarator_1_struct_union(sym_t *dsym)
* Clear the BITFIELDTYPE indicator after processing each
* structure element.
*/
- bitfieldtype_ok = 0;
+ bitfieldtype_ok = false;
return dsym;
}
Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.43 src/usr.bin/xlint/lint1/externs1.h:1.44
--- src/usr.bin/xlint/lint1/externs1.h:1.43 Fri Jan 1 10:55:28 2021
+++ src/usr.bin/xlint/lint1/externs1.h Sat Jan 2 18:44:58 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: externs1.h,v 1.43 2021/01/01 10:55:28 rillig Exp $ */
+/* $NetBSD: externs1.h,v 1.44 2021/01/02 18:44:58 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -239,7 +239,7 @@ extern pos_t scanflike_pos;
extern int constcond_flag;
extern int llibflg;
extern int lwarn;
-extern int bitfieldtype_ok;
+extern bool bitfieldtype_ok;
extern int plibflg;
extern int quadflg;
Index: src/usr.bin/xlint/lint1/func.c
diff -u src/usr.bin/xlint/lint1/func.c:1.46 src/usr.bin/xlint/lint1/func.c:1.47
--- src/usr.bin/xlint/lint1/func.c:1.46 Fri Jan 1 11:41:01 2021
+++ src/usr.bin/xlint/lint1/func.c Sat Jan 2 18:44:58 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: func.c,v 1.46 2021/01/01 11:41:01 rillig Exp $ */
+/* $NetBSD: func.c,v 1.47 2021/01/02 18:44:58 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.46 2021/01/01 11:41:01 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.47 2021/01/02 18:44:58 rillig Exp $");
#endif
#include <stdlib.h>
@@ -138,10 +138,10 @@ int llibflg;
int lwarn = LWARN_ALL;
/*
- * Nonzero if bitfield type errors are suppressed by a BITFIELDTYPE
+ * Whether bitfield type errors are suppressed by a BITFIELDTYPE
* directive.
*/
-int bitfieldtype_ok;
+bool bitfieldtype_ok;
/*
* Nonzero if complaints about use of "long long" are suppressed in
@@ -1261,10 +1261,10 @@ bitfieldtype(int n)
{
#ifdef DEBUG
- printf("%s, %d: bitfieldtype_ok = 1\n", curr_pos.p_file,
+ printf("%s, %d: bitfieldtype_ok = true\n", curr_pos.p_file,
curr_pos.p_line);
#endif
- bitfieldtype_ok = 1;
+ bitfieldtype_ok = true;
}
/*