usr.sbin/flashctl: skip lint's strict bool mode with Clang

The strict bool mode is already checked in GCC mode, so restore the
previous idiomatic code.
pull/38/head
rillig 2024-05-13 20:38:05 +00:00
parent 7e2cd5d094
commit e040c24146
2 changed files with 7 additions and 6 deletions

View File

@ -1,11 +1,12 @@
# $NetBSD: Makefile,v 1.3 2023/01/08 15:49:51 rillig Exp $
# $NetBSD: Makefile,v 1.4 2024/05/13 20:38:05 rillig Exp $
SRCS= flashctl.c
PROG= flashctl
MAN= flashctl.8
LINTFLAGS+= -T # strict bool mode
LINTFLAGS+= ${MKLLVM:U-T:D} # strict bool mode
WARNS= 4
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: flashctl.c,v 1.10 2024/05/12 19:03:55 rillig Exp $ */
/* $NetBSD: flashctl.c,v 1.11 2024/05/13 20:38:05 rillig Exp $ */
/*-
* Copyright (c) 2010 Department of Software Engineering,
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: flashctl.c,v 1.10 2024/05/12 19:03:55 rillig Exp $");
__RCSID("$NetBSD: flashctl.c,v 1.11 2024/05/13 20:38:05 rillig Exp $");
#include <sys/ioctl.h>
#include <sys/flashio.h>
@ -233,11 +233,11 @@ to_intmax(intmax_t *num, const char *str)
errno = 0;
if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) {
if (isxdigit((unsigned char)str[2]) == 0)
if (!isxdigit((unsigned char)str[2]))
return EINVAL;
*num = strtoimax(str, &endptr, 16);
} else {
if (isdigit((unsigned char)str[0]) == 0)
if (!isdigit((unsigned char)str[0]))
return EINVAL;
*num = strtoimax(str, &endptr, 10);
}