DiscussionsIssue archiveOCCT:Configuration

Archived issue #0028838

Configuration - undefine macros coming from X11 headers in place of collision

Open CASCADEOCCT:Configurationclosed7 public notes

Search issues

Description

Currently several name collisions coming from X11 headers (macros Status, Convex, Opposite, FillSolid) are undefined within special header file InterfaceGraphic.hxx, which is supposed to be included instead of X11 headers.

This solution, however, is not very flexible - e.g. user have to know about InterfaceGraphic.hxx existence (while name collision occurs when using other OCCT header files) and conflicts with compilation techniques like precompiled headers.

Therefore, it is proposed to undefined name collisions in the place of their occurrence (e.g. in header files of OCCT classes using the same names as X11 macros). This will not solve the name collision issue completely (user might include X11 after OCCT headers which will make OCCT methods inaccessible), but improve the situation to some degree.

Steps to reproduce

N/A

Public activity

7 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: ski
Date: Wed Feb 15 16:49:23 2017 +0300

    Undefine Convex within TopoDS_TVertex.hxx

Author: abv
Date: Sat Feb 11 09:15:32 2017 +0300

    Undefine CurrentDirectory macro in OSD_Process.hxx to avoid conflict due to possible previous inclusion of windows.h

Author: Author
Date: Sat Feb 4 13:55:42 2017 +0300

    The macros AddPrinter (coming from WinAPI headers) is now undefined
    within Message_Messenger class definition having method with the same name.

Author: Author
Date: Sat Feb 4 11:17:02 2017 +0300

    The macros Status, Convex, Opposite, FillSolid (coming from X11 headers)
    are now undefined in place of definition of methods with same name in OCCT headers.
    The usage of variables with name Status is now avoided.

Author: Author
Date: Fri Feb 3 23:27:02 2017 +0400

    Define GL_GLEXT_LEGACY only if not already defined
02Commenter 2
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Fri Feb 3 23:27:02 2017 +0400

    0028838: Configuration - undefine macros coming from X11 headers in place of collision
    
    The macros Status, Convex, Opposite, FillSolid (coming from X11 headers)
    are now undefined in place of definition of methods with same name in OCCT headers.
    The usage of variables with name Status is now avoided.
    
    GL_GLEXT_LEGACY is now defined only if not already defined.
    
    The macros AddPrinter (coming from WinAPI headers) is now undefined
    within Message_Messenger class definition having method with the same name.
    CurrentDirectory macro is now undefined in OSD_Process.hxx.
03Author
Please test the patch.
04Commenter 4
Dear Commenter 1,
Branch CR28838_1 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
[revision removed]

Number of compiler warnings:

occt component :
Linux: 0 (0 on master)
Windows: 0 (0 on master)
MacOS : 0 (0 on master)

products component :
Linux: 64 (64 on master)
Windows: 0 (0 on master)
MacOS : 1206

Regressions/Differences/Improvements:
No regressions/differences

Testing cases:
Not needed

Testing on Linux:
occt component :
Total MEMORY difference: 92333642 / 92077580 [+0.28%]
Total CPU difference: 18965.39000000024 / 18989.35000000035 [-0.13%]
products component :
Total MEMORY difference: 33704984 / 33656232 [+0.14%]
Total CPU difference: 6154.110000000062 / 6179.4300000000685 [-0.41%]
Testing on Windows:
occt component :
Total MEMORY difference: 58687336 / 58684365 [+0.01%]
Total CPU difference: 17411.162409298686 / 17488.726106498834 [-0.44%]
products component :
Total MEMORY difference: 24263943 / 24224898 [+0.16%]
Total CPU difference: 6108.952359700067 / 6164.207913900061 [-0.90%]

There are no differences in images found by testdiff.
05Commenter 5
Dear Commenter 1,
Branch CR28838_1 from occt git-repository is TESTED.
06Commenter 2
Branch [archived branch] has been deleted by Author.

[revision removed]
07Commenter 2
Branch [archived branch] has been deleted by Author.

[revision removed]

Related records