Archived issue #0032763

Coding Rules - eliminate CLang warning -Wbitwise-instead-of-logical in math_FunctionSetRoot.cxx

Open CASCADEOCCT:Codingclosed6 public notes

Search issues

Description

The following CLang (Emscripten 2.0.34) warnings should be eliminated:
C:\occt.git\src\math\math_FunctionSetRoot.cxx:739:22: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
    myIsDivergent |= (Sol(i) < theInfBound(i)) | (theSupBound(i) < Sol(i));
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                               ||
C:\occt.git\src\math\math_FunctionSetRoot.cxx:739:22: note: cast one or both operands to int to silence this warning
C:\occt.git\src\math\math_FunctionSetRoot.cxx:814:24: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
      myIsDivergent |= (Sol(i) < theInfBound(i)) | (theSupBound(i) < Sol(i));
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                 ||
C:\work\occt\occt.git-qt\src\math\math_FunctionSetRoot.cxx:814:24: note: cast one or both operands to int to silence this warning
C:\work\occt\occt.git-qt\src\math\math_FunctionSetRoot.cxx:880:32: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
              myIsDivergent |= (Sol(i) < theInfBound(i)) | (theSupBound(i) < Sol(i));
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                         ||
C:\occt.git\src\math\math_FunctionSetRoot.cxx:880:32: note: cast one or both operands to int to silence this warning
C:\occt.git\src\math\math_FunctionSetRoot.cxx:918:36: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
                  myIsDivergent |= (Sol(i) < theInfBound(i)) | (theSupBound(i) < Sol(i));
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                             ||
C:\occt.git\src\math\math_FunctionSetRoot.cxx:918:36: note: cast one or both operands to int to silence this warning
C:\occt.git\src\math\math_FunctionSetRoot.cxx:1000:34: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
                myIsDivergent |= (Sol(i) < theInfBound(i)) | (theSupBound(i) < Sol(i));
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                           ||
C:\occt.git\src\math\math_FunctionSetRoot.cxx:1000:34: note: cast one or both operands to int to silence this warning
C:\occt.git\src\math\math_FunctionSetRoot.cxx:1043:36: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
                  myIsDivergent |= (Sol(i) < theInfBound(i)) | (theSupBound(i) < Sol(i));
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                             ||
C:\occt.git\src\math\math_FunctionSetRoot.cxx:1043:36: note: cast one or both operands to int to silence this warning
C:\occt.git\src\math\math_FunctionSetRoot.cxx:1086:34: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
                myIsDivergent |= (Sol(i) < theInfBound(i)) | (theSupBound(i) < Sol(i));
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                           ||
C:\occt.git\src\math\math_FunctionSetRoot.cxx:1086:34: note: cast one or both operands to int to silence this warning
7 warnings generated.


The same applies also to constructions like "if (theStopOnDivergent & myIsDivergent)"

Steps to reproduce

N/A

Public activity

6 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Wed Jan 12 19:51:18 2022 +0300

    0032763: Coding Rules - eliminate CLang warning -Wbitwise-instead-of-logical in math_FunctionSetRoot.cxx
02Author
Please raise the patch
- OCCT: branch CR32763.

http://jenkins-test-occt/view/CR32763-master-KGV/
03Commenter 1
Branch [archived branch] has been updated by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Sat Jan 15 01:39:19 2022 +0300

    0032779: Visualization, TKOpenGl - support using a wide color window buffer format (10bit per component / 30bit RGB)
    
    Added new flag OpenGl_Caps::buffersDeepColor disabled by default.
    OpenGl_Window now tries to find a RGB10_A2 pixel format using wglChoosePixelFormatARB().
    OpenGl_TextureFormat::FindSizedFormat() - added handling of GL_RGB10_A2 internal format.
    OpenGl_View::SetWindow() now selects preferred FBO color format basing on parameters.
    OpenGl_Context::DiagnosticInformation()/OpenGl_View::DiagnosticInformation() now include
    information about window pixel format / FBO texture format.
04Commenter 1
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
05Commenter 5
Combination -
OCCT branch : [archived branch]
master SHA - [revision removed]
[revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 18239.750000000447 / 18223.400000000463 [+0.09%]
Products
Total CPU difference: 11656.240000000102 / 11659.240000000125 [-0.03%]
Windows-64-VC14:
OCCT
Total CPU difference: 19987.609375 / 20012.3125 [-0.12%]
Products
Total CPU difference: 13139.84375 / 13120.265625 [+0.15%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
06Commenter 1
Branch [archived branch] has been deleted by Participant.

[revision removed]