From 4f7dce3fc20179ed6c24b7d84b82a99b6f410fef Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 28 May 2023 15:18:06 +0200 Subject: [PATCH] error: Avoid -Wint-in-bool-context warning. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reported by Pádraig Brady in . * lib/error.in.h (error, error_at_line): Use 'status != 0', since status is expected to be an int, not a bool value. --- ChangeLog | 8 ++++++++ lib/error.in.h | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0912f8e634..e3a2507c47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2023-05-28 Bruno Haible + + error: Avoid -Wint-in-bool-context warning. + Reported by Pádraig Brady in + . + * lib/error.in.h (error, error_at_line): Use 'status != 0', since status + is expected to be an int, not a bool value. + 2023-05-27 Bruno Haible error: Support the compiler's control flow analysis better. diff --git a/lib/error.in.h b/lib/error.in.h index 4bf191e102..70fb132133 100644 --- a/lib/error.in.h +++ b/lib/error.in.h @@ -69,7 +69,7 @@ _GL_CXXALIAS_RPL (error, void, # ifndef _GL_NO_INLINE_ERROR # undef error # define error(status, ...) \ - ((rpl_error)(0, __VA_ARGS__), (status) ? exit (status) : (void)0) + ((rpl_error)(0, __VA_ARGS__), (status) != 0 ? exit (status) : (void)0) # endif #else # if ! @HAVE_ERROR@ @@ -81,7 +81,7 @@ _GL_CXXALIAS_SYS (error, void, (int __status, int __errnum, const char *__format, ...)); # ifndef _GL_NO_INLINE_ERROR # define error(status, ...) \ - ((error)(0, __VA_ARGS__), (status) ? exit (status) : (void)0) + ((error)(0, __VA_ARGS__), (status) != 0 ? exit (status) : (void)0) # endif #endif #if __GLIBC__ >= 2 @@ -105,7 +105,7 @@ _GL_CXXALIAS_RPL (error_at_line, void, # ifndef _GL_NO_INLINE_ERROR # undef error_at_line # define error_at_line(status, ...) \ - ((rpl_error_at_line)(0, __VA_ARGS__), (status) ? exit (status) : (void)0) + ((rpl_error_at_line)(0, __VA_ARGS__), (status) != 0 ? exit (status) : (void)0) # endif #else # if ! @HAVE_ERROR_AT_LINE@ @@ -119,7 +119,7 @@ _GL_CXXALIAS_SYS (error_at_line, void, unsigned int __lineno, const char *__format, ...)); # ifndef _GL_NO_INLINE_ERROR # define error_at_line(status, ...) \ - ((error_at_line)(0, __VA_ARGS__), (status) ? exit (status) : (void)0) + ((error_at_line)(0, __VA_ARGS__), (status) != 0 ? exit (status) : (void)0) # endif #endif _GL_CXXALIASWARN (error_at_line); -- 2.39.5