@Marek R Thanks for your message. What we are trying to do is this. Suppose we have some logic that needs to be deprecated, we want to wrap it this way:
#ifdef MYLIB_ENABLE_DEPRECATED_CODE
MYLIB_IMPL_DISABLE_DEPRECATED_WARNINGS_PUSH()
... some deprecated code ...
MYLIB_IMPL_DISABLE_DEPRECATED_WARNINGS_POP()
#endif
The deprecated code could be anything. MYLIB_IMPL_DISABLE_DEPRECATED_WARNINGS_PUSH() and MYLIB_IMPL_DISABLE_DEPRECATED_WARNINGS_POP() are based on #pragma GCC diagnostic push and #pragma GCC diagnostic pop.
Suppose we only do this:
#ifdef MYLIB_ENABLE_DEPRECATED_CODE
... some deprecated code ...
#endif
Then warnings could be emitted from the deprecated code and they are caught by -Werror. So my goal really comes down to identifying blocks marked by #ifdef MYLIB_ENABLE_DEPRECATED_CODE and #endif and adding MYLIB_IMPL_DISABLE_DEPRECATED_WARNINGS_PUSH() and MYLIB_IMPL_DISABLE_DEPRECATED_WARNINGS_POP() if they are missing.