Archived issue #0024843

CLang warnings -Wconstant-logical-operand

Open CASCADEOCCT:Codingclosed5 public notes

Search issues

Description

CLang on Mac OS X 10.9 reports multiple warnings -Wconstant-logical-operand which in most cases indicate wrong code:
TopOpeBRepTool_makeTransition.cxx:265:35: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
TopOpeBRepTool_makeTransition.cxx:272:35: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]

Public activity

5 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Warning -Wconstant-logical-operand is fixed.
Changes are located in branch CR24843.
Please, review.
02Commenter 2
If we stick to the current logic, there is no sense in keeping "if" operators and variables mk1 and mk2 as they will always be true: there are no alternative variants for involved macros.

Looking more in-depth, I deem the code in FUN_mkT2dquad() should be similar to FUN_mkT3dquad(): instead of

< Standard_Boolean mk1 = isINifh1 || isON2ifss || isIN2ifss;

we should have

> Standard_Boolean mke = (mkt==isINifh1) || (mkt==isON2ifss) || (mkt==isIN2ifss);
03Commenter 3
Remarks were applied.
04Commenter 4
No remarks, please test
05Commenter 5
Dear Commenter 1,

Branch CR24843 (and products from GIT master) was compiled on Linux, MacOS and Windows platforms and tested.
[revision removed]

Number of compiler warnings:

occt component :
Linux: 18 (18 on master)
Windows: 0 (0 on master)
MacOS: 408 (410 on master)

products component :
Linux: 12 (12 on master)
Windows: 2 (2 on master)

Regressions/Differences:
No regressions/differences

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 355691248 / 355845808
Total CPU difference: 67133.51999999976 / 55266.979999999734

Testing on Windows:
Total MEMORY difference: 354190524 / 360646556
Total CPU difference: 39265.515625 / 42617.53125

There are no differences in images found by testdiff.