diff --git a/Code/Framework/AzCore/AzCore/Asset/AssetCommon.h b/Code/Framework/AzCore/AzCore/Asset/AssetCommon.h index 477677948f..0c8e5209ca 100644 --- a/Code/Framework/AzCore/AzCore/Asset/AssetCommon.h +++ b/Code/Framework/AzCore/AzCore/Asset/AssetCommon.h @@ -990,7 +990,7 @@ namespace AZ template u8 Asset::GetFlags() const { - AZ_Warning("Asset", false, "Deprecated - replaced by GetAutoLoadBehavior") + AZ_Warning("Asset", false, "Deprecated - replaced by GetAutoLoadBehavior"); return static_cast(m_loadBehavior); } @@ -1012,7 +1012,7 @@ namespace AZ template bool Asset::SetFlags(u8 flags) { - AZ_Warning("Asset", false, "Deprecated - replaced by SetAutoLoadBehavior") + AZ_Warning("Asset", false, "Deprecated - replaced by SetAutoLoadBehavior"); if (!m_assetData) { AZ_Assert(flags < static_cast(AssetLoadBehavior::Count), "Flags value is out of range"); diff --git a/Code/Framework/AzCore/AzCore/Debug/Trace.h b/Code/Framework/AzCore/AzCore/Debug/Trace.h index 5cb8c23821..11545375e4 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Trace.h +++ b/Code/Framework/AzCore/AzCore/Debug/Trace.h @@ -8,8 +8,7 @@ #pragma once #include -#define AZ_VA_HAS_ARGS(...) ""#__VA_ARGS__[0] != 0 - +#include namespace AZ { @@ -262,17 +261,18 @@ namespace AZ #define AZ_VerifyWarning(window, expression, ...) AZ_Warning(window, 0 != (expression), __VA_ARGS__) #else // !AZ_ENABLE_TRACING - #define AZ_Assert(expression, ...) - #define AZ_Error(window, expression, ...) - #define AZ_ErrorOnce(window, expression, ...) - #define AZ_Warning(window, expression, ...) - #define AZ_WarningOnce(window, expression, ...) - #define AZ_TracePrintf(window, ...) - #define AZ_TracePrintfOnce(window, ...) - #define AZ_Verify(expression, ...) (void)(expression) - #define AZ_VerifyError(window, expression, ...) (void)(expression) - #define AZ_VerifyWarning(window, expression, ...) (void)(expression) + #define AZ_Assert(...) AZ_UNUSED(__VA_ARGS__) + #define AZ_Error(...) AZ_UNUSED(__VA_ARGS__) + #define AZ_ErrorOnce(...) AZ_UNUSED(__VA_ARGS__) + #define AZ_Warning(...) AZ_UNUSED(__VA_ARGS__) + #define AZ_WarningOnce(...) AZ_UNUSED(__VA_ARGS__) + #define AZ_TracePrintf(...) AZ_UNUSED(__VA_ARGS__) + #define AZ_TracePrintfOnce(...) AZ_UNUSED(__VA_ARGS__) + + #define AZ_Verify(...) AZ_UNUSED(__VA_ARGS__) + #define AZ_VerifyError(...) AZ_UNUSED(__VA_ARGS__) + #define AZ_VerifyWarning(...) AZ_UNUSED(__VA_ARGS__) #endif // AZ_ENABLE_TRACING diff --git a/Code/Framework/AzCore/AzCore/Driller/Stream.cpp b/Code/Framework/AzCore/AzCore/Driller/Stream.cpp index 761f964561..14e983b09c 100644 --- a/Code/Framework/AzCore/AzCore/Driller/Stream.cpp +++ b/Code/Framework/AzCore/AzCore/Driller/Stream.cpp @@ -693,7 +693,7 @@ namespace AZ } else { - AZ_Assert(m_isPooledString == false && m_isPooledStringCrc32 == false, "This stream requires using of a string pool as the string is send only once and afterwards only the Crc32 is used!") + AZ_Assert(m_isPooledString == false && m_isPooledStringCrc32 == false, "This stream requires using of a string pool as the string is send only once and afterwards only the Crc32 is used!"); } return srcData; } diff --git a/Code/Framework/AzCore/AzCore/IO/IStreamerTypes.h b/Code/Framework/AzCore/AzCore/IO/IStreamerTypes.h index 6afe078514..901fc5e594 100644 --- a/Code/Framework/AzCore/AzCore/IO/IStreamerTypes.h +++ b/Code/Framework/AzCore/AzCore/IO/IStreamerTypes.h @@ -150,9 +150,7 @@ namespace AZ::IO::IStreamerTypes private: AZStd::atomic_int m_lockCounter{ 0 }; -#ifdef AZ_ENABLE_TRACING AZStd::atomic_int m_allocationCounter{ 0 }; -#endif AZ::IAllocatorAllocate& m_allocator; }; diff --git a/Code/Framework/AzCore/AzCore/base.h b/Code/Framework/AzCore/AzCore/base.h index f6ae39dcda..f2a64c3224 100644 --- a/Code/Framework/AzCore/AzCore/base.h +++ b/Code/Framework/AzCore/AzCore/base.h @@ -143,6 +143,9 @@ * example. AZ_VA_NUM_ARGS(x,y,z) -> expands to 3 */ #ifndef AZ_VA_NUM_ARGS + +# define AZ_VA_HAS_ARGS(...) ""#__VA_ARGS__[0] != 0 + // we add the zero to avoid the case when we require at least 1 param at the end... # define AZ_VA_NUM_ARGS(...) AZ_VA_NUM_ARGS_IMPL_((__VA_ARGS__, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)) # define AZ_VA_NUM_ARGS_IMPL_(tuple) AZ_VA_NUM_ARGS_IMPL tuple @@ -170,15 +173,15 @@ // This is a pain they we use macros to call functions (with no params). // we implement functions for up to 10 params -#define AZ_FUNCTION_CALL_1(_1) _1() -#define AZ_FUNCTION_CALL_2(_1, _2) _1(_2) -#define AZ_FUNCTION_CALL_3(_1, _2, _3) _1(_2, _3) -#define AZ_FUNCTION_CALL_4(_1, _2, _3, _4) _1(_2, _3, _4) -#define AZ_FUNCTION_CALL_5(_1, _2, _3, _4, _5) _1(_2, _3, _4, _5) -#define AZ_FUNCTION_CALL_6(_1, _2, _3, _4, _5, _6) _1(_2, _3, _4, _5, _6) -#define AZ_FUNCTION_CALL_7(_1, _2, _3, _4, _5, _6, _7) _1(_2, _3, _4, _5, _6, _7) -#define AZ_FUNCTION_CALL_8(_1, _2, _3, _4, _5, _6, _7, _8) _1(_2, _3, _4, _5, _6, _7, _8) -#define AZ_FUNCTION_CALL_9(_1, _2, _3, _4, _5, _6, _7, _8, _9) _1(_2, _3, _4, _5, _6, _7, _8, _9) +#define AZ_FUNCTION_CALL_1(_1) _1() +#define AZ_FUNCTION_CALL_2(_1, _2) _1(_2) +#define AZ_FUNCTION_CALL_3(_1, _2, _3) _1(_2, _3) +#define AZ_FUNCTION_CALL_4(_1, _2, _3, _4) _1(_2, _3, _4) +#define AZ_FUNCTION_CALL_5(_1, _2, _3, _4, _5) _1(_2, _3, _4, _5) +#define AZ_FUNCTION_CALL_6(_1, _2, _3, _4, _5, _6) _1(_2, _3, _4, _5, _6) +#define AZ_FUNCTION_CALL_7(_1, _2, _3, _4, _5, _6, _7) _1(_2, _3, _4, _5, _6, _7) +#define AZ_FUNCTION_CALL_8(_1, _2, _3, _4, _5, _6, _7, _8) _1(_2, _3, _4, _5, _6, _7, _8) +#define AZ_FUNCTION_CALL_9(_1, _2, _3, _4, _5, _6, _7, _8, _9) _1(_2, _3, _4, _5, _6, _7, _8, _9) #define AZ_FUNCTION_CALL_10(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) _1(_2, _3, _4, _5, _6, _7, _8, _9, _10) // We require at least 1 param FunctionName @@ -293,7 +296,20 @@ namespace AZ #define AZ_DEFAULT_COPY_MOVE(_Class) AZ_DEFAULT_COPY(_Class) AZ_DEFAULT_MOVE(_Class) // Macro that can be used to avoid unreferenced variable warnings -#define AZ_UNUSED(x) (void)x +#define AZ_UNUSED_1(x) (void)(x); +#define AZ_UNUSED_2(x1, x2) AZ_UNUSED_1(x1) AZ_UNUSED_1(x2) +#define AZ_UNUSED_3(x1, x2, x3) AZ_UNUSED_1(x1) AZ_UNUSED_2(x2, x3) +#define AZ_UNUSED_4(x1, x2, x3, x4) AZ_UNUSED_2(x1, x2) AZ_UNUSED_2(x3, x4) +#define AZ_UNUSED_5(x1, x2, x3, x4, x5) AZ_UNUSED_2(x1, x2) AZ_UNUSED_3(x3, x4, x5) +#define AZ_UNUSED_6(x1, x2, x3, x4, x5, x6) AZ_UNUSED_3(x1, x2, x3) AZ_UNUSED_3(x4, x5, x6) +#define AZ_UNUSED_7(x1, x2, x3, x4, x5, x6, x7) AZ_UNUSED_3(x1, x2, x3) AZ_UNUSED_4(x4, x5, x6, x7) +#define AZ_UNUSED_8(x1, x2, x3, x4, x5, x6, x7, x8) AZ_UNUSED_4(x1, x2, x3, x4) AZ_UNUSED_4(x5, x6, x7, x8) +#define AZ_UNUSED_9(x1, x2, x3, x4, x5, x6, x7, x8, x9) AZ_UNUSED_4(x1, x2, x3, x4) AZ_UNUSED_5(x5, x6, x7, x8, x9) +#define AZ_UNUSED_10(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) AZ_UNUSED_5(x1, x2, x3, x4, x5) AZ_UNUSED_5(x6, x7, x8, x9, x10) +#define AZ_UNUSED_11(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11) AZ_UNUSED_5(x1, x2, x3, x4, x5) AZ_UNUSED_6(x6, x7, x8, x9, x10, x11) +#define AZ_UNUSED_12(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12) AZ_UNUSED_6(x1, x2, x3, x4, x5, x6) AZ_UNUSED_6(x7, x8, x9, x10, x11, x12) + +#define AZ_UNUSED(...) AZ_MACRO_SPECIALIZE(AZ_UNUSED_, AZ_VA_NUM_ARGS(__VA_ARGS__), (__VA_ARGS__)) #define AZ_DEFINE_ENUM_BITWISE_OPERATORS(EnumType) \ inline constexpr EnumType operator | (EnumType a, EnumType b) \ diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp index 2d3d1722ca..092c40827c 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp @@ -526,12 +526,10 @@ namespace AzToolsFramework Template& targetTemplate = targetTemplateReference->get(); -#if defined(AZ_ENABLE_TRACING) Template& sourceTemplate = sourceTemplateReference->get(); AZStd::string_view instanceName(instanceIterator->name.GetString(), instanceIterator->name.GetStringLength()); const AZStd::string& targetTemplateFilePath = targetTemplate.GetFilePath().Native(); const AZStd::string& sourceTemplateFilePath = sourceTemplate.GetFilePath().Native(); -#endif LinkId newLinkId = CreateUniqueLinkId(); Link newLink(newLinkId); @@ -770,10 +768,8 @@ namespace AzToolsFramework return false; } -#if defined(AZ_ENABLE_TRACING) Template& sourceTemplate = sourceTemplateReference->get(); Template& targetTemplate = targetTemplateReference->get(); -#endif AZStd::string_view instanceName(instanceIterator->name.GetString(), instanceIterator->name.GetStringLength()); @@ -783,10 +779,9 @@ namespace AzToolsFramework PrefabDomValue& instance = instanceIterator->value; AZ_Assert(instance.IsObject(), "Nested instance DOM provided is not a valid JSON object."); - [[maybe_unused]] PrefabDomValueReference sourceTemplateName = PrefabDomUtils::FindPrefabDomValue(instance, PrefabDomUtils::SourceName); + PrefabDomValueReference sourceTemplateName = PrefabDomUtils::FindPrefabDomValue(instance, PrefabDomUtils::SourceName); AZ_Assert(sourceTemplateName, "Couldn't find source template name in the DOM of the nested instance while creating a link."); - AZ_Assert( - sourceTemplateName->get() == sourceTemplate.GetFilePath().c_str(), + AZ_Assert(sourceTemplateName->get() == sourceTemplate.GetFilePath().c_str(), "The name of the source template in the nested instance DOM does not match the name of the source template already loaded"); PrefabDomValueReference patchesReference = PrefabDomUtils::FindPrefabDomValue(instance, PrefabDomUtils::PatchesName); diff --git a/Code/LauncherUnified/Launcher.cpp b/Code/LauncherUnified/Launcher.cpp index f5da40ccad..de4c496b2a 100644 --- a/Code/LauncherUnified/Launcher.cpp +++ b/Code/LauncherUnified/Launcher.cpp @@ -626,11 +626,8 @@ namespace O3DELauncher AZ_TracePrintf("Launcher", "Application is configured for VFS"); AZ_TracePrintf("Launcher", "Log and cache files will be written to the Cache directory on your host PC"); -#if defined(AZ_ENABLE_TRACING) - const char* message = "If your game does not run, check any of the following:\n" - "\t- Verify the remote_ip address is correct in bootstrap.cfg"; -#endif - + constexpr const char* message = "If your game does not run, check any of the following:\n" + "\t- Verify the remote_ip address is correct in bootstrap.cfg"; if (mainInfo.m_additionalVfsResolution) { AZ_TracePrintf("Launcher", "%s\n%s", message, mainInfo.m_additionalVfsResolution) diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/AssetCreator.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/AssetCreator.h index 378a8743d8..08d6292541 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/AssetCreator.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/AssetCreator.h @@ -150,7 +150,7 @@ namespace AZ template template - void AssetCreator::ReportError([[maybe_unused]] const char* format, [[maybe_unused]] Args... args) + void AssetCreator::ReportError(const char* format, Args... args) { ++m_errorCount; AZ_Error(m_assetClassName, false, format, args...); @@ -158,7 +158,7 @@ namespace AZ template template - void AssetCreator::ReportWarning([[maybe_unused]] const char* format, [[maybe_unused]] Args... args) + void AssetCreator::ReportWarning(const char* format, Args... args) { ++m_warningCount; AZ_Warning(m_assetClassName, false, format, args...); diff --git a/Gems/EditorPythonBindings/Code/Source/PythonProxyBus.cpp b/Gems/EditorPythonBindings/Code/Source/PythonProxyBus.cpp index 561daa269e..8edb52e066 100644 --- a/Gems/EditorPythonBindings/Code/Source/PythonProxyBus.cpp +++ b/Gems/EditorPythonBindings/Code/Source/PythonProxyBus.cpp @@ -206,10 +206,7 @@ namespace EditorPythonBindings if (eventName == e.m_name) { AZStd::string eventNameValue{ eventName }; -#if defined(AZ_ENABLE_TRACING) - const auto& callbackIt = m_callbackMap.find(eventNameValue); -#endif - AZ_Warning("python", m_callbackMap.end() == callbackIt, "Replacing callback for eventName:%s", eventNameValue.c_str()); + AZ_Warning("python", m_callbackMap.end() == m_callbackMap.find(eventNameValue), "Replacing callback for eventName:%s", eventNameValue.c_str()); m_callbackMap[eventNameValue] = callback; return true; } diff --git a/Gems/LmbrCentral/Code/Source/Builders/BenchmarkAssetBuilder/BenchmarkAssetBuilderWorker.cpp b/Gems/LmbrCentral/Code/Source/Builders/BenchmarkAssetBuilder/BenchmarkAssetBuilderWorker.cpp index da7181ae04..22be22265a 100644 --- a/Gems/LmbrCentral/Code/Source/Builders/BenchmarkAssetBuilder/BenchmarkAssetBuilderWorker.cpp +++ b/Gems/LmbrCentral/Code/Source/Builders/BenchmarkAssetBuilder/BenchmarkAssetBuilderWorker.cpp @@ -253,12 +253,10 @@ namespace BenchmarkAssetBuilder // and 2 bytes of storage for text-based formats. // This is just an approximate total size because there's a bit of additional overhead // for asset headers and the other fields in the generated asset. -#if defined(AZ_ENABLE_TRACING) uint64_t approximateTotalStorageBytes = (settingsPtr->m_assetStorageType == AZ::DataStream::StreamType::ST_BINARY) ? UINT64_C(1) * totalGeneratedBytes : UINT64_C(2) * totalGeneratedBytes; -#endif AZ_TracePrintf(AssetBuilderSDK::InfoWindow, "Benchmark asset generation will generate %" PRIu64 " assets " diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/RuntimeComponent.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/RuntimeComponent.cpp index c1b0d51ac8..5fe5c32a48 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/RuntimeComponent.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/RuntimeComponent.cpp @@ -116,7 +116,7 @@ namespace ScriptCanvas return; } #else - AZ_Assert(m_runtimeAsset.Get(), "RuntimeComponent::m_runtimeAsset AssetId: %s was valid, but the data was not pre-loaded, so this script will not run", m_runtimeOverrides.m_runtimeAsset.GetId().ToString().data()); + AZ_Assert(m_runtimeOverrides.m_runtimeAsset.Get(), "RuntimeComponent::m_runtimeAsset AssetId: %s was valid, but the data was not pre-loaded, so this script will not run", m_runtimeOverrides.m_runtimeAsset.GetId().ToString().data()); #endif AZ_PROFILE_SCOPE(ScriptCanvas, "RuntimeComponent::InitializeExecution (%s)", m_runtimeOverrides.m_runtimeAsset.GetId().ToString().c_str()); @@ -130,7 +130,7 @@ namespace ScriptCanvas return; } #else - AZ_Assert(m_executionState, "RuntimeComponent::m_runtimeAsset AssetId: %s failed to create an execution state, possibly due to missing dependent asset, script will not run", m_runtimeAsset.GetId().ToString().data()); + AZ_Assert(m_executionState, "RuntimeComponent::m_runtimeAsset AssetId: %s failed to create an execution state, possibly due to missing dependent asset, script will not run", m_runtimeOverrides.m_runtimeAsset.GetId().ToString().data()); #endif AZ::EntityBus::Handler::BusConnect(GetEntityId());