Module Name: src Committed By: rillig Date: Sun Jun 20 19:15:58 UTC 2021
Modified Files: src/usr.bin/xlint/lint1: ckbool.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.bin/xlint/lint1/ckbool.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/ckbool.c diff -u src/usr.bin/xlint/lint1/ckbool.c:1.2 src/usr.bin/xlint/lint1/ckbool.c:1.3 --- src/usr.bin/xlint/lint1/ckbool.c:1.2 Sun Jun 20 19:04:50 2021 +++ src/usr.bin/xlint/lint1/ckbool.c Sun Jun 20 19:15:58 2021 @@ -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; }