SPEC-2513 Fixes to enable w4324 (#1197)

* Fix warning 4324

* warning that doesnt trigger anything

* missed warning
This commit is contained in:
Esteban Papp
2021-06-09 11:33:13 -07:00
committed by GitHub
parent 5bdf9e3c6d
commit 68ffdd6714
9 changed files with 31 additions and 18 deletions
+4 -1
View File
@@ -140,7 +140,10 @@ typedef uint8 byte;
#define STDMETHODCALLTYPE #define STDMETHODCALLTYPE
#endif #endif
#define _ALIGN(num) __attribute__ ((aligned(num))) #define _ALIGN(num) \
__attribute__ ((aligned(num))) \
AZ_POP_DISABLE_WARNING
#define _PACK __attribute__ ((packed)) #define _PACK __attribute__ ((packed))
// Safe memory freeing // Safe memory freeing
+4 -1
View File
@@ -104,7 +104,10 @@ typedef float FLOAT;
#define STDMETHODCALLTYPE #define STDMETHODCALLTYPE
#endif #endif
#define _ALIGN(num) __attribute__ ((aligned(num))) #define _ALIGN(num) \
__attribute__ ((aligned(num))) \
AZ_POP_DISABLE_WARNING
#define _PACK __attribute__ ((packed)) #define _PACK __attribute__ ((packed))
// Safe memory freeing // Safe memory freeing
+3 -1
View File
@@ -111,7 +111,9 @@ int64 CryGetTicksPerSec();
} }
#endif #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(type, name, alignment) _declspec(align(alignment)) type name;
#define DEFINE_ALIGNED_DATA_STATIC(type, name, alignment) static _declspec(align(alignment)) type name; #define DEFINE_ALIGNED_DATA_STATIC(type, name, alignment) static _declspec(align(alignment)) type name;
+3 -1
View File
@@ -93,7 +93,9 @@ int64 CryGetTicksPerSec();
} }
#endif #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(type, name, alignment) _declspec(align(alignment)) type name;
#define DEFINE_ALIGNED_DATA_STATIC(type, name, alignment) static _declspec(align(alignment)) type name; #define DEFINE_ALIGNED_DATA_STATIC(type, name, alignment) static _declspec(align(alignment)) type name;
+2 -2
View File
@@ -733,12 +733,12 @@ enum ETriState
// Fallback for Alignment macro of GCC/CLANG (must be after the class definition) // Fallback for Alignment macro of GCC/CLANG (must be after the class definition)
#if !defined(_ALIGN) #if !defined(_ALIGN)
#define _ALIGN(num) #define _ALIGN(num) AZ_POP_DISABLE_WARNING
#endif #endif
// Fallback for Alignment macro of MSVC (must be before the class definition) // Fallback for Alignment macro of MSVC (must be before the class definition)
#if !defined(_MS_ALIGN) #if !defined(_MS_ALIGN)
#define _MS_ALIGN(num) #define _MS_ALIGN(num) AZ_PUSH_DISABLE_WARNING(4324, "-Wunknown-warning-option")
#endif #endif
#if defined(WIN32) || defined(WIN64) #if defined(WIN32) || defined(WIN64)
+12 -2
View File
@@ -96,7 +96,12 @@
#endif #endif
/// Aligns a declaration. /// 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<>()) /// Return the alignment of a type. This if for internal use only (use AZStd::alignment_of<>())
# define AZ_INTERNAL_ALIGNMENT_OF(_type) __alignof(_type) # define AZ_INTERNAL_ALIGNMENT_OF(_type) __alignof(_type)
/// Pointer will be aliased. /// Pointer will be aliased.
@@ -123,7 +128,12 @@
# define AZ_FORCE_INLINE inline # define AZ_FORCE_INLINE inline
/// Aligns a declaration. /// 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<>()) /// Return the alignment of a type. This if for internal use only (use AZStd::alignment_of<>())
# define AZ_INTERNAL_ALIGNMENT_OF(_type) __alignof__(_type) # define AZ_INTERNAL_ALIGNMENT_OF(_type) __alignof__(_type)
/// Pointer will be aliased. /// Pointer will be aliased.
@@ -180,10 +180,7 @@ namespace AzNetworking
//! Takes a quantized integral value and stores the floating point representation. //! Takes a quantized integral value and stores the floating point representation.
void DecodeQuantizedValues(); void DecodeQuantizedValues();
# if defined AZ_COMPILER_MSVC AZ_PUSH_DISABLE_WARNING(4201 4324, "-Wunknown-warning-option") // anonymous union, structure was padded due to alignment
# pragma warning(push)
# pragma warning(disable:4201) // anonymous union
# endif
union union
{ {
float m_quantizedValues[NUM_ELEMENTS]; float m_quantizedValues[NUM_ELEMENTS];
@@ -195,9 +192,7 @@ namespace AzNetworking
uint32_t m_serializeValues[NUM_ELEMENTS]; uint32_t m_serializeValues[NUM_ELEMENTS];
SimdTypei m_serializeVector; SimdTypei m_serializeVector;
}; };
# if defined AZ_COMPILER_MSVC AZ_POP_DISABLE_WARNING
# pragma warning(pop)
# endif
template <AZStd::size_t NUM_ELEMENTS2, AZStd::size_t NUM_BYTES2, int32_t MIN_VALUE2, int32_t MAX_VALUE2> template <AZStd::size_t NUM_ELEMENTS2, AZStd::size_t NUM_BYTES2, int32_t MIN_VALUE2, int32_t MAX_VALUE2>
friend struct QuantizedValuesConversionHelper; friend struct QuantizedValuesConversionHelper;
+1 -1
View File
@@ -29,7 +29,7 @@ StrEq(const AZStd::string& str)
str, true, true)); 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, "") MATCHER(StrEq, "")
{ {
const auto& lhs = testing::get<0>(arg); const auto& lhs = testing::get<0>(arg);
@@ -63,12 +63,10 @@ ly_append_configurations_options(
# Disabling these warnings while they get fixed # Disabling these warnings while they get fixed
/wd4018 # signed/unsigned mismatch /wd4018 # signed/unsigned mismatch
/wd4121 # alignment of a member was sensitive to packing
/wd4244 # conversion, possible loss of data /wd4244 # conversion, possible loss of data
/wd4245 # conversion, signed/unsigned mismatch /wd4245 # conversion, signed/unsigned mismatch
/wd4267 # conversion, possible loss of data /wd4267 # conversion, possible loss of data
/wd4310 # cast truncates constant value /wd4310 # cast truncates constant value
/wd4324 # structure was padded due to alignment specifier
/wd4389 # comparison, signed/unsigned mismatch /wd4389 # comparison, signed/unsigned mismatch
# Enabling warnings that are disabled by default from /W4 # Enabling warnings that are disabled by default from /W4