]> Savannah Git Hosting - gnulib.git/commitdiff
utimecmp: avoid new GCC 7 warning from -Wbool-operation
authorJim Meyering <meyering@fb.com>
Wed, 5 Oct 2016 16:13:55 +0000 (09:13 -0700)
committerJim Meyering <meyering@fb.com>
Wed, 12 Oct 2016 04:47:49 +0000 (21:47 -0700)
Testing this module would fail when using GCC 7 like this:
$ CFLAGS='-O -Werror=bool-operation' ./gnulib-tool --create-testdir \
  --dir=/tmp/x --with-tests --test utimecmp
../../gllib/utimecmp.c: In function ‘utimecmp’:
../../gllib/utimecmp.c:291:36: error: ‘~’ on a boolean expression \
  [-Werror=bool-operation]
                 time_t s = src_s & ~ (res == 2 * BILLION);
                                    ^
../../gllib/utimecmp.c:370:16: error: ‘~’ on a boolean expression \
  [-Werror=bool-operation]
       src_s &= ~ (res == 2 * BILLION);
                ^
* lib/utimecmp.c (utimecmp): Do not apply "~" to a boolean.
Instead, make it explicit that we intend to apply it to 0 or 1.

ChangeLog

index 679285fe8743c3a2305934d8712e100901ed65ec..a4cf1e8810e27d9b98d347b3be7d0ce04767eae5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2016-10-05  Jim Meyering  <meyering@fb.com>
+
+       utimecmp: avoid new GCC 7 warning from -Wbool-operation
+       Testing this module would fail when using GCC 7 like this:
+       $ CFLAGS='-O -Werror=bool-operation' ./gnulib-tool --create-testdir \
+         --dir=/tmp/x --with-tests --test utimecmp
+       ../../gllib/utimecmp.c: In function ‘utimecmp’:
+       ../../gllib/utimecmp.c:291:36: error: ‘~’ on a boolean expression \
+         [-Werror=bool-operation]
+                        time_t s = src_s & ~ (res == 2 * BILLION);
+                                           ^
+       ../../gllib/utimecmp.c:370:16: error: ‘~’ on a boolean expression \
+         [-Werror=bool-operation]
+              src_s &= ~ (res == 2 * BILLION);
+                       ^
+       * lib/utimecmp.c (utimecmp): Do not apply "~" to a boolean.
+       Instead, make it explicit that we intend to apply it to 0 or 1.
+
 2016-10-10  Eli Zaretskii  <eliz@gnu.org>
 
        wchar, wctype-h: fix for MinGW 3.22.2