MantisBT - Open CASCADE
View Issue Details
0029128Open CASCADE[OCCT] OCCT:Codingpublic2017-09-20 19:172019-07-10 18:56
[OCCT] 7.4.0[OCCT] 7.4.0 
0029128: Cross-platform macro for enabling compiler warnings suppressed by third-party products
As 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.
No tags attached.
related to 0029310closed bugmaster Coding - multiple compiler warnings in Inspectors 
related to 0029909closed bugmaster Porting to Debian80-64 : Coding - GCC compiler warnings in Qt headers while building Samples in OCCT and Products 
child of 0028452closed bugmaster VIS - MSVC 14 compiler warnings 
Issue History
2017-09-20 19:17sanNew Issue
2017-09-20 19:17sanAssigned To => kgv
2017-09-20 19:18sanRelationship addedchild of 0028452
2017-10-23 09:05abvNote Added: 0071691
2017-10-23 09:05abvAssigned Tokgv => san
2017-10-23 09:05abvStatusnew => feedback
2017-10-23 09:10BenjaminBihlerNote Added: 0071692
2019-07-10 18:52abvRelationship addedrelated to 0029310
2019-07-10 18:53abvRelationship addedrelated to 0029909
2019-07-10 18:56abvNote Added: 0085563
2019-07-10 18:56abvStatusfeedback => verified
2019-07-10 18:56abvResolutionopen => fixed

2017-10-23 09:05   
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   
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   
The new headers Standard_WarningsDisable.hxx and Standard_WarningsRestore.hxx implementing this feature have been added within 0029310 and 0029909