View Issue Details

IDProjectCategoryView StatusLast Update
0026585Open CASCADEOCCT:Codingpublic2016-04-20 15:48
ReporterskiAssigned Tobugmaster  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Target Version7.0.0Fixed in Version7.0.0 
Summary0026585: Eliminate compile warnings obtained by building occt with vc14: 'type cast' pointer truncation and 'type cast' truncation
DescriptionNext warnings appears during occt compilation with vc14:

11>../src/TDF/TDF_LabelMapHasher.lxx(34): warning C4311: 'type cast': pointer truncation from 'const TDF_LabelNodePtr' to 'long'
1>..\src\OSD\OSD_EnvironmentIterator.cxx(110): warning C4311: 'type cast': pointer truncation from 'Standard_Address' to 'Standard_Integer'
1>..\src\OSD\OSD_File.cxx(1993): warning C4311: 'type cast': pointer truncation from 'Standard_PCharacter' to 'DWORD'
1>..\src\OSD\OSD_File.cxx(2006): warning C4311: 'type cast': pointer truncation from 'Standard_PCharacter' to 'DWORD'
1>..\src\OSD\OSD_File.cxx(2027): warning C4311: 'type cast': pointer truncation from 'Standard_PCharacter' to 'DWORD'
1>..\src\OSD\OSD_FileNode.cxx(846): warning C4311: 'type cast': pointer truncation from 'PSID' to 'Standard_Integer'
1>..\src\OSD\OSD_FileNode.cxx(880): warning C4311: 'type cast': pointer truncation from 'PGROUP_SID' to 'Standard_Integer'
1>..\src\OSD\OSD_Process.cxx(297): warning C4311: 'type cast': pointer truncation from 'PSID' to 'Standard_Integer'
1>..\src\OSD\OSD_Thread.cxx(140): warning C4311: 'type cast': pointer truncation from 'void *' to 'DWORD'
1>..\src\OSD\OSD_WNT.cxx(914): warning C4311: 'type cast': pointer truncation from 'LPVOID' to 'DWORD'
28>..\src\Draw\Draw_ProgressIndicator.cxx(120): warning C4311: 'type cast': pointer truncation from 'void *' to 'long'
28>..\src\Draw\Draw_ProgressIndicator.cxx(149): warning C4311: 'type cast': pointer truncation from 'void *' to 'long'
4>../src/TDF/TDF_LabelMapHasher.lxx(34): warning C4311: 'type cast': pointer truncation from 'const TDF_LabelNodePtr' to 'long'


11>../src/TDF/TDF_LabelMapHasher.lxx(34): warning C4302: 'type cast': truncation from 'const TDF_LabelNodePtr' to 'long'
1>..\src\OSD\OSD_EnvironmentIterator.cxx(110): warning C4302: 'type cast': truncation from 'Standard_Address' to 'Standard_Integer'
1>..\src\OSD\OSD_File.cxx(1993): warning C4302: 'type cast': truncation from 'Standard_PCharacter' to 'DWORD'
1>..\src\OSD\OSD_File.cxx(2006): warning C4302: 'type cast': truncation from 'Standard_PCharacter' to 'DWORD'
1>..\src\OSD\OSD_File.cxx(2027): warning C4302: 'type cast': truncation from 'Standard_PCharacter' to 'DWORD'
1>..\src\OSD\OSD_FileNode.cxx(846): warning C4302: 'type cast': truncation from 'PSID' to 'Standard_Integer'
1>..\src\OSD\OSD_FileNode.cxx(880): warning C4302: 'type cast': truncation from 'PGROUP_SID' to 'Standard_Integer'
1>..\src\OSD\OSD_Process.cxx(297): warning C4302: 'type cast': truncation from 'PSID' to 'Standard_Integer'
1>..\src\OSD\OSD_Thread.cxx(140): warning C4302: 'type cast': truncation from 'void *' to 'DWORD'
1>..\src\OSD\OSD_WNT.cxx(914): warning C4302: 'type cast': truncation from 'LPVOID' to 'DWORD'
28>..\src\Draw\Draw_ProgressIndicator.cxx(120): warning C4302: 'type cast': truncation from 'void *' to 'long'
28>..\src\Draw\Draw_ProgressIndicator.cxx(149): warning C4302: 'type cast': truncation from 'void *' to 'long'
4>../src/TDF/TDF_LabelMapHasher.lxx(34): warning C4302: 'type cast': truncation from 'const TDF_LabelNodePtr' to 'long'
Steps To ReproduceTry to compile occt with vc14 (Visual Studio 2015)
TagsNo tags attached.
Test case numberNot needed

Relationships

related to 0024574 closedbugmaster ICC compiler warnings on Windows 
related to 0026171 closedinv Coding rules - eliminate -Wshorten-64-to-32 CLang warnings 
child of 0026547 closedski Configuration - fix compilation errors on VS2015 

Activities

git

2015-08-21 17:14

administrator   ~0044515

Branch CR26585 has been created by ski.

SHA-1: 68858de34b7f781bdeb644eb075ffa4c8e551fec


Detailed log of new commits:

Author: ski
Date: Tue Aug 18 16:22:33 2015 +0300

    0026585: Eliminate compile warnings obtained by building occt with vc14: 'type cast' pointer truncation and 'type cast' truncation
    
    Eliminated warnings 'type cast': pointer truncation and 'type cast': truncation from.

git

2015-09-09 13:06

administrator   ~0045306

Branch CR26585 has been updated forcibly by ski.

SHA-1: b421773a47bb4aefc2bac537cb301994150e6287

ski

2015-09-09 14:21

developer   ~0045319

Warnings were fixed on vc14.

abv

2015-09-10 06:34

manager   ~0045362

Functions used in the proposed fix (PtrToLong etc.) are defined only on Windows, thus it is not portable. The types involved should probably be revised instead of modifying a cast.

git

2015-09-11 15:49

administrator   ~0045501

Branch CR26585 has been updated forcibly by abv.

SHA-1: 3fc68a451546679f37d4d0c4e6a8f807f88d31c2

abv

2015-09-11 15:53

manager   ~0045503

I have pushed alternative (incomplete) version of the fix to the same branch CR26585. The idea is to avoid unsafe conversions by using appropriate types; in many cases warnings appear on old Windows-specific code which is never used and is better removed. The remaining places are to be fixed...

git

2015-10-06 16:02

administrator   ~0046522

Branch CR26585 has been updated forcibly by rkv.

SHA-1: 516c05c0a748f1cea2c1f47be56a5c8def0de1c6

rkv

2015-10-06 16:11

developer   ~0046523

It is proposed by Andrey Betenev to remove MoveDirectory() located in OSD_WNT.cxx as unused however it is rather a subject for a separate issue because it leads to global refactoring and changes.

git

2015-10-09 16:01

administrator   ~0046631

Branch CR26585_2 has been created by abv.

SHA-1: 437588bdd7cf9ee1e47b5f7ca96669d2a7483be2


Detailed log of new commits:

Author: rkv
Date: Wed Sep 30 09:36:04 2015 +0300

    0026668: Eliminate compile warnings obtained by building occt with vc14: conversion requires a narrowing conversion
    
    Warnings "conversion requires a narrowing conversion" were eliminated: IVtk_IdType is defined via vtkIdType from now.
    
    Check of bitness of VTK libraries is added, to ensure that OCCT and VTK use the same bitness.
    
    HashCode() function for long long int added in Standard_Integer.hxx to handle 64-bit integers

Author: rkv
Date: Tue Oct 6 16:43:47 2015 +0300

    0026669: Eliminate compile warnings obtained by building occt with vc14: 'type cast': conversion from 'BOOL' to 'WNDPROC' of greater size
    
    Signature of the command window callback has been fixed to avoid unnecessary type casting. It is used when Draw_IsConsoleSubsystem = Standard_False
     i.e. in non-console mode (see _main_() in Draw_Main.cxx).

Author: rkv
Date: Fri Oct 2 16:18:58 2015 +0300

    0026581: Eliminate compile warnings obtained by building occt with vc14: 'type cast' conversion

Author: abv
Date: Fri Oct 9 11:29:18 2015 +0300

    0026585: Eliminate compile warnings obtained by building occt with vc14: 'type cast' pointer truncation and 'type cast' truncation
    
    - Class OSD_EnvironmentIterator is removed (not used, and would definitely fail under Windows if tried)
    - Methods UserId() and GroupId() removed from OSD_FileNode (cannot be made portable, as there is no integer IDs of user and group on Windows)
    - Draw_ProgressIndicator corrected to properly pass address via Tcl
    - OSD_File.cxx: local function is refactored to avoid senseless encoding / decoding of results
    - OSD_Process::UserId() method removed, as it cannot be made cross-platform (no integer IDs on Windows)
    - OSD_Thread: use WinAPI conversion functions to avoid warnings
    - OSD_WNT.cxx: recursion counter passed via function argument instead of TLS
    - TDF_LabelMapHasher revised to use correct hasher function for an address

Author: rkv
Date: Thu Oct 8 10:06:55 2015 +0300

    0026720: Coding, STEP - non-conformant names of class fields
    
    Names of class fields and method parameters are fixed according to coding standard.

kgv

2015-10-09 17:14

developer   ~0046637

Last edited: 2015-10-09 17:15

Please test the patch.
Note that branch contains commits related to several issues (to be tested at once).

apv

2015-10-12 12:21

tester   ~0046669

Dear BugMaster,

Branch CR26585_2 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested.
SHA-1: 437588bdd7cf9ee1e47b5f7ca96669d2a7483be2

Number of compiler warnings:
occt component:
   Linux: 8 (13 on master)
   Windows: 0 (0 on master)
products component:
   Linux: 39 (39 on master)
   Windows: 0 (0 on master)

Regressions/Differences:
Not detected

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 92387081 / 92517880 [-0.14%]
Total CPU difference: 19471.959999999766 / 19402.97000000005 [+0.36%]

Testing on Windows:
Total MEMORY difference: 58137959 / 58146434 [-0.01%]
Total CPU difference: 18460.596736398973 / 18359.430087898847 [+0.55%]

kgv

2015-10-12 13:03

developer   ~0046674

Dear bugmaster,

please also switch to tested related fixes included in the patch: 0026668, 0026581

git

2015-10-16 16:28

administrator   ~0046948

Branch CR26585 has been deleted by kgv.

SHA-1: 516c05c0a748f1cea2c1f47be56a5c8def0de1c6

git

2015-10-16 16:28

administrator   ~0046949

Branch CR26585_2 has been deleted by kgv.

SHA-1: 437588bdd7cf9ee1e47b5f7ca96669d2a7483be2

Related Changesets

occt: master 68299304

2015-10-09 08:29:18

abv


Committer: bugmaster Details Diff
0026585: Eliminate compile warnings obtained by building occt with vc14: 'type cast' pointer truncation and 'type cast' truncation

- Class OSD_EnvironmentIterator is removed (not used, and would definitely fail under Windows if tried)
- Methods UserId() and GroupId() removed from OSD_FileNode (cannot be made portable, as there is no integer IDs of user and group on Windows)
- Draw_ProgressIndicator corrected to properly pass address via Tcl
- OSD_File.cxx: local function is refactored to avoid senseless encoding / decoding of results
- OSD_Process::UserId() method removed, as it cannot be made cross-platform (no integer IDs on Windows)
- OSD_Thread: use WinAPI conversion functions to avoid warnings
- OSD_WNT.cxx: recursion counter passed via function argument instead of TLS
- TDF_LabelMapHasher revised to use correct hasher function for an address
Affected Issues
0026585
mod - src/BRepFeat/BRepFeat_MakeDPrism.cxx Diff File
mod - src/DBRep/DBRep.cxx Diff File
mod - src/Draw/Draw_ProgressIndicator.cxx Diff File
mod - src/Draw/Draw_ProgressIndicator.hxx Diff File
mod - src/OSD/FILES Diff File
rm - src/OSD/OSD_EnvironmentIterator.cxx Diff File
rm - src/OSD/OSD_EnvironmentIterator.hxx Diff File
mod - src/OSD/OSD_File.cxx Diff File
mod - src/OSD/OSD_FileNode.cxx Diff File
mod - src/OSD/OSD_FileNode.hxx Diff File
mod - src/OSD/OSD_Process.cxx Diff File
mod - src/OSD/OSD_Process.hxx Diff File
mod - src/OSD/OSD_Thread.cxx Diff File
mod - src/OSD/OSD_WNT.cxx Diff File
mod - src/STEPConstruct/STEPConstruct_AP203Context.cxx Diff File
mod - src/TDF/FILES Diff File
rm - src/TDF/TDF_LabelMapHasher.cxx Diff File
mod - src/TDF/TDF_LabelMapHasher.hxx Diff File
rm - src/TDF/TDF_LabelMapHasher.lxx Diff File

Issue History

Date Modified Username Field Change
2015-08-21 11:59 ski New Issue
2015-08-21 11:59 ski Assigned To => ski
2015-08-21 11:59 ski Status new => assigned
2015-08-21 17:14 git Note Added: 0044515
2015-08-25 09:29 kgv Relationship added related to 0024574
2015-08-25 09:31 kgv Relationship added child of 0026547
2015-09-09 13:06 git Note Added: 0045306
2015-09-09 14:21 ski Note Added: 0045319
2015-09-09 14:21 ski Assigned To ski => abv
2015-09-09 14:21 ski Status assigned => resolved
2015-09-10 06:34 abv Note Added: 0045362
2015-09-10 06:34 abv Assigned To abv => ski
2015-09-10 06:34 abv Status resolved => assigned
2015-09-11 15:49 git Note Added: 0045501
2015-09-11 15:53 abv Note Added: 0045503
2015-09-23 09:44 abv Assigned To ski => rkv
2015-10-06 16:02 git Note Added: 0046522
2015-10-06 16:11 rkv Note Added: 0046523
2015-10-06 16:11 rkv Assigned To rkv => kgv
2015-10-06 16:11 rkv Status assigned => resolved
2015-10-09 16:01 git Note Added: 0046631
2015-10-09 17:14 kgv Note Added: 0046637
2015-10-09 17:14 kgv Assigned To kgv => bugmaster
2015-10-09 17:14 kgv Status resolved => reviewed
2015-10-09 17:15 kgv Note Edited: 0046637
2015-10-09 17:36 apv Assigned To bugmaster => apv
2015-10-12 12:19 apv Test case number => Not needed
2015-10-12 12:21 apv Note Added: 0046669
2015-10-12 12:21 apv Assigned To apv => bugmaster
2015-10-12 12:21 apv Status reviewed => tested
2015-10-12 13:03 kgv Note Added: 0046674
2015-10-14 12:35 kgv Relationship added related to 0026171
2015-10-16 13:18 bugmaster Changeset attached => occt master 68299304
2015-10-16 13:18 bugmaster Status tested => verified
2015-10-16 13:18 bugmaster Resolution open => fixed
2015-10-16 16:28 git Note Added: 0046948
2015-10-16 16:28 git Note Added: 0046949
2016-04-20 15:44 aiv Fixed in Version => 7.0.0
2016-04-20 15:48 aiv Status verified => closed