View Issue Details

IDProjectCategoryView StatusLast Update
0024172Open CASCADEOCCT:Application Frameworkpublic2013-12-19 13:58
ReporterabvAssigned Tobugmaster  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
PlatformWindowsOSVC++ 2010 
Product Version6.7.0 
Target Version6.7.0Fixed in Version6.7.0 
Summary0024172: Compiler warnings 'unreacheable code' and 'unreferenced local function' in OCAF
DescriptionWhen building with warning level 4, MSVC 10 issues the following warning messages:

Warning 19 warning C4702: unreachable code d:\occt\src\tnaming\tnaming.cxx 993 TKCAF
Warning 20 warning C4702: unreachable code d:\occt\src\tnaming\tnaming_localizer.cxx 319 TKCAF
Warning 21 warning C4702: unreachable code d:\occt\src\tnaming\tnaming_name.cxx 1089 TKCAF
Warning 22 warning C4702: unreachable code d:\occt\src\tnaming\tnaming_naming.cxx 558 TKCAF

In these places cycle for() is made so that it always breaks after first iteration. If this is intended, such cycles should be replaced by equivalent if().

In addition, in Debug mode the warnings are reported on files called '*Sample':

Warning 23 warning C4505: 'Sample' : unreferenced local function has been removed D:\occt\src\DDocStd\DDocStd_Sample.cxx 34 TKDCAF
Warning 26 warning C4505: 'Sample' : unreferenced local function has been removed D:\occt\src\DDataStd\DDataStd_Sample.cxx 61 TKDCAF
Warning 28 warning C4505: 'Sample' : unreferenced local function has been removed D:\occt\src\DPrsStd\DPrsStd_Sample.cxx 39 TKDCAF
Warning 24 warning C4189: 'value' : local variable is initialized but not referenced D:\occt\src\DDataStd\DDataStd_Sample.cxx 103 TKDCAF
Warning 27 warning C4189: 'transparency' : local variable is initialized but not referenced D:\occt\src\DPrsStd\DPrsStd_Sample.cxx 201 TKDCAF
Warning 29 warning C4189: 'Result_2' : local variable is initialized but not referenced D:\occt\src\QADNaming\QADNaming_Sample.cxx 409 TKQADraw
Warning 30 warning C4189: 'Result_1' : local variable is initialized but not referenced D:\occt\src\QADNaming\QADNaming_Sample.cxx 406 TKQADraw
Warning 25 warning C4189: 'number' : local variable is initialized but not referenced D:\occt\src\DDataStd\DDataStd_Sample.cxx 353 TKDCAF

These are 'samples' not used anywhere and buried inside OCCT code. If they are useful, they can be moved to appropriate samples (Qt or Mfc) or documentation (see 0023962).
TagsNo tags attached.
Test case numberNot needed

Relationships

related to 0023947 closedomy Eliminate trivial compiler warnings in MSVC++ with warning level 4 
related to 0024212 closedszy Move OCAF sample code to samples 

Activities

szy

2013-09-30 15:57

manager   ~0025796

Fixed in CR24172.
Sample files can be moved to documentation(for example: appendix of User's Guide).
Review, please.

abv

2013-09-30 16:44

manager   ~0025801

Reviewed, please test.

Note that I have rebased CR24172 on current master and removed sample from QADNaming package. I have also registered a separate issue 0024212 for possible restoring the removed sample code in samples and / or documentation.

mkv

2013-10-02 07:57

tester   ~0025829

Last edited: 2013-10-02 08:37

Dear BugMaster,

Branch CR24172 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
SHA-1: 8e669dbe1c005bfe7509420b44c9cee4d2cfcb4c

Number of compiler warnings:

occt component :
Linux: 424 (426 on master)
Windows: 20 (24 on master)

products component :
Linux: 189 (190 on master)
Windows: 287 (287 on master)

Regressions/Differences:
No regressions/differences

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 365922988 / 366076704
Total CPU difference: 42867.20000000103 / 44692.120000001305

Testing on Windows:
Total MEMORY difference: 432692732 / 433333396
Total CPU difference: 37908.84375 / 34585.265625

There are not differences in images found by testdiff.

Related Changesets

occt: master b2197f93

2013-09-30 11:53:00

szy


Committer: bugmaster Details Diff
0024172: Compiler warnings 'unreacheable code' and 'unreferenced local function' in OCAF

Files _Sample.cxx containing unused sample code are removed from several OCAF packages.
Cycles for() with body always ending with 'break' are replaced by equivalent if() statements.
Affected Issues
0024172
rm - src/DDataStd/DDataStd_Sample.cxx Diff File
mod - src/DDataStd/FILES Diff File
rm - src/DDocStd/DDocStd_Sample.cxx Diff File
mod - src/DDocStd/FILES Diff File
rm - src/DPrsStd/DPrsStd_Sample.cxx Diff File
mod - src/DPrsStd/FILES Diff File
mod - src/QADNaming/FILES Diff File
rm - src/QADNaming/QADNaming_Sample.cxx Diff File
mod - src/TNaming/TNaming.cxx Diff File
mod - src/TNaming/TNaming_Localizer.cxx Diff File
mod - src/TNaming/TNaming_Name.cxx Diff File
mod - src/TNaming/TNaming_Naming.cxx Diff File

Issue History

Date Modified Username Field Change
2013-09-13 08:55 abv New Issue
2013-09-13 08:55 abv Assigned To => szy
2013-09-13 08:55 abv Status new => assigned
2013-09-13 08:55 abv Product Version => 6.7.0
2013-09-13 08:55 abv Target Version => 6.7.0
2013-09-13 10:58 abv Relationship added related to 0023947
2013-09-30 15:57 szy Note Added: 0025796
2013-09-30 15:57 szy Assigned To szy => abv
2013-09-30 15:57 szy Status assigned => resolved
2013-09-30 16:44 abv Note Added: 0025801
2013-09-30 16:44 abv Status resolved => reviewed
2013-09-30 16:52 abv Relationship added related to 0024212
2013-10-01 09:57 mkv Assigned To abv => mkv
2013-10-02 07:57 mkv Note Added: 0025829
2013-10-02 07:57 mkv Test case number => Not needed
2013-10-02 07:57 mkv Assigned To mkv => bugmaster
2013-10-02 07:57 mkv Status reviewed => tested
2013-10-02 08:37 mkv Note Edited: 0025829
2013-10-04 12:48 bugmaster Changeset attached => occt master b2197f93
2013-10-04 12:48 bugmaster Status tested => verified
2013-10-04 12:48 bugmaster Resolution open => fixed
2013-12-19 13:52 bugmaster Status verified => closed
2013-12-19 13:58 bugmaster Fixed in Version => 6.7.0