diff --git a/Code/Framework/AzCore/AzCore/Jobs/Algorithms.h b/Code/Framework/AzCore/AzCore/Jobs/Algorithms.h index 27efde7e64..a45846c107 100644 --- a/Code/Framework/AzCore/AzCore/Jobs/Algorithms.h +++ b/Code/Framework/AzCore/AzCore/Jobs/Algorithms.h @@ -13,11 +13,6 @@ #include -#ifdef AZ_COMPILER_MSVC -# pragma warning(push) -# pragma warning(disable: 4355) // 'this' : used in base member initializer list -#endif - // A reasonable define for a stack allocator size for the high level jobs. #define AZ_JOBS_DEFAULT_STACK_ALLOCATOR_SIZE AZStd::GetMax(2048,512 * AZStd::thread::hardware_concurrency()) @@ -769,9 +764,5 @@ namespace AZ } } -#ifdef AZ_COMPILER_MSVC -# pragma warning(pop) -#endif - #endif #pragma once diff --git a/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathVec4_scalar.inl b/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathVec4_scalar.inl index 7320c9be1c..484351c799 100644 --- a/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathVec4_scalar.inl +++ b/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathVec4_scalar.inl @@ -10,12 +10,9 @@ #include -#ifdef _MSC_VER // Unity builds on windows using the scalar backend are tripping some really strange warning behavior.. // Disable the warning so we can test the scalar implementation with unity on windows -# pragma warning (push) -# pragma warning (disable: 4723) // Potential divide by zero -#endif +AZ_PUSH_DISABLE_WARNING(4723, "-Wunknown-warning-option") // Potential divide by zero namespace AZ { @@ -1049,6 +1046,4 @@ namespace AZ } } -#ifdef _MSC_VER -# pragma warning (pop) -#endif +AZ_POP_DISABLE_WARNING \ No newline at end of file diff --git a/Code/Framework/AzCore/AzCore/Math/Quaternion.h b/Code/Framework/AzCore/AzCore/Math/Quaternion.h index 36def91817..f2c266ed3e 100644 --- a/Code/Framework/AzCore/AzCore/Math/Quaternion.h +++ b/Code/Framework/AzCore/AzCore/Math/Quaternion.h @@ -246,10 +246,6 @@ namespace AZ //! Takes the absolute value of each component of the quaternion. Quaternion GetAbs() const; -#ifdef AZ_COMPILER_MSVC -# pragma warning(push) -# pragma warning(disable:4201) // anonymous union -#endif union { Simd::Vec4::FloatType m_value; @@ -263,9 +259,6 @@ namespace AZ float m_w; }; }; -#ifdef AZ_COMPILER_MSVC -# pragma warning(pop) -#endif }; //! Non-member functionality belonging to the AZ namespace diff --git a/Code/Framework/AzCore/AzCore/Math/Vector2.h b/Code/Framework/AzCore/AzCore/Math/Vector2.h index c667f48010..b2b1ceeb4d 100644 --- a/Code/Framework/AzCore/AzCore/Math/Vector2.h +++ b/Code/Framework/AzCore/AzCore/Math/Vector2.h @@ -281,10 +281,6 @@ namespace AZ private: -#ifdef AZ_COMPILER_MSVC -# pragma warning(push) -# pragma warning(disable:4201) // anonymous union -#endif union { Simd::Vec2::FloatType m_value; @@ -296,9 +292,6 @@ namespace AZ float m_y; }; }; -#ifdef AZ_COMPILER_MSVC -# pragma warning(pop) -#endif }; //! Allows pre-multiplying by a float. diff --git a/Code/Framework/AzCore/AzCore/Math/Vector3.h b/Code/Framework/AzCore/AzCore/Math/Vector3.h index 6b7ded5641..4bf0a18894 100644 --- a/Code/Framework/AzCore/AzCore/Math/Vector3.h +++ b/Code/Framework/AzCore/AzCore/Math/Vector3.h @@ -312,10 +312,6 @@ namespace AZ private: -#ifdef AZ_COMPILER_MSVC -# pragma warning(push) -# pragma warning(disable:4201) // anonymous union -#endif union { Simd::Vec3::FloatType m_value; @@ -328,9 +324,6 @@ namespace AZ float m_z; }; }; -#ifdef AZ_COMPILER_MSVC -# pragma warning(pop) -#endif }; //! Non member functionality belonging to the AZ namespace. diff --git a/Code/Framework/AzCore/AzCore/Math/Vector4.h b/Code/Framework/AzCore/AzCore/Math/Vector4.h index 7ae0350805..6bd67e8831 100644 --- a/Code/Framework/AzCore/AzCore/Math/Vector4.h +++ b/Code/Framework/AzCore/AzCore/Math/Vector4.h @@ -283,11 +283,6 @@ namespace AZ Simd::Vec4::FloatType GetSimdValue() const; protected: - -#ifdef AZ_COMPILER_MSVC -# pragma warning(push) -# pragma warning(disable:4201) // anonymous union -#endif union { Simd::Vec4::FloatType m_value; @@ -301,9 +296,6 @@ namespace AZ float m_w; }; }; -#ifdef AZ_COMPILER_MSVC -# pragma warning(pop) -#endif }; } diff --git a/Code/Framework/AzCore/AzCore/Memory/dlmalloc.inl b/Code/Framework/AzCore/AzCore/Memory/dlmalloc.inl index 861e2de7ac..3756fbb36c 100644 --- a/Code/Framework/AzCore/AzCore/Memory/dlmalloc.inl +++ b/Code/Framework/AzCore/AzCore/Memory/dlmalloc.inl @@ -1294,14 +1294,6 @@ int mspace_mallopt(int, int); /*------------------------------ internal #includes ---------------------- */ -#ifdef WIN32 -#pragma warning(push) -#pragma warning( disable : 4146 ) /* no "unsigned" warnings */ -# ifdef AZ_PLATFORM_WINDOWS -# pragma warning( disable : 4267 ) -# endif -#endif /* WIN32 */ - #include /* for printing in malloc_stats */ #ifndef LACKS_ERRNO_H @@ -2170,7 +2162,7 @@ typedef unsigned int flag_t; /* The type of various bit flag sets */ #define align_as_chunk(A) (mchunkptr)((A) + align_offset(chunk2mem(A))) /* Bounds on request (not chunk) sizes. */ -#define MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2) +#define MAX_REQUEST ((~MIN_CHUNK_SIZE + 1) << 2) #define MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE) /* pad request bytes into a usable size */ @@ -2881,10 +2873,10 @@ static size_t traverse_and_check(mstate m); #define treemap_is_marked(M, i) ((M)->treemap & idx2bit(i)) /* isolate the least set bit of a bitmap */ -#define least_bit(x) ((x) & - (x)) +#define least_bit(x) ((x) & (~(x)+1)) /* mask with all bits to left of least bit of x on */ -#define left_bits(x) ((x << 1) | -(x << 1)) +#define left_bits(x) ((x << 1) | (~(x << 1)+1)) /* mask with all bits to left of or equal to least bit of x on */ #define same_or_left_bits(x) ((x) | -(x)) @@ -4528,7 +4520,7 @@ static int sys_trim(mstate m, size_t pad) static void* tmalloc_large(mstate m, size_t nb) { tchunkptr v = 0; - size_t rsize = -nb; /* Unsigned negation */ + size_t rsize = ~nb+1; /* Unsigned negation */ tchunkptr t; bindex_t idx; compute_tree_index(nb, idx); @@ -4807,7 +4799,7 @@ static void* internal_memalign(mstate m, size_t alignment, size_t bytes) char* br = (char*)mem2chunk((size_t)(((size_t)(mem + alignment - SIZE_T_ONE)) & - - alignment)); + (~alignment+1))); char* pos = ((size_t)(br - (char*)(p)) >= MIN_CHUNK_SIZE) ? br : br + alignment; mchunkptr newp = (mchunkptr)pos; @@ -5489,7 +5481,7 @@ postaction: size_t msize; ensure_initialization(); msize = pad_request(sizeof(struct malloc_state)); - if (capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) + if (capacity < (~(msize + TOP_FOOT_SIZE + mparams.page_size)+1)) { size_t rs = ((capacity == 0) ? mparams.granularity : (capacity + TOP_FOOT_SIZE + msize)); @@ -5512,7 +5504,7 @@ postaction: ensure_initialization(); msize = pad_request(sizeof(struct malloc_state)); if (capacity > msize + TOP_FOOT_SIZE && - capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) + capacity < (~(msize + TOP_FOOT_SIZE + mparams.page_size)+1)) { m = init_user_mstate((char*)base, capacity); m->seg.sflags = EXTERN_BIT; @@ -6367,6 +6359,3 @@ postaction: */ -#ifdef WIN32 -#pragma warning(pop) -#endif /* WIN32 */ diff --git a/Code/Framework/AzCore/AzCore/PlatformDef.h b/Code/Framework/AzCore/AzCore/PlatformDef.h index 55126fdf4c..47f45931ba 100644 --- a/Code/Framework/AzCore/AzCore/PlatformDef.h +++ b/Code/Framework/AzCore/AzCore/PlatformDef.h @@ -87,9 +87,6 @@ #define AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING AZ_POP_DISABLE_WARNING # define AZ_FORCE_INLINE __forceinline -#if !defined(_DEBUG) -# pragma warning(disable:4714) //warning C4714 marked as __forceinline not inlined. Sadly this happens when LTCG during linking. We tried to NOT use force inline but VC 2012 is bad at inlining. -#endif /// Aligns a declaration. # define AZ_ALIGN(_decl, _alignment) \ diff --git a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h index 42fc762769..0c4eaf8383 100644 --- a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h +++ b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h @@ -24,11 +24,6 @@ #include #include -#if defined(AZ_COMPILER_MSVC) -# pragma warning(push) -# pragma warning(disable: 4127) // conditional expression is constant -#endif - namespace AZStd { template @@ -4507,7 +4502,7 @@ namespace AZ params.resize(sizeof...(Args) + eBehaviorBusForwarderEventIndices::ParameterFirst); SetParameters(¶ms[eBehaviorBusForwarderEventIndices::Result], nullptr); SetParameters(¶ms[eBehaviorBusForwarderEventIndices::UserData], nullptr); - if (sizeof...(Args) > 0) + if constexpr (sizeof...(Args) > 0) { SetParameters(¶ms[eBehaviorBusForwarderEventIndices::ParameterFirst], nullptr); } @@ -4872,10 +4867,6 @@ namespace AZ } // namespace Internal } // namespace AZ -#if defined(AZ_COMPILER_MSVC) -# pragma warning(pop) -#endif - // pull AzStd on demand reflection #include #include diff --git a/Code/Framework/AzCore/AzCore/Serialization/EditContext.h b/Code/Framework/AzCore/AzCore/Serialization/EditContext.h index 492550f266..a08e971ac4 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/EditContext.h +++ b/Code/Framework/AzCore/AzCore/Serialization/EditContext.h @@ -656,26 +656,25 @@ namespace AZ using ElementType = typename AZStd::Utils::if_c::value, typename ElementTypeInfo::Type, typename ElementTypeInfo::ElementType>::type; AZ_Assert(m_classData->m_typeId == AzTypeInfo::Uuid(), "Data element (%s) belongs to a different class!", AzTypeInfo::Name()); -#if defined(AZ_COMPILER_MSVC) -# pragma warning(push) -# pragma warning(disable: 4127) // conditional expression is constant -#endif const SerializeContext::ClassData* classData = m_context->m_serializeContext.FindClassData(AzTypeInfo::Uuid()); if (classData && classData->m_editData) { return DataElement(uiId, memberVariable, classData->m_editData->m_name, classData->m_editData->m_description); } - else if (AZStd::is_enum::value && AzTypeInfo::Name() != nullptr) + else { - auto enumIter = m_context->m_enumData.find(AzTypeInfo::Uuid()); - if (enumIter != m_context->m_enumData.end()) + if constexpr (AZStd::is_enum::value) { - return DataElement(uiId, memberVariable, enumIter->second.m_name, enumIter->second.m_description); + if (AzTypeInfo::Name() != nullptr) + { + auto enumIter = m_context->m_enumData.find(AzTypeInfo::Uuid()); + if (enumIter != m_context->m_enumData.end()) + { + return DataElement(uiId, memberVariable, enumIter->second.m_name, enumIter->second.m_description); + } + } } } -#if defined(AZ_COMPILER_MSVC) -# pragma warning(pop) -#endif const char* typeName = AzTypeInfo::Name(); return DataElement(uiId, memberVariable, typeName, typeName); diff --git a/Code/Framework/AzCore/AzCore/std/delegate/delegate.h b/Code/Framework/AzCore/AzCore/std/delegate/delegate.h index 610c1982f2..1b44437f31 100644 --- a/Code/Framework/AzCore/AzCore/std/delegate/delegate.h +++ b/Code/Framework/AzCore/AzCore/std/delegate/delegate.h @@ -291,9 +291,7 @@ namespace AZStd template <> struct SimplifyMemFunc { -#if defined(AZ_COMPILER_MSVC) -# pragma warning(push) -# pragma warning(disable: 4121) // alignment of a member was sensitive to packing + AZ_PUSH_DISABLE_WARNING(4121, "-Wunknown-warning-option") // alignment of a member was sensitive to packing // GenericClass* (X::*ProbeFunc) changes it's size. From Microsoft: // Jason Shirk [MSFT] // This is a known bug/issue. Unfortunately, we can't fix it in X86 product @@ -302,7 +300,6 @@ namespace AZStd // We have addressed the issue for all future platforms (including IA64) where // binary compatibility isn't yet an issue. // We can fix this warning by adding forward decl class __single_inheritance CLASS; if the XFuncType is member function. -#endif template inline static GenericClass* Convert(X* pthis, XFuncType function_to_bind, GenericMemFuncType& bound_func) { @@ -330,11 +327,7 @@ namespace AZStd u.s.codeptr = u2.s.codeptr; return (pthis->*u.ProbeFunc)(); } - -#if defined(AZ_COMPILER_MSVC) -# pragma warning(default: 4121) // alignment of a member was sensitive to packing -# pragma warning(pop) -#endif + AZ_POP_DISABLE_WARNING }; // Nasty hack for Microsoft and Intel (IA32 and Itanium) diff --git a/Code/Framework/AzCore/AzCore/std/function/function_base.h b/Code/Framework/AzCore/AzCore/std/function/function_base.h index c1dd669f51..32892a4c03 100644 --- a/Code/Framework/AzCore/AzCore/std/function/function_base.h +++ b/Code/Framework/AzCore/AzCore/std/function/function_base.h @@ -20,13 +20,6 @@ #include #include -#if defined(AZ_COMPILER_MSVC) -# pragma warning( push ) -# pragma warning( disable : 4793 ) // complaint about native code generation -# pragma warning( disable : 4127 ) // "conditional expression is constant" -# pragma warning( disable : 4275 ) // non dll-interface class 'stdext::exception' used as base for dll-interface class 'std::bad_cast' -#endif - #define AZSTD_FUNCTION_TARGET_FIX(x) #define AZSTD_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, Type) AZStd::enable_if_t, Type> @@ -796,12 +789,5 @@ namespace AZStd //#undef aztypeid //#undef aztypeid_cmp -#if defined(AZ_COMPILER_MSVC) -# pragma warning( default : 4793 ) // complaint about native code generation -# pragma warning( default : 4127 ) // "conditional expression is constant" -# pragma warning( default : 4275 ) // non dll-interface class 'stdext::exception' used as base for dll-interface class 'std::bad_cast' -# pragma warning( pop ) -#endif - #endif // AZSTD_FUNCTION_BASE_HEADER #pragma once diff --git a/Code/Framework/AzCore/AzCore/std/function/function_template.h b/Code/Framework/AzCore/AzCore/std/function/function_template.h index 586b02e671..7f388c4006 100644 --- a/Code/Framework/AzCore/AzCore/std/function/function_template.h +++ b/Code/Framework/AzCore/AzCore/std/function/function_template.h @@ -13,11 +13,6 @@ #include #include -#if defined(AZ_COMPILER_MSVC) -# pragma warning( push ) -# pragma warning( disable : 4127 ) // "conditional expression is constant" -#endif - namespace AZStd { namespace Internal @@ -689,7 +684,3 @@ namespace AZStd } }; } // end namespace AZStd - -#if defined(AZ_COMPILER_MSVC) -# pragma warning( pop ) -#endif diff --git a/Code/Framework/AzCore/AzCore/std/parallel/containers/internal/concurrent_hash_table.h b/Code/Framework/AzCore/AzCore/std/parallel/containers/internal/concurrent_hash_table.h index 524eff7e64..c8fc709778 100644 --- a/Code/Framework/AzCore/AzCore/std/parallel/containers/internal/concurrent_hash_table.h +++ b/Code/Framework/AzCore/AzCore/std/parallel/containers/internal/concurrent_hash_table.h @@ -489,24 +489,26 @@ namespace AZStd { return; } - - float loadFactor = (float)m_numElements.load(memory_order_acquire) / (float)m_storage.get_num_buckets(); - if (loadFactor > max_load_factor()) + else { - acquire_all(); - - //check the load factor again, as another thread may have beaten us to the rehash - size_type numElements = m_numElements.load(memory_order_acquire); - float maxLoadFactor = max_load_factor(); - size_type numBuckets = m_storage.get_num_buckets(); - loadFactor = (float)numElements / (float)numBuckets; - if (loadFactor > maxLoadFactor) + float loadFactor = (float)m_numElements.load(memory_order_acquire) / (float)m_storage.get_num_buckets(); + if (loadFactor > max_load_factor()) { - size_type minNumBuckets = (size_type)((float)numElements / maxLoadFactor); - m_storage.rehash(this, minNumBuckets); - } + acquire_all(); - release_all(); + // check the load factor again, as another thread may have beaten us to the rehash + size_type numElements = m_numElements.load(memory_order_acquire); + float maxLoadFactor = max_load_factor(); + size_type numBuckets = m_storage.get_num_buckets(); + loadFactor = (float)numElements / (float)numBuckets; + if (loadFactor > maxLoadFactor) + { + size_type minNumBuckets = (size_type)((float)numElements / maxLoadFactor); + m_storage.rehash(this, minNumBuckets); + } + + release_all(); + } } } diff --git a/Code/Framework/AzCore/AzCore/std/smart_ptr/weak_ptr.h b/Code/Framework/AzCore/AzCore/std/smart_ptr/weak_ptr.h index aaaf90e8f7..80dee72d03 100644 --- a/Code/Framework/AzCore/AzCore/std/smart_ptr/weak_ptr.h +++ b/Code/Framework/AzCore/AzCore/std/smart_ptr/weak_ptr.h @@ -192,9 +192,5 @@ namespace AZStd } } // namespace AZStd -/*#ifdef AZ_COMPILER_MSVC -# pragma warning(pop) -#endif */ - #endif // #ifndef AZSTD_SMART_PTR_WEAK_PTR_H #pragma once diff --git a/Code/Framework/AzCore/AzCore/std/string/regex.h b/Code/Framework/AzCore/AzCore/std/string/regex.h index 2c120436d5..2ca223937b 100644 --- a/Code/Framework/AzCore/AzCore/std/string/regex.h +++ b/Code/Framework/AzCore/AzCore/std/string/regex.h @@ -22,11 +22,6 @@ // used for std::pointer_traits \note do an AZStd version #include -#if defined(AZ_COMPILER_MSVC) -# pragma warning(push) -# pragma warning(disable: 6011 28198) -#endif // AZ_COMPILER_MSVC - #ifndef AZ_REGEX_MAX_COMPLEXITY_COUNT #define AZ_REGEX_MAX_COMPLEXITY_COUNT 10000000L /* set to 0 to disable */ #endif /* AZ_REGEX_MAX_COMPLEXITY_COUNT */ @@ -4766,7 +4761,3 @@ namespace AZStd Trans(); } } // namespace AZStd - -#if defined(AZ_COMPILER_MSVC) -# pragma warning(pop) -#endif // AZ_COMPILER_MSVC diff --git a/Code/Framework/AzCore/Tests/Jobs.cpp b/Code/Framework/AzCore/Tests/Jobs.cpp index 4a1af4cc24..0eb46a0051 100644 --- a/Code/Framework/AzCore/Tests/Jobs.cpp +++ b/Code/Framework/AzCore/Tests/Jobs.cpp @@ -1736,7 +1736,7 @@ namespace Benchmark std::numeric_limits::max()); std::generate(m_randomPriorities.begin(), m_randomPriorities.end(), [&randomPriorityDistribution, &randomPriorityGenerator]() { - return randomPriorityDistribution(randomPriorityGenerator); + return static_cast(randomPriorityDistribution(randomPriorityGenerator)); }); // Generate some random depths diff --git a/Code/Framework/AzCore/Tests/Serialization/Json/MathMatrixSerializerTests.cpp b/Code/Framework/AzCore/Tests/Serialization/Json/MathMatrixSerializerTests.cpp index ca558d1624..1126aeb662 100644 --- a/Code/Framework/AzCore/Tests/Serialization/Json/MathMatrixSerializerTests.cpp +++ b/Code/Framework/AzCore/Tests/Serialization/Json/MathMatrixSerializerTests.cpp @@ -225,7 +225,6 @@ namespace JsonSerializationTests static_assert((RowCount >= 3 && RowCount <= 4) && (ColumnCount >= 3 && ColumnCount <= 4), "Only matrix 3x3, 3x4 or 4x4 are supported by this test."); } - return "{}"; } void ConfigureFeatures(JsonSerializerConformityTestDescriptorFeatures& features) override