Преглед на файлове

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.
Sebastian Beckmann преди 2 месеца
родител
ревизия
609cf6168e
променени са 1 файла, в които са добавени 4 реда и са изтрити 0 реда
  1. 4 0
      libobs/util/c99defs.h

+ 4 - 0
libobs/util/c99defs.h

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