From dd80a3ebae87d2ffce5a077764937064f34227d2 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Wed, 18 Aug 2021 11:09:14 -0700 Subject: [PATCH] Linux and non-unity build fixes Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Framework/AzCore/AzCore/Debug/IEventLogger.h | 1 + .../AzCore/AzCore/IO/ByteContainerStream.h | 1 + Code/Framework/AzCore/AzCore/IO/GenericStreams.cpp | 1 + .../Android/AzCore/AzCore_Traits_Android.h | 13 +++++++++++++ .../Platform/Linux/AzCore/AzCore_Traits_Linux.h | 14 ++++++++++++++ .../AzCore/Platform/Mac/AzCore/AzCore_Traits_Mac.h | 14 ++++++++++++++ .../Windows/AzCore/AzCore_Traits_Windows.h | 14 ++++++++++++++ .../AzCore/Platform/iOS/AzCore/AzCore_Traits_iOS.h | 14 ++++++++++++++ Code/Framework/AzCore/Tests/AZStd/String.cpp | 4 ++-- Code/Framework/AzCore/Tests/Math/SfmtTests.cpp | 1 + Code/Legacy/CryCommon/LegacyAllocator.cpp | 6 +++--- .../Include/Atom/Feature/Utils/IndexableList.h | 1 + .../Include/Atom/RHI.Reflect/CpuTimingStatistics.h | 1 + .../MysticQt/Source/KeyboardShortcutManager.cpp | 1 + 14 files changed, 81 insertions(+), 5 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/Debug/IEventLogger.h b/Code/Framework/AzCore/AzCore/Debug/IEventLogger.h index a11b411ded..f5bca5fba6 100644 --- a/Code/Framework/AzCore/AzCore/Debug/IEventLogger.h +++ b/Code/Framework/AzCore/AzCore/Debug/IEventLogger.h @@ -13,6 +13,7 @@ #include #include #include +#include namespace AZ::Debug { diff --git a/Code/Framework/AzCore/AzCore/IO/ByteContainerStream.h b/Code/Framework/AzCore/AzCore/IO/ByteContainerStream.h index 17f72b9012..d198f47e00 100644 --- a/Code/Framework/AzCore/AzCore/IO/ByteContainerStream.h +++ b/Code/Framework/AzCore/AzCore/IO/ByteContainerStream.h @@ -12,6 +12,7 @@ #include #include #include +#include namespace AZ { diff --git a/Code/Framework/AzCore/AzCore/IO/GenericStreams.cpp b/Code/Framework/AzCore/AzCore/IO/GenericStreams.cpp index b3ab808711..e7ccf4c83a 100644 --- a/Code/Framework/AzCore/AzCore/IO/GenericStreams.cpp +++ b/Code/Framework/AzCore/AzCore/IO/GenericStreams.cpp @@ -11,6 +11,7 @@ #include #include #include +#include namespace AZ::IO { diff --git a/Code/Framework/AzCore/Platform/Android/AzCore/AzCore_Traits_Android.h b/Code/Framework/AzCore/Platform/Android/AzCore/AzCore_Traits_Android.h index 1b67f3b720..495c8d5f2c 100644 --- a/Code/Framework/AzCore/Platform/Android/AzCore/AzCore_Traits_Android.h +++ b/Code/Framework/AzCore/Platform/Android/AzCore/AzCore_Traits_Android.h @@ -109,6 +109,19 @@ #define AZ_TRAIT_USE_ERRNO_T_TYPEDEF 1 #define AZ_TRAIT_USE_POSIX_TEMP_FOLDER 0 +// wchar_t/char formatting +// Reason: https://docs.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-160 +// The Z type character, and the behavior of the c, C, s, and S type characters when they're used with the printf and wprintf functions, +// are Microsoft extensions. The ISO C standard uses c and s consistently for narrow characters and strings, and C and S for wide characters +// and strings, in all formatting functions. +#define AZ_TRAIT_FORMAT_STRING_PRINTF_CHAR "%c" +#define AZ_TRAIT_FORMAT_STRING_PRINTF_WCHAR "%C" +#define AZ_TRAIT_FORMAT_STRING_WPRINTF_CHAR "%c" +#define AZ_TRAIT_FORMAT_STRING_WPRINTF_WCHAR "%C" +#define AZ_TRAIT_FORMAT_STRING_PRINTF_STRING "%s" +#define AZ_TRAIT_FORMAT_STRING_PRINTF_WSTRING "%S" +#define AZ_TRAIT_FORMAT_STRING_WPRINTF_STRING "%s" +#define AZ_TRAIT_FORMAT_STRING_WPRINTF_WSTRING "%S" // Legacy traits ... #define AZ_TRAIT_LEGACY_CRYCOMMON_USE_WINDOWS_STUBS 1 #define AZ_TRAIT_LEGACY_CRYPAK_UNIX_LIKE_FILE_SYSTEM 1 diff --git a/Code/Framework/AzCore/Platform/Linux/AzCore/AzCore_Traits_Linux.h b/Code/Framework/AzCore/Platform/Linux/AzCore/AzCore_Traits_Linux.h index d36be0f61a..6ba369e86d 100644 --- a/Code/Framework/AzCore/Platform/Linux/AzCore/AzCore_Traits_Linux.h +++ b/Code/Framework/AzCore/Platform/Linux/AzCore/AzCore_Traits_Linux.h @@ -109,6 +109,20 @@ #define AZ_TRAIT_USE_ERRNO_T_TYPEDEF 1 #define AZ_TRAIT_USE_POSIX_TEMP_FOLDER 1 +// wchar_t/char formatting +// Reason: https://docs.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-160 +// The Z type character, and the behavior of the c, C, s, and S type characters when they're used with the printf and wprintf functions, +// are Microsoft extensions. The ISO C standard uses c and s consistently for narrow characters and strings, and C and S for wide characters +// and strings, in all formatting functions. +#define AZ_TRAIT_FORMAT_STRING_PRINTF_CHAR "%c" +#define AZ_TRAIT_FORMAT_STRING_PRINTF_WCHAR "%C" +#define AZ_TRAIT_FORMAT_STRING_WPRINTF_CHAR "%c" +#define AZ_TRAIT_FORMAT_STRING_WPRINTF_WCHAR "%C" +#define AZ_TRAIT_FORMAT_STRING_PRINTF_STRING "%s" +#define AZ_TRAIT_FORMAT_STRING_PRINTF_WSTRING "%S" +#define AZ_TRAIT_FORMAT_STRING_WPRINTF_STRING "%s" +#define AZ_TRAIT_FORMAT_STRING_WPRINTF_WSTRING "%S" + // Legacy traits ... #define AZ_TRAIT_LEGACY_CRYCOMMON_USE_WINDOWS_STUBS 1 #define AZ_TRAIT_LEGACY_CRYPAK_UNIX_LIKE_FILE_SYSTEM 1 diff --git a/Code/Framework/AzCore/Platform/Mac/AzCore/AzCore_Traits_Mac.h b/Code/Framework/AzCore/Platform/Mac/AzCore/AzCore_Traits_Mac.h index b449cac072..a41b5c6baa 100644 --- a/Code/Framework/AzCore/Platform/Mac/AzCore/AzCore_Traits_Mac.h +++ b/Code/Framework/AzCore/Platform/Mac/AzCore/AzCore_Traits_Mac.h @@ -109,6 +109,20 @@ #define AZ_TRAIT_USE_ERRNO_T_TYPEDEF 0 #define AZ_TRAIT_USE_POSIX_TEMP_FOLDER 1 +// wchar_t/char formatting +// Reason: https://docs.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-160 +// The Z type character, and the behavior of the c, C, s, and S type characters when they're used with the printf and wprintf functions, +// are Microsoft extensions. The ISO C standard uses c and s consistently for narrow characters and strings, and C and S for wide characters +// and strings, in all formatting functions. +#define AZ_TRAIT_FORMAT_STRING_PRINTF_CHAR "%c" +#define AZ_TRAIT_FORMAT_STRING_PRINTF_WCHAR "%C" +#define AZ_TRAIT_FORMAT_STRING_WPRINTF_CHAR "%c" +#define AZ_TRAIT_FORMAT_STRING_WPRINTF_WCHAR "%C" +#define AZ_TRAIT_FORMAT_STRING_PRINTF_STRING "%s" +#define AZ_TRAIT_FORMAT_STRING_PRINTF_WSTRING "%S" +#define AZ_TRAIT_FORMAT_STRING_WPRINTF_STRING "%s" +#define AZ_TRAIT_FORMAT_STRING_WPRINTF_WSTRING "%S" + // Legacy traits ... #define AZ_TRAIT_LEGACY_CRYCOMMON_USE_WINDOWS_STUBS 1 #define AZ_TRAIT_LEGACY_CRYPAK_UNIX_LIKE_FILE_SYSTEM 1 diff --git a/Code/Framework/AzCore/Platform/Windows/AzCore/AzCore_Traits_Windows.h b/Code/Framework/AzCore/Platform/Windows/AzCore/AzCore_Traits_Windows.h index e9a06740a0..2f9fcefdbd 100644 --- a/Code/Framework/AzCore/Platform/Windows/AzCore/AzCore_Traits_Windows.h +++ b/Code/Framework/AzCore/Platform/Windows/AzCore/AzCore_Traits_Windows.h @@ -109,6 +109,20 @@ #define AZ_TRAIT_USE_ERRNO_T_TYPEDEF 0 #define AZ_TRAIT_USE_POSIX_TEMP_FOLDER 0 +// wchar_t/char formatting +// Reason: https://docs.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-160 +// The Z type character, and the behavior of the c, C, s, and S type characters when they're used with the printf and wprintf functions, +// are Microsoft extensions. The ISO C standard uses c and s consistently for narrow characters and strings, and C and S for wide characters +// and strings, in all formatting functions. +#define AZ_TRAIT_FORMAT_STRING_PRINTF_CHAR "%c" +#define AZ_TRAIT_FORMAT_STRING_PRINTF_WCHAR "%C" +#define AZ_TRAIT_FORMAT_STRING_WPRINTF_CHAR "%C" +#define AZ_TRAIT_FORMAT_STRING_WPRINTF_WCHAR "%c" +#define AZ_TRAIT_FORMAT_STRING_PRINTF_STRING "%s" +#define AZ_TRAIT_FORMAT_STRING_PRINTF_WSTRING "%S" +#define AZ_TRAIT_FORMAT_STRING_WPRINTF_STRING "%S" +#define AZ_TRAIT_FORMAT_STRING_WPRINTF_WSTRING "%s" + // Legacy traits ... #define AZ_TRAIT_LEGACY_CRYCOMMON_USE_WINDOWS_STUBS 0 #define AZ_TRAIT_LEGACY_CRYPAK_UNIX_LIKE_FILE_SYSTEM 0 diff --git a/Code/Framework/AzCore/Platform/iOS/AzCore/AzCore_Traits_iOS.h b/Code/Framework/AzCore/Platform/iOS/AzCore/AzCore_Traits_iOS.h index 56bc747c09..d53f4b057e 100644 --- a/Code/Framework/AzCore/Platform/iOS/AzCore/AzCore_Traits_iOS.h +++ b/Code/Framework/AzCore/Platform/iOS/AzCore/AzCore_Traits_iOS.h @@ -110,6 +110,20 @@ #define AZ_TRAIT_USE_ERRNO_T_TYPEDEF 0 #define AZ_TRAIT_USE_POSIX_TEMP_FOLDER 0 +// wchar_t/char formatting +// Reason: https://docs.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-160 +// The Z type character, and the behavior of the c, C, s, and S type characters when they're used with the printf and wprintf functions, +// are Microsoft extensions. The ISO C standard uses c and s consistently for narrow characters and strings, and C and S for wide characters +// and strings, in all formatting functions. +#define AZ_TRAIT_FORMAT_STRING_PRINTF_CHAR "%c" +#define AZ_TRAIT_FORMAT_STRING_PRINTF_WCHAR "%C" +#define AZ_TRAIT_FORMAT_STRING_WPRINTF_CHAR "%c" +#define AZ_TRAIT_FORMAT_STRING_WPRINTF_WCHAR "%C" +#define AZ_TRAIT_FORMAT_STRING_PRINTF_STRING "%s" +#define AZ_TRAIT_FORMAT_STRING_PRINTF_WSTRING "%S" +#define AZ_TRAIT_FORMAT_STRING_WPRINTF_STRING "%s" +#define AZ_TRAIT_FORMAT_STRING_WPRINTF_WSTRING "%S" + // Legacy traits ... #define AZ_TRAIT_LEGACY_CRYCOMMON_USE_WINDOWS_STUBS 1 #define AZ_TRAIT_LEGACY_CRYPAK_UNIX_LIKE_FILE_SYSTEM 1 diff --git a/Code/Framework/AzCore/Tests/AZStd/String.cpp b/Code/Framework/AzCore/Tests/AZStd/String.cpp index a88de48b9b..0ff12a352c 100644 --- a/Code/Framework/AzCore/Tests/AZStd/String.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/String.cpp @@ -1462,12 +1462,12 @@ namespace UnitTest // This shouldn't give a compile error AZStd::string::format( - "%i %c %uc %hc %lc %i %i %u %i %lu %li %llu %lli %f %f %hs %ls %p", + "%i %c %uc " AZ_TRAIT_FORMAT_STRING_PRINTF_CHAR AZ_TRAIT_FORMAT_STRING_PRINTF_WCHAR " %i %i %u %i %lu %li %llu %lli %f %f " AZ_TRAIT_FORMAT_STRING_PRINTF_STRING AZ_TRAIT_FORMAT_STRING_PRINTF_WSTRING " %p", v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18); // This shouldn't give a compile error AZStd::wstring::format( - L"%i %c %uc %hc %lc %i %i %u %i %lu %li %llu %lli %f %f %hs %ls %p", + L"%i %c %uc " AZ_TRAIT_FORMAT_STRING_WPRINTF_CHAR AZ_TRAIT_FORMAT_STRING_WPRINTF_WCHAR " %i %i %u %i %lu %li %llu %lli %f %f " AZ_TRAIT_FORMAT_STRING_WPRINTF_STRING AZ_TRAIT_FORMAT_STRING_WPRINTF_WSTRING " %p", v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18); class WrappedInt diff --git a/Code/Framework/AzCore/Tests/Math/SfmtTests.cpp b/Code/Framework/AzCore/Tests/Math/SfmtTests.cpp index 397e8bd24f..73fdd6e2fc 100644 --- a/Code/Framework/AzCore/Tests/Math/SfmtTests.cpp +++ b/Code/Framework/AzCore/Tests/Math/SfmtTests.cpp @@ -8,6 +8,7 @@ #include #include +#include using namespace AZ; diff --git a/Code/Legacy/CryCommon/LegacyAllocator.cpp b/Code/Legacy/CryCommon/LegacyAllocator.cpp index 76c4712bd3..d4f66d4c42 100644 --- a/Code/Legacy/CryCommon/LegacyAllocator.cpp +++ b/Code/Legacy/CryCommon/LegacyAllocator.cpp @@ -14,7 +14,7 @@ namespace AZ { if (alignment == 0) { - // Some STL containers, like std::vector, are assuming a specific minimum alignment. seems to have a requirement + // Some STL containers, like std::vector, seem to have a requirement where a specific minimum alignment will be chosen when the alignment is set to 0 // Take a look at _Allocate_manually_vector_aligned in xmemory0 alignment = sizeof(void*) * 2; } @@ -39,7 +39,7 @@ namespace AZ { if (newAlignment == 0) { - // Some STL containers, like std::vector, are assuming a specific minimum alignment. seems to have a requirement + // Some STL containers, like std::vector, seem to have a requirement where a specific minimum alignment will be chosen when the alignment is set to 0 // Take a look at _Allocate_manually_vector_aligned in xmemory0 newAlignment = sizeof(void*) * 2; } @@ -63,7 +63,7 @@ namespace AZ { if (newAlignment == 0) { - // Some STL containers, like std::vector, are assuming a specific minimum alignment. seems to have a requirement + // Some STL containers, like std::vector, seem to have a requirement where a specific minimum alignment will be chosen when the alignment is set to 0 // Take a look at _Allocate_manually_vector_aligned in xmemory0 newAlignment = sizeof(void*) * 2; } diff --git a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/IndexableList.h b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/IndexableList.h index fbc524314a..aae229ac9d 100644 --- a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/IndexableList.h +++ b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/IndexableList.h @@ -9,6 +9,7 @@ #pragma once #include +#include namespace AZ { diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/CpuTimingStatistics.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/CpuTimingStatistics.h index 99751bbde7..2ab23def08 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/CpuTimingStatistics.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/CpuTimingStatistics.h @@ -12,6 +12,7 @@ #include #include #include +#include namespace AZ { diff --git a/Gems/EMotionFX/Code/MysticQt/Source/KeyboardShortcutManager.cpp b/Gems/EMotionFX/Code/MysticQt/Source/KeyboardShortcutManager.cpp index 6b381bf9d8..ffedae5a99 100644 --- a/Gems/EMotionFX/Code/MysticQt/Source/KeyboardShortcutManager.cpp +++ b/Gems/EMotionFX/Code/MysticQt/Source/KeyboardShortcutManager.cpp @@ -10,6 +10,7 @@ #include "KeyboardShortcutManager.h" #include #include +#include #include #include