This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] avoid warning: equality comparison with extraneous parentheses
ClosedPublic

Authored by protze.joachim on Nov 4 2020, 3:33 AM.

Details

Summary

The macros are used in several places with an if(macro) pattern. This results in several warnings like:

llvm-project/openmp/runtime/src/kmp_wait_release.h:336:49: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
          if ((((task_team)->tt.tt_found_tasks) == (!0)))
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
llvm-project/openmp/runtime/src/kmp_wait_release.h:801:16: note: in instantiation of function template specialization '__kmp_wait_template<kmp_flag_64, 0, true, false>' requested here
      retval = __kmp_wait_template<kmp_flag_64, 0, true, false>(
               ^
llvm-project/openmp/runtime/src/kmp_wait_release.h:336:49: note: remove extraneous parentheses around the comparison to silence this warning
          if ((((task_team)->tt.tt_found_tasks) == (!0)))
              ~                                 ^      ~
llvm-project/openmp/runtime/src/kmp_wait_release.h:336:49: note: use '=' to turn this equality comparison into an assignment
          if ((((task_team)->tt.tt_found_tasks) == (!0)))
                                                ^~
                                                =

Having the constant at the lhs of the comparison, avoids this warning.

Diff Detail

Event Timeline

protze.joachim created this revision.Nov 4 2020, 3:33 AM
protze.joachim requested review of this revision.Nov 4 2020, 3:33 AM
This revision is now accepted and ready to land.Nov 4 2020, 6:22 AM