From: Bruno Haible Date: Sun, 28 May 2023 13:18:06 +0000 (+0200) Subject: error: Avoid -Wint-in-bool-context warning. X-Git-Tag: v1.0~1280 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=4f7dce3fc20179ed6c24b7d84b82a99b6f410fef;p=gnulib.git 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. --- 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);