Archived issue #0027525

Coding - eliminate warnings on Windows for OCCT with static type of libraries

Open CASCADEOCCT:Codingclosed27 public notes

Search issues

Description

warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library

Such warnings appears during occt compilation with static type of libraries.

List of problem classes:

TopTools_ShapeMapHasher
TopTools_OrientedShapeMapHasher
TopoDS_Wire
TopoDS_Vertex
TopoDS_Solid
TopoDS_Shell
TopoDS_Face
TopoDS_Edge
TopoDS_CompSolid
TopoDS_Compound
TopoDS
TNaming_RefShape
TNaming_OldShapeIterator
TNaming_NewShapeIterator
TNaming_IteratorOnShapesSet
TNaming_Iterator
TNaming_Builder
Standard_ErrorHandlerCallback
OSD_signal
BOPTools_SetMapHasher
BOPAlgo_WireEdgeSet
BOPDS_Tools
BOPDS_Point
BOPDS_PaveMapHasher
BOPDS_PassKeyMapHasher
BOPDS_PassKeyBoolean
BOPDS_FaceInfo
BOPDS_Curve
IntTools_SurfaceRangeSampleMapHasher
IntTools_CurveRangeSampleMapHasher
TopOpeBRepDS_reDEB
TObj_SequenceOfObject
MAT2d_MapBiIntHasher
BRepPrimAPI_MakeSweep
Precision
math_MultipleVarFunctionWithHessian
math_MultipleVarFunctionWithGradient
math_FunctionSetWithDerivatives
HLRAlgo_TriangleData
HLRAlgo_PolyInternalSegment
HLRAlgo_PolyHidingData
HLRBRep_LineTool
HLRBRep_CLPropsATool
GCE2d_Root
GC_Root
Extrema_POnSurfParams
Extrema_POnSurf
Extrema_Curve2dTool
IntImpParGen_ImpTool
IntPatch_PolyhedronTool
IntSurf_PathPointTool
IntSurf_InteriorPointTool
IntSurf_Couple
GeomInt_TheMultiLineToolOfWLApprox_0
LocOpe_PntFace
BRepFilletAPI_LocalOperation


Steps to reproduce

Configure and build OCCT with static type of libraries in Visual Studio

Public activity

27 archived notes

Participants are labeled by their role within this record.

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

[revision removed]


Detailed log of new commits:

Author: Author
Date: Wed Jun 29 10:46:05 2016 +0300

    0027525: Coding - eliminate warnings on Windows for OCCT with static type of libraries
    
    Useless *.cxx files were removed to eliminate linker warning LNK4221.
02Commenter 2
Dear kgv,

occt branch CR27525 and PRODUCTS branch CR27525 are ready for reviewing.
03Commenter 3
Dear Mikhail,

could you please confirm that the messy debugging stuff in TopOpeBRepDS package is still used by our team? Otherwise I would propose removing it.
04Commenter 4
Dear Kirill, this stuff is not used by modeling team, so you can remove it.
05Commenter 3
Dear Sergey,

please clean up package TopOpeBRepDS from old debugging routines (make sure to check compilation with OCCT_DEBUG enabled).

For Standard_ErrorHandlerCallback.cxx I would suggest moving the code to Standard_ErrorHandler.cxx.
06Commenter 2
Branch [archived branch] has been updated by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Mon Jul 4 12:16:18 2016 +0300

    Package TopOpeBRepDS was cleaned up from old debugging routines.

07Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
08Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
09Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
10Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
11Commenter 11
Dear kgv,

Package TopOpeBRepDS was cleaned up from old debugging routines.

please, review.
12Commenter 12
Some remarks on last commit:

1. Standard_ErrorHandlerCallback.hxx -- please revert, this class must be fully inline if _WIN32 to avoid useless calls in low-level code

2. DsgPrs.cxx: statements like "Center.Translated( vec1 );" do nothing and should be removed

3. Changes in TestTopOpe, TopOpeBRepBuild, TopOpeBRepDS, BRepAlgo_BooleanOperation: before committing these changes, please check that everything compiles with OCCT_DEBUG and verify with modelling team that the removed code is not useful for their needs
13Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
14Commenter 14
1) I have reverted changes in Standard_ErrorHandlerCallback.*xx files.
What is the best solution to avoid linker warning LNK4221 here:
• Move the code to Standard_ErrorHandler.cxx as it was suggested by Commenter 3
• Use temporary variable in anonymous namespace as it was done in first commit of the branch

2) Done

3) I have already checked all changes on Windows/Linux stations with/without OCCT_DEBUG, so, maybe only final verifying of changes by modelling team is needed.

15Commenter 15
As far as I know the debug code in TopOpeBRep* classes is not used by modeling team members. So we can remove it.

Dear Igor (IFV), please tell if you have objections.
16Commenter 16
For point (1): I propose moving class Standard_ErrorHandlerCallback into the Standard_ErrorHandler as nested class Callback. Besides, field Standard_ErrorHandler::myCallbackPtr can be made pointer to actual type instead of Standard_Address, to avoid meaningless pointer casts.

For compatibility, we can keep definition of the old name as typedef:

typedef Standard_ErrorHandler::Callback Standard_ErrorHandlerCallback;

but I believe this is unlikely useful. Just mention the rename in upgrade.md.
17Commenter 3
Please also merge OSD_signal_WNT.cxx into OSD_signal.cxx
18Commenter 2
Branch [archived branch] has been updated by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Wed Jul 6 12:58:34 2016 +0300

    Class Standard_ErrorHandlerCallback was moved into the Standard_ErrorHandler class as nested class Callback

Author: Author
Date: Wed Jul 6 10:40:52 2016 +0300

    Merged OSD_signal_WNT.cxx into OSD_signal.cxx

19Commenter 19
Dear kgv,

Files Standard_ErrorHandlerCallback.*xx were merged into [archived branch]*xx.

File OSD_signal_WNT.cxx was merged into [archived branch]

I have checked compilation on:
• win64 vc10 Release
• win64 vc10 Release with static libraries (to check warnings LNK4221)
• win64 vc10 Debug with OCCT_DEBUG
• lin release
• lin debug with OCCT_DEBUG

All linker warnings LNK4221 were eliminated.

Please, review.
20Commenter 3
Please test the patch.

I would expect the files TestTopOpeTools_TraceCommands.cxx, TestTopOpeTools_Trace.hxx, TestTopOpeTools_TraceCommands.cxx and their references to be removed as well... But we can do it later if modeling team has no objections.
21Commenter 1
Fix has been tested on :

Debian 70 - dynamic
New warning:
http://jenkins-test-03.nnov.opencascade.com/view/CR27525/view/OCCT%20compile/job/CR27525_CR27525-OCCT-Debian70-64-opt-compile/1/warnings18Result/

Debian 80 - static
New warning
http://jenkins-test-03.nnov.opencascade.com/view/CR27525/view/OCCT%20compile/job/CR27525_CR27525-OCCT-Debian80-64-opt-compile/1/warnings18Result/new/

Windows VC 2010 - dynamic
Not warnings
Windows VC 2011 - static
Not warnings

Testing :
Regressions were not detected
22Commenter 2
Branch [archived branch] has been updated by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Fri Jul 8 16:18:57 2016 +0300

    Eliminated warning about unused variable.

23Commenter 23
Fixed.
24Commenter 2
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
25Commenter 1
Warnings were eliminated
26Commenter 3
> reviewed => verified
I suppose this should be in "tested" state.
27Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]