mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-30 17:58:37 +08:00
libobs/util: Add PRAGMA_DISABLE_DEPRECATION macro
On MSVC, PRAGMA_WARN_DEPRECATION already does that, but on other compilers it still throws a warning. PRAGMA_DISABLE_DEPRECATION is for (rare) situations where it's intentional and correct that the deprecated API is still used, such as to make sure some other API still works internally.
This commit is contained in:
committed by
Ryan Foster
parent
e187f9acee
commit
609cf6168e
@@ -55,18 +55,22 @@
|
||||
#define PRAGMA_WARN_PUSH _Pragma("warning(push)")
|
||||
#define PRAGMA_WARN_POP _Pragma("warning(pop)")
|
||||
#define PRAGMA_WARN_DEPRECATION _Pragma("warning(disable: 4996)")
|
||||
#define PRAGMA_DISABLE_DEPRECATION _Pragma("warning(disable: 4996)")
|
||||
#elif defined(__clang__)
|
||||
#define PRAGMA_WARN_PUSH _Pragma("clang diagnostic push")
|
||||
#define PRAGMA_WARN_POP _Pragma("clang diagnostic pop")
|
||||
#define PRAGMA_WARN_DEPRECATION _Pragma("clang diagnostic warning \"-Wdeprecated-declarations\"")
|
||||
#define PRAGMA_DISABLE_DEPRECATION _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
|
||||
#elif defined(__GNUC__)
|
||||
#define PRAGMA_WARN_PUSH _Pragma("GCC diagnostic push")
|
||||
#define PRAGMA_WARN_POP _Pragma("GCC diagnostic pop")
|
||||
#define PRAGMA_WARN_DEPRECATION _Pragma("GCC diagnostic warning \"-Wdeprecated-declarations\"")
|
||||
#define PRAGMA_DISABLE_DEPRECATION _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
|
||||
#else
|
||||
#define PRAGMA_WARN_PUSH
|
||||
#define PRAGMA_WARN_POP
|
||||
#define PRAGMA_WARN_DEPRECATION
|
||||
#define PRAGMA_DISABLE_DEPRECATION
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
Reference in New Issue
Block a user