From 18d02b74c859f374ec0975d7c40eb0171bf07513 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 29 Dec 2020 20:00:36 -0800 Subject: [PATCH] regex-tests: tweak to avoid a clang-10 warning * tests/test-regex.c: Compare with explicit zero, rather than as boolean to avoid this from clang-10: test-regex.c:315:9: error: converting the result of '<<' to a \ boolean always evaluates to true \ [-Werror,-Wtautological-constant-compare] if (! REG_STARTEND) --- ChangeLog | 8 ++++++++ tests/test-regex.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index cc4e456655..c2cd649695 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2020-12-29 Jim Meyering + regex-tests: tweak to avoid a clang-10 warning + * tests/test-regex.c: Compare with explicit zero, rather than + as boolean to avoid this from clang-10: + test-regex.c:315:9: error: converting the result of '<<' to a \ + boolean always evaluates to true \ + [-Werror,-Wtautological-constant-compare] + if (! REG_STARTEND) + hash: add casts-to-float to avoid clang-10 warnings * lib/hash.c (compute_bucket_size): Cast SIZE_MAX to float to avoid this warning from clang-10 (for use in grep): diff --git a/tests/test-regex.c b/tests/test-regex.c index 3a3d8f1f1f..e4479a03fb 100644 --- a/tests/test-regex.c +++ b/tests/test-regex.c @@ -312,7 +312,7 @@ main (void) /* REG_STARTEND was added to glibc on 2004-01-15. Reject older versions. */ - if (! REG_STARTEND) + if (REG_STARTEND == 0) report_error ("REG_STARTEND is zero"); /* Matching with the compiled form of this regexp would provoke -- 2.39.5