Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 lint: in strict bool mode, treat boolean...



details:   https://anonhg.NetBSD.org/src/rev/c8d5e38d2ee7
branches:  trunk
changeset: 379815:c8d5e38d2ee7
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jun 20 19:15:58 2021 +0000

description:
lint: in strict bool mode, treat boolean constants as unsigned

In strict bool mode, bool is not an arithmetic type anyway, therefore it
doesn't matter whether the type is signed or unsigned.

C99 6.2.5p6 defines _Bool as one of the "standard unsigned integer
types", so making the constants unsigned is more accurate.

No functional change.

diffstat:

 usr.bin/xlint/lint1/ckbool.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r f403f48b01b7 -r c8d5e38d2ee7 usr.bin/xlint/lint1/ckbool.c
--- a/usr.bin/xlint/lint1/ckbool.c      Sun Jun 20 19:10:47 2021 +0000
+++ b/usr.bin/xlint/lint1/ckbool.c      Sun Jun 20 19:15:58 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ckbool.c,v 1.2 2021/06/20 19:04:50 rillig Exp $ */
+/* $NetBSD: ckbool.c,v 1.3 2021/06/20 19:15:58 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include <sys/cdefs.h>
 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: ckbool.c,v 1.2 2021/06/20 19:04:50 rillig Exp $");
+__RCSID("$NetBSD: ckbool.c,v 1.3 2021/06/20 19:15:58 rillig Exp $");
 #endif
 
 #include <string.h>
@@ -252,7 +252,7 @@ fallback_symbol_strict_bool(sym_t *sym)
                sym->s_scl = CTCONST; /* close enough */
                sym->s_type = gettyp(BOOL);
                sym->s_value.v_tspec = BOOL;
-               sym->s_value.v_unsigned = false;
+               sym->s_value.v_unsigned = true;
                sym->s_value.v_quad = 0;
                return true;
        }
@@ -261,7 +261,7 @@ fallback_symbol_strict_bool(sym_t *sym)
                sym->s_scl = CTCONST; /* close enough */
                sym->s_type = gettyp(BOOL);
                sym->s_value.v_tspec = BOOL;
-               sym->s_value.v_unsigned = false;
+               sym->s_value.v_unsigned = true;
                sym->s_value.v_quad = 1;
                return true;
        }



Home | Main Index | Thread Index | Old Index