diff --git a/Code/CryEngine/CryCommon/AppleSpecific.h b/Code/CryEngine/CryCommon/AppleSpecific.h index 523332e9d3..830825f6cd 100644 --- a/Code/CryEngine/CryCommon/AppleSpecific.h +++ b/Code/CryEngine/CryCommon/AppleSpecific.h @@ -140,7 +140,10 @@ typedef uint8 byte; #define STDMETHODCALLTYPE #endif -#define _ALIGN(num) __attribute__ ((aligned(num))) +#define _ALIGN(num) \ + __attribute__ ((aligned(num))) \ + AZ_POP_DISABLE_WARNING + #define _PACK __attribute__ ((packed)) // Safe memory freeing diff --git a/Code/CryEngine/CryCommon/LinuxSpecific.h b/Code/CryEngine/CryCommon/LinuxSpecific.h index 85abf0ff53..361e31c791 100644 --- a/Code/CryEngine/CryCommon/LinuxSpecific.h +++ b/Code/CryEngine/CryCommon/LinuxSpecific.h @@ -104,7 +104,10 @@ typedef float FLOAT; #define STDMETHODCALLTYPE #endif -#define _ALIGN(num) __attribute__ ((aligned(num))) +#define _ALIGN(num) \ + __attribute__ ((aligned(num))) \ + AZ_POP_DISABLE_WARNING + #define _PACK __attribute__ ((packed)) // Safe memory freeing diff --git a/Code/CryEngine/CryCommon/Win32specific.h b/Code/CryEngine/CryCommon/Win32specific.h index 189bd8770b..9b8a8f75f4 100644 --- a/Code/CryEngine/CryCommon/Win32specific.h +++ b/Code/CryEngine/CryCommon/Win32specific.h @@ -111,7 +111,9 @@ int64 CryGetTicksPerSec(); } #endif -#define _MS_ALIGN(num) __declspec(align(num)) +#define _MS_ALIGN(num) \ + AZ_PUSH_DISABLE_WARNING(4324, "-Wunknown-warning-option") \ + __declspec(align(num)) #define DEFINE_ALIGNED_DATA(type, name, alignment) _declspec(align(alignment)) type name; #define DEFINE_ALIGNED_DATA_STATIC(type, name, alignment) static _declspec(align(alignment)) type name; diff --git a/Code/CryEngine/CryCommon/Win64specific.h b/Code/CryEngine/CryCommon/Win64specific.h index 00af315376..aac2b40621 100644 --- a/Code/CryEngine/CryCommon/Win64specific.h +++ b/Code/CryEngine/CryCommon/Win64specific.h @@ -93,7 +93,9 @@ int64 CryGetTicksPerSec(); } #endif -#define _MS_ALIGN(num) __declspec(align(num)) +#define _MS_ALIGN(num) \ + AZ_PUSH_DISABLE_WARNING(4324, "-Wunknown-warning-option") \ + __declspec(align(num)) #define DEFINE_ALIGNED_DATA(type, name, alignment) _declspec(align(alignment)) type name; #define DEFINE_ALIGNED_DATA_STATIC(type, name, alignment) static _declspec(align(alignment)) type name; diff --git a/Code/CryEngine/CryCommon/platform.h b/Code/CryEngine/CryCommon/platform.h index df8fb125b2..0e026d7113 100644 --- a/Code/CryEngine/CryCommon/platform.h +++ b/Code/CryEngine/CryCommon/platform.h @@ -733,12 +733,12 @@ enum ETriState // Fallback for Alignment macro of GCC/CLANG (must be after the class definition) #if !defined(_ALIGN) - #define _ALIGN(num) + #define _ALIGN(num) AZ_POP_DISABLE_WARNING #endif // Fallback for Alignment macro of MSVC (must be before the class definition) #if !defined(_MS_ALIGN) - #define _MS_ALIGN(num) + #define _MS_ALIGN(num) AZ_PUSH_DISABLE_WARNING(4324, "-Wunknown-warning-option") #endif #if defined(WIN32) || defined(WIN64) diff --git a/Code/Framework/AzCore/AzCore/PlatformDef.h b/Code/Framework/AzCore/AzCore/PlatformDef.h index d2a254356a..03c97cf965 100644 --- a/Code/Framework/AzCore/AzCore/PlatformDef.h +++ b/Code/Framework/AzCore/AzCore/PlatformDef.h @@ -96,7 +96,12 @@ #endif /// Aligns a declaration. -# define AZ_ALIGN(_decl, _alignment) __declspec(align(_alignment)) _decl +# define AZ_ALIGN(_decl, _alignment) \ + AZ_PUSH_DISABLE_WARNING(4324, "-Wunknown-warning-option") \ + __declspec(align(_alignment)) \ + _decl \ + AZ_POP_DISABLE_WARNING + /// Return the alignment of a type. This if for internal use only (use AZStd::alignment_of<>()) # define AZ_INTERNAL_ALIGNMENT_OF(_type) __alignof(_type) /// Pointer will be aliased. @@ -123,7 +128,12 @@ # define AZ_FORCE_INLINE inline /// Aligns a declaration. -# define AZ_ALIGN(_decl, _alignment) _decl __attribute__((aligned(_alignment))) +# define AZ_ALIGN(_decl, _alignment) \ + AZ_PUSH_DISABLE_WARNING(4324, "-Wunknown-warning-option") \ + _decl \ + __attribute__((aligned(_alignment))) + AZ_POP_DISABLE_WARNING + /// Return the alignment of a type. This if for internal use only (use AZStd::alignment_of<>()) # define AZ_INTERNAL_ALIGNMENT_OF(_type) __alignof__(_type) /// Pointer will be aliased. diff --git a/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.h b/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.h index ccdedb85c5..aa11d4fc7f 100644 --- a/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.h +++ b/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.h @@ -180,10 +180,7 @@ namespace AzNetworking //! Takes a quantized integral value and stores the floating point representation. void DecodeQuantizedValues(); -# if defined AZ_COMPILER_MSVC -# pragma warning(push) -# pragma warning(disable:4201) // anonymous union -# endif + AZ_PUSH_DISABLE_WARNING(4201 4324, "-Wunknown-warning-option") // anonymous union, structure was padded due to alignment union { float m_quantizedValues[NUM_ELEMENTS]; @@ -195,9 +192,7 @@ namespace AzNetworking uint32_t m_serializeValues[NUM_ELEMENTS]; SimdTypei m_serializeVector; }; -# if defined AZ_COMPILER_MSVC -# pragma warning(pop) -# endif + AZ_POP_DISABLE_WARNING template friend struct QuantizedValuesConversionHelper; diff --git a/Gems/EMotionFX/Code/Tests/Matchers.h b/Gems/EMotionFX/Code/Tests/Matchers.h index b14d6a6a78..a94d02f51b 100644 --- a/Gems/EMotionFX/Code/Tests/Matchers.h +++ b/Gems/EMotionFX/Code/Tests/Matchers.h @@ -29,7 +29,7 @@ StrEq(const AZStd::string& str) str, true, true)); } -AZ_PUSH_DISABLE_WARNING(4100, "-Wmissing-declarations") // 'result_listener': unreferenced formal parameter +AZ_PUSH_DISABLE_WARNING(4100 4324, "-Wmissing-declarations") // 'result_listener': unreferenced formal parameter, structure was padded due to alignment specifier MATCHER(StrEq, "") { const auto& lhs = testing::get<0>(arg); diff --git a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake index bcff2adeb7..b07a87a35a 100644 --- a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake +++ b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake @@ -63,12 +63,10 @@ ly_append_configurations_options( # Disabling these warnings while they get fixed /wd4018 # signed/unsigned mismatch - /wd4121 # alignment of a member was sensitive to packing /wd4244 # conversion, possible loss of data /wd4245 # conversion, signed/unsigned mismatch /wd4267 # conversion, possible loss of data /wd4310 # cast truncates constant value - /wd4324 # structure was padded due to alignment specifier /wd4389 # comparison, signed/unsigned mismatch # Enabling warnings that are disabled by default from /W4