View Issue Details

IDProjectCategoryView StatusLast Update
0029128Open CASCADEOCCT:Codingpublic2019-07-10 18:56
Reportersan Assigned Tosan  
Status closedResolutionfixed 
Target Version7.4.0Fixed in Version7.4.0 
Summary0029128: Cross-platform macro for enabling compiler warnings suppressed by third-party products
DescriptionAs mentioned in comment 0028452:0070334, we sometimes have to deal with compiler warnings suppressed by third-party headers included in some OCCT or application source file. As a result, warnings resulted from the source file itself are also suppressed - this results in decreased OCCT/application code quality.

Quick solution implemented in issue 0028452 is to use #pragma warning(push) before the third-party headers and #pragma warning(pop) right after it. This is a Microsoft-specific solution.
So it is preferred to define a reusable pair of macros for pushing/popping warnings - see "#pragma GCC diagnostic push/pop" available in gcc 4.6+ and similar commands in CLang.

For convenience and work optimization, it is proposed to put these macros to some common header in OCCT to make them available to OCCT-based applications.
TagsNo tags attached.
Test case number


related to 0029310 closedbugmaster Coding - multiple compiler warnings in Inspectors 
related to 0029909 closedbugmaster Porting to Debian80-64 : Coding - GCC compiler warnings in Qt headers while building Samples in OCCT and Products 
child of 0028452 closedbugmaster VIS - MSVC 14 compiler warnings 



2017-10-23 09:05

manager   ~0071691

Sergey, I'm afraid that we cannot create a macro like you proposed. The problem is that you cannot define a macro containing preprocessor directive -- this will not work (preprocessor is one-pass, and # inside a macro is stringizing operator).

It could be possible to put this kind of macros in header file(s), and #include it (them) to trigger the warnings,.. but do we want that?


2017-10-23 09:10

reporter   ~0071692

With g++ there is the possibility to add an include path with "-isystem" instead of "-I". Then no warnings are printed from those include files.


2019-07-10 18:56

manager   ~0085563

The new headers Standard_WarningsDisable.hxx and Standard_WarningsRestore.hxx implementing this feature have been added within 0029310 and 0029909

Issue History

Date Modified Username Field Change
2017-09-20 19:17 san New Issue
2017-09-20 19:17 san Assigned To => kgv
2017-09-20 19:18 san Relationship added child of 0028452
2017-10-23 09:05 abv Note Added: 0071691
2017-10-23 09:05 abv Assigned To kgv => san
2017-10-23 09:05 abv Status new => feedback
2017-10-23 09:10 BenjaminBihler Note Added: 0071692
2019-07-10 18:52 abv Relationship added related to 0029310
2019-07-10 18:53 abv Relationship added related to 0029909
2019-07-10 18:56 abv Note Added: 0085563
2019-07-10 18:56 abv Status feedback => verified
2019-07-10 18:56 abv Resolution open => fixed