From a548fbb4f6f6e6a415f2717b79fea6c786201ac8 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Wed, 9 Sep 2020 18:49:58 +0200 Subject: [PATCH] C++: Disable C4359 for 32-bit scaffolding --- Il2CppInspector.Common/Outputs/CppScaffolding.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Il2CppInspector.Common/Outputs/CppScaffolding.cs b/Il2CppInspector.Common/Outputs/CppScaffolding.cs index 0d86472..e0e3162 100644 --- a/Il2CppInspector.Common/Outputs/CppScaffolding.cs +++ b/Il2CppInspector.Common/Outputs/CppScaffolding.cs @@ -63,6 +63,13 @@ typedef size_t uintptr_t; if (model.TargetCompiler == CppCompilerType.MSVC) writeCode("#pragma warning(disable : 4309)"); + // MSVC will (rightly) throw a compiler warning when compiling for 32-bit architectures + // if the specified alignment of a type is smaller than the size of its largest element. + // We keep the alignments in to make them match Il2CppObject wherever possible, but it is + // safe to ignore them if they are too small, so we just disable the warning + if (model.TargetCompiler == CppCompilerType.MSVC) + writeCode("#pragma warning(disable : 4359)"); + // C does not support namespaces writeCode("#if !defined(_GHIDRA_) && !defined(_IDA_)"); writeCode("namespace app {");