79812402

Date: 2025-11-07 13:46:24
Score: 1
Natty:
Report link

@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.

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Marek
  • Self-answer (0.5):
Posted by: Hari