In my code base, I have an include file ( MyBaseDefinitions.h ) that does a pragma diagnostic push and then disables a lot of warnings. If you want to re-enable these warnings, you simply include one more heading that pragma diagnostic pop does ( EndMyBaseDefinitions.h ).
This seems to work just fine, with the exception of Clang, when placing MyBaseDefinitions.h in a precompiled header. It appears that the diagnostic βstackβ is lost when it is in a precompiled header. So let's say that I have MyPrecompiledHeader.h and it has:
#include "MyBaseDefinitions.h" // does the pragma diagnostic push
And here in my demo file I:
#include "MyPrecompiledHeader.h" #include "HeaderExample1.h"
I will get a warning:
error : pragma diagnostic pop could not pop, no matching push [-Werror,-Wunknown-pragmas]
Is this a known issue? Obviously, ideally, I would not need to turn off the warning altogether, but try to ignore this detail if possible.
- Joel
source share