Subject: diff.c:764: possible wrong operator ?

From: David Binderman <[email-masked]>
Date: Wed, 19 May 2021 10:07:08 +0000

Hello there,

I just tried to compile diffutils-3.7 with clang. It said:

diff.c:764:8: warning: bitwise negation of a boolean expression; did you mean logical negation? [-Wbool-operation]

Source code is

  files_can_be_treated_as_binary =
    (brief & binary
     & ~ (ignore_blank_lines | ignore_case | strip_trailing_cr
          | (ignore_regexp_list.regexps || ignore_white_space)));

Maybe better code:

  files_can_be_treated_as_binary =
    (brief & binary
     & ! (ignore_blank_lines | ignore_case | strip_trailing_cr
          | (ignore_regexp_list.regexps || ignore_white_space)));

Regards

David Binderman