Arfrever Frehtes Taifersar Arahesis added the comment: _Pragma syntax would be more suitable since it could be used with macros: https://gcc.gnu.org/onlinedocs/gcc-6.2.0/cpp/Pragmas.html
Then Include/pyport.h (which defines Py_DEPRECATED) could also define: #if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) #define Py_COMPILER_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") #define Py_COMPILER_DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") #define Py_COMPILER_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") #else #define Py_COMPILER_DIAGNOSTIC_PUSH #define Py_COMPILER_DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS #define Py_COMPILER_DIAGNOSTIC_POP #endif These macros would be used in this way: void some_function(void) { int x, y; Py_COMPILER_DIAGNOSTIC_PUSH Py_COMPILER_DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS x = some_deprecated_function(); Py_COMPILER_DIAGNOSTIC_POP y = x + 1; } ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19569> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com