Add PRAGMA_DISABLE_DEPRECATION_WARNINGS and PRAGMA_ENABLE_DEPRECATION_WARNINGS macros

This commit is contained in:
Wojtek Figat
2021-10-14 11:07:12 +02:00
parent 3bb7f83729
commit 05ebf60dba
3 changed files with 18 additions and 26 deletions

View File

@@ -20,6 +20,11 @@
#define ALIGN_END(_align) __attribute__( (aligned(_align) ) )
#define OFFSET_OF(X, Y) __builtin_offsetof(X, Y)
#define DEPRECATED [[deprecated]]
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic warning \"-Wdeprecated-declarations\"")
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS \
_Pragma("clang diagnostic pop")
#pragma clang diagnostic ignored "-Wswitch"
#pragma clang diagnostic ignored "-Wmacro-redefined"
@@ -45,30 +50,8 @@
#define ALIGN_END(_align) __attribute__( (aligned(_align) ) )
#define OFFSET_OF(X, Y) __builtin_offsetof(X, Y)
#define DEPRECATED [[deprecated]]
#elif defined(__INTEL_COMPILER)
#define DLLEXPORT ??
#define DLLIMPORT ??
#if _WIN32
#define THREADLOCAL __declspec(thread)
#else
#define THREADLOCAL __thread
#endif
#define STDCALL __stdcall
#define CDECL __cdecl
#define RESTRICT
#define INLINE inline
#define FORCE_INLINE inline
#define FORCE_NOINLINE
#define NO_RETURN ??
#define PACK_BEGIN() ??
#define PACK_END() ??
#define ALIGN_BEGIN(_align) ??
#define ALIGN_END(_align) ??
#define OFFSET_OF(X, Y) ??
#define DEPRECATED ??
#define __PRETTY_FUNCTION__ ??
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
#elif defined(_MSC_VER)
@@ -94,6 +77,12 @@
#define DEPRECATED __declspec(deprecated)
#undef __PRETTY_FUNCTION__
#define __PRETTY_FUNCTION__ __FUNCSIG__
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS \
__pragma(warning(push)) \
__pragma(warning(disable: 4995)) \
__pragma(warning(disable: 4996))
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS \
__pragma (warning(pop))
#pragma warning(disable: 4251)

View File

@@ -1311,6 +1311,7 @@ namespace Flax.Build.Bindings
contents.Append("true").AppendLine();
contents.AppendLine("// This code was auto-generated. Do not modify it.");
contents.AppendLine();
contents.AppendLine("#pragma warning disable 0612"); // Disable Obsolete warnings in generated code
var headerPos = contents.Length;
CSharpUsedNamespaces.Clear();

View File

@@ -2062,8 +2062,8 @@ namespace Flax.Build.Bindings
contents.AppendLine("// This code was auto-generated. Do not modify it.");
contents.AppendLine();
if (buildData.Platform is Platforms.WindowsPlatformBase)
contents.AppendLine("#pragma warning(disable: 4996)").AppendLine(); // Ignore deprecated warnings
contents.AppendLine("#include \"Engine/Core/Compiler.h\"");
contents.AppendLine("PRAGMA_DISABLE_DEPRECATION_WARNINGS"); // Disable deprecated warnings in generated code
contents.AppendLine("#include \"Engine/Scripting/Scripting.h\"");
contents.AppendLine("#include \"Engine/Scripting/InternalCalls.h\"");
contents.AppendLine("#include \"Engine/Scripting/ManagedCLR/MUtils.h\"");
@@ -2459,6 +2459,8 @@ namespace Flax.Build.Bindings
contents.Insert(headerPos, header.ToString());
}
contents.AppendLine("PRAGMA_ENABLE_DEPRECATION_WARNINGS");
Utilities.WriteFileIfChanged(bindings.GeneratedCppFilePath, contents.ToString());
}