diff --git a/Code/Editor/ActionManager.cpp b/Code/Editor/ActionManager.cpp index 390dbbc1bd..ff74a2c208 100644 --- a/Code/Editor/ActionManager.cpp +++ b/Code/Editor/ActionManager.cpp @@ -326,6 +326,7 @@ ActionManager::MenuWrapper ActionManager::FindMenu(const QString& menuId) return *menuIt; } + AZ_UNUSED(menuId); // Prevent unused warning in release builds AZ_Warning("ActionManager", false, "Did not find menu with menuId %s", menuId.toUtf8().data()); return nullptr; }(); diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp index 44ac159c87..796e16dd53 100644 --- a/Code/Editor/EditorViewportWidget.cpp +++ b/Code/Editor/EditorViewportWidget.cpp @@ -1528,7 +1528,7 @@ AZ::EntityId EditorViewportWidget::GetCurrentViewEntityId() &AZ::RPI::ViewProviderBus::Events::GetView ); - const bool isViewEntityCorrect = viewEntityView == GetCurrentAtomView(); + [[maybe_unused]] const bool isViewEntityCorrect = viewEntityView == GetCurrentAtomView(); AZ_Error("EditorViewportWidget", isViewEntityCorrect, "GetCurrentViewEntityId called while the current view is being changed. " "You may get inconsistent results if you make use of the returned entity ID. " diff --git a/Code/Editor/TrackView/TrackViewAnimNode.cpp b/Code/Editor/TrackView/TrackViewAnimNode.cpp index 2119bf849f..0bb9ac5593 100644 --- a/Code/Editor/TrackView/TrackViewAnimNode.cpp +++ b/Code/Editor/TrackView/TrackViewAnimNode.cpp @@ -1942,7 +1942,7 @@ void CTrackViewAnimNode::OnSelectionChanged(const bool selected) { if (m_animNode) { - const AnimNodeType animNodeType = GetType(); + [[maybe_unused]] const AnimNodeType animNodeType = GetType(); AZ_Assert(animNodeType == AnimNodeType::AzEntity, "Expected AzEntity for selection changed"); const EAnimNodeFlags flags = (EAnimNodeFlags)m_animNode->GetFlags(); diff --git a/Code/Framework/AzCore/AzCore/Asset/AssetContainer.cpp b/Code/Framework/AzCore/AzCore/Asset/AssetContainer.cpp index 83cc1da69a..ce15c7bc4e 100644 --- a/Code/Framework/AzCore/AzCore/Asset/AssetContainer.cpp +++ b/Code/Framework/AzCore/AzCore/Asset/AssetContainer.cpp @@ -153,6 +153,7 @@ namespace AZ // behavior, we would need to rework the way filters work as well as the code in AssetSerializer.cpp to pass down // the loadParams.m_assetLoadFilterCB that was passed into the AddDependentAssets() methods to use as the dependent // asset filter instead of this lambda function. + AZ_UNUSED(handledAssetDependencyList); // Prevent unused warning in release builds AZ_Assert(AZStd::find(handledAssetDependencyList.begin(), handledAssetDependencyList.end(), filterInfo.m_assetId) != handledAssetDependencyList.end(), "Dependent Asset ID (%s) is expected to load, but the Asset Catalog has no dependency recorded. " diff --git a/Code/Framework/AzCore/AzCore/Asset/AssetManager.cpp b/Code/Framework/AzCore/AzCore/Asset/AssetManager.cpp index f31859c14d..3df751fb02 100644 --- a/Code/Framework/AzCore/AzCore/Asset/AssetManager.cpp +++ b/Code/Framework/AzCore/AzCore/Asset/AssetManager.cpp @@ -1478,7 +1478,7 @@ namespace AZ // Resolve the asset handler and account for the new asset instance. { - AssetHandlerMap::iterator handlerIt = m_handlers.find(newData->GetType()); + [[maybe_unused]] AssetHandlerMap::iterator handlerIt = m_handlers.find(newData->GetType()); AZ_Assert( handlerIt != m_handlers.end(), "No handler was registered for this asset [type:%s id:%s]!", newData->GetType().ToString().c_str(), newData->GetId().ToString().c_str()); @@ -1869,7 +1869,7 @@ namespace AZ { AZStd::scoped_lock requestLock(m_activeBlockingRequestMutex); - auto inserted = m_activeBlockingRequests.insert(AZStd::make_pair(assetId, blockingRequest)); + [[maybe_unused]] auto inserted = m_activeBlockingRequests.insert(AZStd::make_pair(assetId, blockingRequest)); AZ_Assert(inserted.second, "Failed to track blocking request for asset %s", assetId.ToString().c_str()); } diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/FullFileDecompressor.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/FullFileDecompressor.cpp index 44bf36bd9d..6427571f10 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/FullFileDecompressor.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/FullFileDecompressor.cpp @@ -45,8 +45,10 @@ namespace AZ } } +#if AZ_STREAMER_ADD_EXTRA_PROFILING_INFO static constexpr char DecompBoundName[] = "Decompression bound"; static constexpr char ReadBoundName[] = "Read bound"; +#endif // AZ_STREAMER_ADD_EXTRA_PROFILING_INFO bool FullFileDecompressor::DecompressionInformation::IsProcessing() const { diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/Scheduler.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/Scheduler.cpp index e7f9b0fd18..9b4996ad49 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/Scheduler.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/Scheduler.cpp @@ -14,8 +14,10 @@ namespace AZ::IO { +#if AZ_STREAMER_ADD_EXTRA_PROFILING_INFO static constexpr char SchedulerName[] = "Scheduler"; static constexpr char ImmediateReadsName[] = "Immediate reads"; +#endif // AZ_STREAMER_ADD_EXTRA_PROFILING_INFO Scheduler::Scheduler(AZStd::shared_ptr streamStack, u64 memoryAlignment, u64 sizeAlignment, u64 granularity) { @@ -337,7 +339,7 @@ namespace AZ::IO AZStd::chrono::system_clock::time_point now = AZStd::chrono::system_clock::now(); auto visitor = [this, now](auto&& args) -> void #else - auto visitor = [this](auto&& args) -> void + auto visitor = [](auto&& args) -> void #endif { using Command = AZStd::decay_t; diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/StreamerContext.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/StreamerContext.cpp index 823ab6e050..5cd483bc55 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/StreamerContext.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/StreamerContext.cpp @@ -17,10 +17,11 @@ namespace AZ namespace IO { static constexpr char ContextName[] = "Context"; +#if AZ_STREAMER_ADD_EXTRA_PROFILING_INFO static constexpr char PredictionAccuracyName[] = "Prediction accuracy (ms)"; static constexpr char LatePredictionName[] = "Early completions"; static constexpr char MissedDeadlinesName[] = "Missed deadlines"; - +#endif // AZ_STREAMER_ADD_EXTRA_PROFILING_INFO StreamerContext::~StreamerContext() { for (FileRequest* entry : m_internalRecycleBin) diff --git a/Code/Framework/AzCore/AzCore/Memory/OverrunDetectionAllocator.cpp b/Code/Framework/AzCore/AzCore/Memory/OverrunDetectionAllocator.cpp index 63fa9250d6..e59e304c54 100644 --- a/Code/Framework/AzCore/AzCore/Memory/OverrunDetectionAllocator.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/OverrunDetectionAllocator.cpp @@ -511,7 +511,7 @@ AZ::OverrunDetectionSchemaImpl::OverrunDetectionSchemaImpl(const OverrunDetectio { m_platformAllocator.reset(new Internal::PlatformOverrunDetectionSchema); - auto info = m_platformAllocator->GetSystemInformation(); + [[maybe_unused]] auto info = m_platformAllocator->GetSystemInformation(); AZ_Assert(info.m_pageSize == Internal::ODS_PAGE_SIZE, "System page size %d does not equal expected page size %d", info.m_pageSize, Internal::ODS_PAGE_SIZE); AZ_Assert(info.m_minimumAllocationSize == Internal::ODS_ALLOCATION_SIZE, "System minimum allocation size %d does not equal expected size %d", info.m_minimumAllocationSize, Internal::ODS_ALLOCATION_SIZE); diff --git a/Code/Framework/AzCore/AzCore/Name/NameDictionary.cpp b/Code/Framework/AzCore/AzCore/Name/NameDictionary.cpp index cf85e0f4e0..8e8011add9 100644 --- a/Code/Framework/AzCore/AzCore/Name/NameDictionary.cpp +++ b/Code/Framework/AzCore/AzCore/Name/NameDictionary.cpp @@ -87,7 +87,7 @@ namespace AZ { Internal::NameData* nameData = keyValue.second; const int useCount = keyValue.second->m_useCount; - const bool hadCollision = keyValue.second->m_hashCollision; + [[maybe_unused]] const bool hadCollision = keyValue.second->m_hashCollision; if (useCount == 0) { diff --git a/Code/Framework/AzCore/AzCore/Serialization/Json/RegistrationContext.cpp b/Code/Framework/AzCore/AzCore/Serialization/Json/RegistrationContext.cpp index fae67d487c..989f306b08 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/Json/RegistrationContext.cpp +++ b/Code/Framework/AzCore/AzCore/Serialization/Json/RegistrationContext.cpp @@ -43,7 +43,7 @@ namespace AZ if (!overwriteExisting) { - auto emplaceResult = m_context->m_handledTypesMap.try_emplace(uuid, serializer); + [[maybe_unused]] auto emplaceResult = m_context->m_handledTypesMap.try_emplace(uuid, serializer); AZ_Assert( emplaceResult.second, "Couldn't register Json serializer %s. Another serializer (%s) has already been registered for the same Uuid (%s).", diff --git a/Code/Framework/AzCore/AzCore/Serialization/ObjectStream.cpp b/Code/Framework/AzCore/AzCore/Serialization/ObjectStream.cpp index 73ab174699..6251a2e6de 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/ObjectStream.cpp +++ b/Code/Framework/AzCore/AzCore/Serialization/ObjectStream.cpp @@ -1520,6 +1520,7 @@ namespace AZ { if (m_writeElementResultStack.empty()) { + AZ_UNUSED(classData); // Prevent unused warning in release builds AZ_Error("Serialize", false, "CloseElement is attempted to be called without a corresponding WriteElement when writing class %s", classData->m_name); return true; } @@ -1581,6 +1582,7 @@ namespace AZ { if (m_writeElementResultStack.empty()) { + AZ_UNUSED(classData); // Prevent unused warning in release builds AZ_Error("Serialize", false, "CloseElement is attempted to be called without a corresponding WriteElement when writing class %s", classData->m_name); return true; } @@ -1644,6 +1646,7 @@ namespace AZ { if (m_writeElementResultStack.empty()) { + AZ_UNUSED(classData); // Prevent unused warning in release builds AZ_Error("Serialize", false, "CloseElement is attempted to be called without a corresponding WriteElement when writing class %s", classData->m_name); return true; } diff --git a/Code/Framework/AzCore/AzCore/Slice/SliceComponent.cpp b/Code/Framework/AzCore/AzCore/Slice/SliceComponent.cpp index 23a197b2ad..03ed3f6ebb 100644 --- a/Code/Framework/AzCore/AzCore/Slice/SliceComponent.cpp +++ b/Code/Framework/AzCore/AzCore/Slice/SliceComponent.cpp @@ -3839,6 +3839,7 @@ namespace AZ { if (instance->GetId() == existingInstance.GetId()) { + AZ_UNUSED(sliceReference); // Prevent unused warning in release builds AZ_Warning("Slice", false, "Multiple slice instances with the same ID from slice %s were found. The last instance found has been loaded.", sliceReference.GetSliceAsset().GetHint().c_str()); return true; diff --git a/Code/Framework/AzCore/Platform/Mac/AzCore/Platform_Mac.cpp b/Code/Framework/AzCore/Platform/Mac/AzCore/Platform_Mac.cpp index edb3d3ea0e..78e97f47c8 100644 --- a/Code/Framework/AzCore/Platform/Mac/AzCore/Platform_Mac.cpp +++ b/Code/Framework/AzCore/Platform/Mac/AzCore/Platform_Mac.cpp @@ -32,7 +32,7 @@ namespace AZ timespec wait; wait.tv_sec = 0; wait.tv_nsec = 5000; - int result = ::gethostuuid(hostId, &wait); + [[maybe_unused]] int result = ::gethostuuid(hostId, &wait); AZ_Error("System", result == 0, "gethostuuid() failed with code %d", result); Sha1 hash; AZ::u32 digest[5] = { 0 }; diff --git a/Code/Framework/AzFramework/AzFramework/Application/Application.cpp b/Code/Framework/AzFramework/AzFramework/Application/Application.cpp index fa0f14ac74..958dba2cc9 100644 --- a/Code/Framework/AzFramework/AzFramework/Application/Application.cpp +++ b/Code/Framework/AzFramework/AzFramework/Application/Application.cpp @@ -72,7 +72,7 @@ #include #include -static const char* s_azFrameworkWarningWindow = "AzFramework"; +[[maybe_unused]] static const char* s_azFrameworkWarningWindow = "AzFramework"; namespace AzFramework { @@ -602,7 +602,7 @@ namespace AzFramework void Application::SetRootPath(RootPathType type, const char* source) { - const size_t sourceLen = strlen(source); + [[maybe_unused]] const size_t sourceLen = strlen(source); // Copy the source path to the intended root path and correct the path separators as well switch (type) diff --git a/Code/Framework/AzFramework/AzFramework/Asset/Benchmark/BenchmarkCommands.cpp b/Code/Framework/AzFramework/AzFramework/Asset/Benchmark/BenchmarkCommands.cpp index d27fe8188f..30c1aa39c0 100644 --- a/Code/Framework/AzFramework/AzFramework/Asset/Benchmark/BenchmarkCommands.cpp +++ b/Code/Framework/AzFramework/AzFramework/Asset/Benchmark/BenchmarkCommands.cpp @@ -43,7 +43,7 @@ namespace AzFramework::AssetBenchmark AZStd::thread benchmarkThread([assetList = AZStd::move(sourceAssetList), loadBlocking]() { // Define the set of loading stats to track - const size_t initialRequests = assetList.size(); + [[maybe_unused]] const size_t initialRequests = assetList.size(); size_t previouslyLoadedAssets = 0; size_t newlyLoadedAssets = 0; size_t loadErrors = 0; diff --git a/Code/Framework/AzFramework/AzFramework/IO/RemoteFileIO.cpp b/Code/Framework/AzFramework/AzFramework/IO/RemoteFileIO.cpp index 3ac1b91144..041e5baf4a 100644 --- a/Code/Framework/AzFramework/AzFramework/IO/RemoteFileIO.cpp +++ b/Code/Framework/AzFramework/AzFramework/IO/RemoteFileIO.cpp @@ -24,9 +24,9 @@ namespace AZ namespace IO { ////////////////////////////////////////////////////////////////////////// - const char* const NetworkFileIOChannel = "NetworkFileIO"; + [[maybe_unused]] const char* const NetworkFileIOChannel = "NetworkFileIO"; #ifndef REMOTEFILEIO_IS_NETWORKFILEIO - const char* const RemoteFileIOChannel = "RemoteFileIO"; + [[maybe_unused]] const char* const RemoteFileIOChannel = "RemoteFileIO"; #ifdef REMOTEFILEIO_SYNC_CHECK const char* const RemoteFileCacheChannel = "RemoteFileCache"; #endif diff --git a/Code/Framework/AzFramework/AzFramework/Network/AssetProcessorConnection.cpp b/Code/Framework/AzFramework/AzFramework/Network/AssetProcessorConnection.cpp index ebea29c2d9..2e1cde443c 100644 --- a/Code/Framework/AzFramework/AzFramework/Network/AssetProcessorConnection.cpp +++ b/Code/Framework/AzFramework/AzFramework/Network/AssetProcessorConnection.cpp @@ -177,7 +177,7 @@ namespace AzFramework //trying to connect, if any error occurs start the disconnect thread void AssetProcessorConnection::ConnectThread() { - static constexpr char ConnectThreadWindow[] = "AssetProcessorConnection::ConnectThread"; + [[maybe_unused]] static constexpr char ConnectThreadWindow[] = "AssetProcessorConnection::ConnectThread"; //check for join before doing an op if (m_connectThread.m_join) diff --git a/Code/Framework/AzFramework/AzFramework/Visibility/VisibilityDebug.cpp b/Code/Framework/AzFramework/AzFramework/Visibility/VisibilityDebug.cpp index 0d74bcc54b..a71819ab45 100644 --- a/Code/Framework/AzFramework/AzFramework/Visibility/VisibilityDebug.cpp +++ b/Code/Framework/AzFramework/AzFramework/Visibility/VisibilityDebug.cpp @@ -91,7 +91,7 @@ namespace AzFramework const AZ::Frustum::PlaneId planeId3) { AZ::Vector3 corner = AZ::Vector3::CreateZero(); - const auto intersectionOkay = AZ::ShapeIntersection::IntersectThreePlanes( + [[maybe_unused]] const auto intersectionOkay = AZ::ShapeIntersection::IntersectThreePlanes( frustum.GetPlane(planeId1), frustum.GetPlane(planeId2), frustum.GetPlane(planeId3), corner); AZ_Assert(intersectionOkay, "Plane intersection of Frustum failed"); diff --git a/Code/Framework/AzFramework/Platform/Android/AzFramework/Input/Devices/Motion/InputDeviceMotion_Android.cpp b/Code/Framework/AzFramework/Platform/Android/AzFramework/Input/Devices/Motion/InputDeviceMotion_Android.cpp index 5cb3985569..74b2024fd1 100644 --- a/Code/Framework/AzFramework/Platform/Android/AzFramework/Input/Devices/Motion/InputDeviceMotion_Android.cpp +++ b/Code/Framework/AzFramework/Platform/Android/AzFramework/Input/Devices/Motion/InputDeviceMotion_Android.cpp @@ -175,7 +175,7 @@ namespace AzFramework m_packedSensorDataArray = new float[packedSensorDataLength]; // create the java instance - bool ret = m_motionSensorManager->CreateInstance("(Landroid/app/Activity;)V", AZ::Android::Utils::GetActivityRef()); + [[maybe_unused]] bool ret = m_motionSensorManager->CreateInstance("(Landroid/app/Activity;)V", AZ::Android::Utils::GetActivityRef()); AZ_Assert(ret, "Failed to create the MotionSensorManager Java instance."); } diff --git a/Code/Framework/AzFramework/Platform/Android/AzFramework/Input/Devices/VirtualKeyboard/InputDeviceVirtualKeyboard_Android.cpp b/Code/Framework/AzFramework/Platform/Android/AzFramework/Input/Devices/VirtualKeyboard/InputDeviceVirtualKeyboard_Android.cpp index 00139ffc9d..c477b0bd37 100644 --- a/Code/Framework/AzFramework/Platform/Android/AzFramework/Input/Devices/VirtualKeyboard/InputDeviceVirtualKeyboard_Android.cpp +++ b/Code/Framework/AzFramework/Platform/Android/AzFramework/Input/Devices/VirtualKeyboard/InputDeviceVirtualKeyboard_Android.cpp @@ -128,7 +128,7 @@ namespace AzFramework }); // create the java instance - bool ret = m_keyboardHandler->CreateInstance("(Landroid/app/Activity;)V", AZ::Android::Utils::GetActivityRef()); + [[maybe_unused]] bool ret = m_keyboardHandler->CreateInstance("(Landroid/app/Activity;)V", AZ::Android::Utils::GetActivityRef()); AZ_Assert(ret, "Failed to create the KeyboardHandler Java instance."); // Connect to the raw input notifications bus diff --git a/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessCommunicator_Linux.cpp b/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessCommunicator_Linux.cpp index 325ab81d41..0249a42976 100644 --- a/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessCommunicator_Linux.cpp +++ b/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessCommunicator_Linux.cpp @@ -78,7 +78,7 @@ namespace AzFramework FD_ZERO(&set); FD_SET(handle->GetHandle(), &set); - int numReady = select(handle->GetHandle() + 1, &set, NULL, NULL, NULL); + [[maybe_unused]] int numReady = select(handle->GetHandle() + 1, &set, NULL, NULL, NULL); // if numReady == -1 and errno == EINTR then the child process died unexpectedly and // the handle was closed. Not something to assert about in regards to trying to read @@ -87,7 +87,7 @@ namespace AzFramework // dead and return any error codes the child may have written to the error stream. AZ_Assert(numReady != -1 || errno == EINTR, "Could not determine if any data is available for reading due to an error. Errno: %d", errno); - const bool wasSet = FD_ISSET(handle->GetHandle(), &set); + [[maybe_unused]] const bool wasSet = FD_ISSET(handle->GetHandle(), &set); AZ_Assert(wasSet, "handle was not set when we selected it for read"); return 0; diff --git a/Code/Framework/AzFramework/Platform/Mac/AzFramework/Process/ProcessCommunicator_Mac.cpp b/Code/Framework/AzFramework/Platform/Mac/AzFramework/Process/ProcessCommunicator_Mac.cpp index ea22bc72a3..1c233c6f29 100644 --- a/Code/Framework/AzFramework/Platform/Mac/AzFramework/Process/ProcessCommunicator_Mac.cpp +++ b/Code/Framework/AzFramework/Platform/Mac/AzFramework/Process/ProcessCommunicator_Mac.cpp @@ -75,7 +75,7 @@ namespace AzFramework FD_ZERO(&set); FD_SET(handle->GetHandle(), &set); - int numReady = select(handle->GetHandle() + 1, &set, NULL, NULL, NULL); + [[maybe_unused]] int numReady = select(handle->GetHandle() + 1, &set, NULL, NULL, NULL); // if numReady == -1 and errno == EINTR then the child process died unexpectedly and // the handle was closed. Not something to assert about in regards to trying to read @@ -84,7 +84,7 @@ namespace AzFramework // dead and return any error codes the child may have written to the error stream. AZ_Assert(numReady != -1 || errno == EINTR, "Could not determine if any data is available for reading due to an error. Errno: %d", errno); - const bool wasSet = FD_ISSET(handle->GetHandle(), &set); + [[maybe_unused]] const bool wasSet = FD_ISSET(handle->GetHandle(), &set); AZ_Assert(wasSet, "handle was not set when we selected it for read"); return 0; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Link/Link.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Link/Link.cpp index 940a2787cb..800a90c622 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Link/Link.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Link/Link.cpp @@ -181,10 +181,10 @@ namespace AzToolsFramework PrefabDomUtils::ApplyPatches(sourceTemplateDomCopy, targetTemplatePrefabDom.GetAllocator(), patchesReference->get()); linkedInstanceDom.CopyFrom(sourceTemplateDomCopy, targetTemplatePrefabDom.GetAllocator()); - PrefabDomValueReference sourceTemplateName = + [[maybe_unused]] PrefabDomValueReference sourceTemplateName = PrefabDomUtils::FindPrefabDomValue(sourceTemplateDomCopy, PrefabDomUtils::SourceName); AZ_Assert(sourceTemplateName && sourceTemplateName->get().IsString(), "A valid source template name couldn't be found"); - PrefabDomValueReference targetTemplateName = + [[maybe_unused]] PrefabDomValueReference targetTemplateName = PrefabDomUtils::FindPrefabDomValue(targetTemplatePrefabDom, PrefabDomUtils::SourceName); AZ_Assert(targetTemplateName && targetTemplateName->get().IsString(), "A valid target template name couldn't be found"); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp index 24cd0f0252..c412033362 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp @@ -1259,12 +1259,12 @@ namespace AzToolsFramework auto& containerEntity = *containerEntityPtr.release(); auto editorPrefabComponent = containerEntity.FindComponent(); containerEntity.Deactivate(); - const bool editorPrefabComponentRemoved = containerEntity.RemoveComponent(editorPrefabComponent); + [[maybe_unused]] const bool editorPrefabComponentRemoved = containerEntity.RemoveComponent(editorPrefabComponent); AZ_Assert(editorPrefabComponentRemoved, "Remove EditorPrefabComponent failed."); delete editorPrefabComponent; containerEntity.Activate(); - const bool containerEntityAdded = parentInstance.AddEntity(containerEntity); + [[maybe_unused]] const bool containerEntityAdded = parentInstance.AddEntity(containerEntity); AZ_Assert(containerEntityAdded, "Add target Instance's container entity to its parent Instance failed."); EntityIdList entityIds; @@ -1281,7 +1281,7 @@ namespace AzToolsFramework [&](AZStd::unique_ptr entityPtr) { auto& entity = *entityPtr.release(); - const bool entityAdded = parentInstance.AddEntity(entity); + [[maybe_unused]] const bool entityAdded = parentInstance.AddEntity(entity); AZ_Assert(entityAdded, "Add target Instance's entity to its parent Instance failed."); entityIds.emplace_back(entity.GetId()); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp index 1051e530c8..f3250e0bfd 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp @@ -783,7 +783,7 @@ namespace AzToolsFramework PrefabDomValue& instance = instanceIterator->value; AZ_Assert(instance.IsObject(), "Nested instance DOM provided is not a valid JSON object."); - PrefabDomValueReference sourceTemplateName = PrefabDomUtils::FindPrefabDomValue(instance, PrefabDomUtils::SourceName); + [[maybe_unused]] 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(), diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp index fc64e0b5b3..fe3555a853 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp @@ -262,7 +262,7 @@ namespace AzToolsFramework instanceDom.CopyFrom(instanceDomRef->get(), instanceDom.GetAllocator()); //apply the patch to the template within the target - AZ::JsonSerializationResult::ResultCode result = PrefabDomUtils::ApplyPatches(instanceDom, instanceDom.GetAllocator(), patch); + [[maybe_unused]] AZ::JsonSerializationResult::ResultCode result = PrefabDomUtils::ApplyPatches(instanceDom, instanceDom.GetAllocator(), patch); AZ_Error( "Prefab", diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Slice/SlicePushWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Slice/SlicePushWidget.cpp index c276fc5c5a..76f91b438e 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Slice/SlicePushWidget.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Slice/SlicePushWidget.cpp @@ -2525,7 +2525,7 @@ namespace AzToolsFramework { // This is an approximate measurement of how much this slice proliferates within the currently-loaded level. // Down the line we'll actually query the asset DB's dependency tree, summing up instances. - + AZ_UNUSED(levelSlice); // Prevent unused warning in release builds AZ_Warning("SlicePush", levelSlice, "SlicePushWidget::CalculateReferenceCount could not find root slice, displayed counts will be inaccurate!"); size_t instanceCount = 0; AZ::Data::AssetBus::EnumerateHandlersId(assetId, diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUndoLinkTests.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUndoLinkTests.cpp index e506159fd2..8fafe1f177 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUndoLinkTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUndoLinkTests.cpp @@ -97,7 +97,7 @@ namespace UnitTest //apply the patch PrefabDom& templateDomReference = m_prefabSystemComponent->FindTemplateDom(nestedTemplateId); - AZ::JsonSerializationResult::ResultCode result = + [[maybe_unused]] AZ::JsonSerializationResult::ResultCode result = PrefabDomUtils::ApplyPatches(templateDomReference, templateDomReference.GetAllocator(), patch); AZ_Error("Prefab", result.GetOutcome() == AZ::JsonSerializationResult::Outcomes::Success, diff --git a/Code/Framework/GridMate/GridMate/Carrier/Carrier.cpp b/Code/Framework/GridMate/GridMate/Carrier/Carrier.cpp index 0285a7fc02..8b484143de 100644 --- a/Code/Framework/GridMate/GridMate/Carrier/Carrier.cpp +++ b/Code/Framework/GridMate/GridMate/Carrier/Carrier.cpp @@ -1452,7 +1452,7 @@ void CarrierThread::NotifyRateUpdate(ThreadConnection* conn) float rtt = lifetime.m_rtt > 1.f ? lifetime.m_rtt : 100.f; //For unknown RTT use conservative 100ms to avoid buffer bloat //Note: using lifetime RTT as stand-in for smoothed RTT float ratef = (1010 * (cState.m_congestionWindow)) / rtt; //Add 10% to allow rate increases until buffer fills up - constexpr float max_rate = azlossy_cast(0x7FFFFFFF); + [[maybe_unused]] constexpr float max_rate = azlossy_cast(0x7FFFFFFF); AZ_Assert(ratef <= max_rate, " ratef %f > 0x7FFFFFFF", ratef); bytesPerSecond = static_cast(ratef); diff --git a/Code/Legacy/CrySystem/ConsoleBatchFile.cpp b/Code/Legacy/CrySystem/ConsoleBatchFile.cpp index 3d46716873..d3a0ccf4de 100644 --- a/Code/Legacy/CrySystem/ConsoleBatchFile.cpp +++ b/Code/Legacy/CrySystem/ConsoleBatchFile.cpp @@ -87,7 +87,7 @@ bool CConsoleBatchFile::ExecuteConfigFile(const char* sFilename) CCryFile file; { - const char* szLog = "Executing console batch file (try game,config,root):"; + [[maybe_unused]] const char* szLog = "Executing console batch file (try game,config,root):"; AZStd::string filenameLog; AZStd::string sfn = PathUtil::GetFile(filename); diff --git a/Code/Legacy/CrySystem/LocalizedStringManager.cpp b/Code/Legacy/CrySystem/LocalizedStringManager.cpp index 78ece6f74c..365c71252c 100644 --- a/Code/Legacy/CrySystem/LocalizedStringManager.cpp +++ b/Code/Legacy/CrySystem/LocalizedStringManager.cpp @@ -32,8 +32,11 @@ #define MAX_CELL_COUNT 32 // CVAR names +#if !defined(_RELEASE) const char c_sys_localization_debug[] = "sys_localization_debug"; const char c_sys_localization_encode[] = "sys_localization_encode"; +#endif // !defined(_RELEASE) + #define LOC_WINDOW "Localization" const char c_sys_localization_format[] = "sys_localization_format"; @@ -1754,7 +1757,7 @@ void CLocalizedStringsManager::ReloadData() void CLocalizedStringsManager::AddLocalizedString(SLanguage* pLanguage, SLocalizedStringEntry* pEntry, const uint32 keyCRC32) { pLanguage->m_vLocalizedStrings.push_back(pEntry); - int nId = (int)pLanguage->m_vLocalizedStrings.size() - 1; + [[maybe_unused]] int nId = (int)pLanguage->m_vLocalizedStrings.size() - 1; pLanguage->m_keysMap[keyCRC32] = pEntry; if (m_cvarLocalizationDebug >= 2) diff --git a/Code/Legacy/CrySystem/Log.cpp b/Code/Legacy/CrySystem/Log.cpp index a157501f0a..68b9621f74 100644 --- a/Code/Legacy/CrySystem/Log.cpp +++ b/Code/Legacy/CrySystem/Log.cpp @@ -744,7 +744,7 @@ void CLog::LogToConsolePlus(const char* szFormat, ...) ////////////////////////////////////////////////////////////////////// -static void RemoveColorCodeInPlace(CLog::LogStringType& rStr) +[[maybe_unused]] static void RemoveColorCodeInPlace(CLog::LogStringType& rStr) { char* s = (char*)rStr.c_str(); char* d = s; diff --git a/Code/Legacy/CrySystem/System.cpp b/Code/Legacy/CrySystem/System.cpp index 2d756d1352..70fb9382e1 100644 --- a/Code/Legacy/CrySystem/System.cpp +++ b/Code/Legacy/CrySystem/System.cpp @@ -1465,7 +1465,7 @@ void CSystem::SetSystemGlobalState(const ESystemGlobalState systemGlobalState) if (gEnv && gEnv->pTimer) { const CTimeValue endTime = gEnv->pTimer->GetAsyncTime(); - const float numSeconds = endTime.GetDifferenceInSeconds(s_startTime); + [[maybe_unused]] const float numSeconds = endTime.GetDifferenceInSeconds(s_startTime); CryLog("SetGlobalState %d->%d '%s'->'%s' %3.1f seconds", m_systemGlobalState, systemGlobalState, CSystem::GetSystemGlobalStateName(m_systemGlobalState), CSystem::GetSystemGlobalStateName(systemGlobalState), diff --git a/Code/Legacy/CrySystem/SystemCFG.cpp b/Code/Legacy/CrySystem/SystemCFG.cpp index 57de0be909..0f67fdc2e1 100644 --- a/Code/Legacy/CrySystem/SystemCFG.cpp +++ b/Code/Legacy/CrySystem/SystemCFG.cpp @@ -180,7 +180,7 @@ void CSystem::LogVersion() strftime(s, 128, "%d %b %y (%H %M %S)", today); #endif - const SFileVersion& ver = GetFileVersion(); + [[maybe_unused]] const SFileVersion& ver = GetFileVersion(); CryLogAlways("BackupNameAttachment=\" Build(%d) %s\" -- used by backup system\n", ver.v[0], s); // read by CreateBackupFile() @@ -251,7 +251,7 @@ void CSystem::LogVersion() ////////////////////////////////////////////////////////////////////////// void CSystem::LogBuildInfo() { - auto projectName = AZ::Utils::GetProjectName(); + [[maybe_unused]] auto projectName = AZ::Utils::GetProjectName(); CryLogAlways("GameName: %s", projectName.c_str()); CryLogAlways("BuildTime: " __DATE__ " " __TIME__); } diff --git a/Code/Legacy/CrySystem/SystemInit.cpp b/Code/Legacy/CrySystem/SystemInit.cpp index a0769d1a2c..d5efff2748 100644 --- a/Code/Legacy/CrySystem/SystemInit.cpp +++ b/Code/Legacy/CrySystem/SystemInit.cpp @@ -257,8 +257,8 @@ static void CmdCrashTest(IConsoleCmdArgs* pArgs) { float a = 1.0f; memset(&a, 0, sizeof(a)); - float* b = &a; - float c = 3; + [[maybe_unused]] float* b = &a; + [[maybe_unused]] float c = 3; CryLog("%f", (c / *b)); } break; diff --git a/Code/Legacy/CrySystem/Timer.cpp b/Code/Legacy/CrySystem/Timer.cpp index d411e76875..1e1b6859e1 100644 --- a/Code/Legacy/CrySystem/Timer.cpp +++ b/Code/Legacy/CrySystem/Timer.cpp @@ -550,7 +550,7 @@ void CTimer::Serialize(TSerialize ser) if (m_TimeDebug) { - const int64 now = CryGetTicks(); + [[maybe_unused]] const int64 now = CryGetTicks(); CryLogAlways("[CTimer]: Serialize: Last=%lld Now=%lld Off=%lld Async=%f CurrTime=%f UI=%f", (long long)m_lLastTime, (long long)now, (long long)m_lOffsetTime, GetAsyncCurTime(), GetCurrTime(ETIMER_GAME), GetCurrTime(ETIMER_UI)); } } @@ -700,8 +700,8 @@ void CTimer::EnableFixedTimeMode([[maybe_unused]] bool enable, [[maybe_unused]] void CTimer::SetOffsetToMatchGameTime(int64 ticks) { - const int64 previousOffset = m_lOffsetTime; - const float previousGameTime = GetCurrTime(ETIMER_GAME); + [[maybe_unused]] const int64 previousOffset = m_lOffsetTime; + [[maybe_unused]] const float previousGameTime = GetCurrTime(ETIMER_GAME); m_lOffsetTime = ticks - m_lLastTime; RefreshGameTime(m_lLastTime); diff --git a/Code/Tools/AssetBundler/source/utils/applicationManager.cpp b/Code/Tools/AssetBundler/source/utils/applicationManager.cpp index 0887b17682..0742035c1a 100644 --- a/Code/Tools/AssetBundler/source/utils/applicationManager.cpp +++ b/Code/Tools/AssetBundler/source/utils/applicationManager.cpp @@ -1399,7 +1399,7 @@ namespace AssetBundler AZStd::string_view{ AZ::Utils::GetEnginePath() }, AZStd::string_view{ AZ::Utils::GetEnginePath() }, AZStd::string_view{ AZ::Utils::GetProjectPath() }); - auto platformsString = AzFramework::PlatformHelper::GetCommaSeparatedPlatformList(platformFlags); + [[maybe_unused]] auto platformsString = AzFramework::PlatformHelper::GetCommaSeparatedPlatformList(platformFlags); AZ_TracePrintf(AppWindowName, "No platform specified, defaulting to platforms ( %s ).\n", platformsString.c_str()); return platformFlags; diff --git a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpColorStreamImporter.cpp b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpColorStreamImporter.cpp index 4043f529df..f9b3de6df1 100644 --- a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpColorStreamImporter.cpp +++ b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpColorStreamImporter.cpp @@ -57,7 +57,7 @@ namespace AZ // This node has at least one mesh, verify that the color channel counts are the same for all meshes. const unsigned int expectedColorChannels = scene->mMeshes[currentNode->mMeshes[0]]->GetNumColorChannels(); - const bool allMeshesHaveSameNumberOfColorChannels = + [[maybe_unused]] const bool allMeshesHaveSameNumberOfColorChannels = AZStd::all_of(currentNode->mMeshes + 1, currentNode->mMeshes + currentNode->mNumMeshes, [scene, expectedColorChannels](const unsigned int meshIndex) { return scene->mMeshes[meshIndex]->GetNumColorChannels() == expectedColorChannels; diff --git a/Code/Tools/Standalone/Source/LUA/LUAEditorContext.cpp b/Code/Tools/Standalone/Source/LUA/LUAEditorContext.cpp index 1fa127dd7d..f36724ee1a 100644 --- a/Code/Tools/Standalone/Source/LUA/LUAEditorContext.cpp +++ b/Code/Tools/Standalone/Source/LUA/LUAEditorContext.cpp @@ -1020,7 +1020,7 @@ namespace LUAEditor { AZ_TracePrintf(LUAEditorDebugName, AZStd::string::format("LUAEditor OnSaveDocumentAs" "%s\n", assetId.c_str()).c_str()); - DocumentInfoMap::iterator docInfoIter = m_documentInfoMap.find(assetId); + [[maybe_unused]] DocumentInfoMap::iterator docInfoIter = m_documentInfoMap.find(assetId); AZ_Assert(docInfoIter != m_documentInfoMap.end(), "LUAEditor OnSaveDocumentAs() : Cant find Document Info."); OnSaveDocument(assetId, bCloseAfterSave, true); diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ConvertPixelFormat.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ConvertPixelFormat.cpp index 8f851b46d1..b0f78d60a3 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ConvertPixelFormat.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ConvertPixelFormat.cpp @@ -98,7 +98,7 @@ namespace ImageProcessingAtom else { IImageObjectPtr dstImage = nullptr; - const PixelFormatInfo* compressedInfo = CPixelFormats::GetInstance().GetPixelFormatInfo(compressedFmt); + [[maybe_unused]] const PixelFormatInfo* compressedInfo = CPixelFormats::GetInstance().GetPixelFormatInfo(compressedFmt); if (isSrcUncompressed) { AZ::u64 startTime = AZStd::GetTimeUTCMilliSecond(); diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageConvert.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageConvert.cpp index a1093ffc37..1618f376b4 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageConvert.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageConvert.cpp @@ -350,7 +350,7 @@ namespace ImageProcessingAtom // output conversion log if (m_isSucceed && m_isFinished) { - const uint32 sizeTotal = m_image->Get()->GetTextureMemory(); + [[maybe_unused]] const uint32 sizeTotal = m_image->Get()->GetTextureMemory(); if (m_input->m_isPreview) { AZ_TracePrintf("Image Processing", "Image (%d bytes) converted in %f seconds\n", sizeTotal, m_processTime); @@ -971,7 +971,7 @@ namespace ImageProcessingAtom IImageObjectPtr previewImageAlpha = imageToProcess2.Get(); const uint32 imageMips = previewImage->GetMipCount(); - const uint32 alphaMips = previewImageAlpha->GetMipCount(); + [[maybe_unused]] const uint32 alphaMips = previewImageAlpha->GetMipCount(); // Get count of bytes per pixel for both rgb and alpha images uint32 imagePixelBytes = CPixelFormats::GetInstance().GetPixelFormatInfo(ePixelFormat_R8G8B8A8)->bitsPerBlock / 8; @@ -983,7 +983,7 @@ namespace ImageProcessingAtom for (uint32 mipLevel = 0; mipLevel < imageMips; ++mipLevel) { const uint32 pixelCount = previewImage->GetPixelCount(mipLevel); - const uint32 alphaPixelCount = previewImageAlpha->GetPixelCount(mipLevel); + [[maybe_unused]] const uint32 alphaPixelCount = previewImageAlpha->GetPixelCount(mipLevel); AZ_Assert(pixelCount == alphaPixelCount, "Pixel count for image and alpha image at mip level %d is not equal!", mipLevel); diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp index fa1b092e6b..0656fb4e46 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp @@ -830,7 +830,7 @@ namespace UnitTest continue; } - auto formatInfo = CPixelFormats::GetInstance().GetPixelFormatInfo(pixelFormat); + [[maybe_unused]] auto formatInfo = CPixelFormats::GetInstance().GetPixelFormatInfo(pixelFormat); imageToProcess.Set(srcImage); imageToProcess.ConvertFormat(pixelFormat); diff --git a/Gems/Atom/Asset/Shader/Code/Source/Editor/AzslCompiler.cpp b/Gems/Atom/Asset/Shader/Code/Source/Editor/AzslCompiler.cpp index 4a56c198d7..154bfdd607 100644 --- a/Gems/Atom/Asset/Shader/Code/Source/Editor/AzslCompiler.cpp +++ b/Gems/Atom/Asset/Shader/Code/Source/Editor/AzslCompiler.cpp @@ -908,9 +908,9 @@ namespace AZ AZ_Assert(optionEntry.IsObject(), "Expected option entry to be an object!"); Name defaultValueId = optionEntry.HasMember("defaultValue") ? Name(optionEntry["defaultValue"].GetString()) : Name(); - const AZStd::string optionName = optionEntry.HasMember("name") ? optionEntry["name"].GetString() : ""; - const bool valuesAreRange = optionEntry.HasMember("range") ? optionEntry["range"].GetBool() : false; - const bool isPredefinedType = optionEntry.HasMember("kind") ? AzFramework::StringFunc::Equal(optionEntry["kind"].GetString(), "predefined") : false; + const AZStd::string optionName = optionEntry.HasMember("name") ? optionEntry["name"].GetString() : ""; + [[maybe_unused]] const bool valuesAreRange = optionEntry.HasMember("range") ? optionEntry["range"].GetBool() : false; + const bool isPredefinedType = optionEntry.HasMember("kind") ? AzFramework::StringFunc::Equal(optionEntry["kind"].GetString(), "predefined") : false; auto optionType = RPI::ShaderOptionType::Unknown; if (isPredefinedType && optionEntry.HasMember("type")) diff --git a/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderAssetBuilder.cpp b/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderAssetBuilder.cpp index 8ec7733d07..9ee4ff2161 100644 --- a/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderAssetBuilder.cpp +++ b/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderAssetBuilder.cpp @@ -462,7 +462,7 @@ namespace AZ { finalShaderOptionGroupLayout = shaderOptionGroupLayout; shaderAssetCreator.SetShaderOptionGroupLayout(finalShaderOptionGroupLayout); - const uint32_t usedShaderOptionBits = shaderOptionGroupLayout->GetBitSize(); + [[maybe_unused]] const uint32_t usedShaderOptionBits = shaderOptionGroupLayout->GetBitSize(); AZ_TracePrintf( ShaderAssetBuilderName, "Note: This shader uses %u of %u available shader variant key bits. \n", usedShaderOptionBits, RPI::ShaderVariantKeyBitCount); diff --git a/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderVariantAssetBuilder.cpp b/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderVariantAssetBuilder.cpp index 5dc1267dbb..12e5382b63 100644 --- a/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderVariantAssetBuilder.cpp +++ b/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderVariantAssetBuilder.cpp @@ -388,7 +388,7 @@ namespace AZ for (const AZ::RPI::ShaderVariantListSourceData::VariantInfo& variantInfo : shaderVariantList.m_shaderVariants) { AZStd::string variantInfoAsJsonString; - const bool convertSuccess = AZ::RPI::JsonUtils::SaveObjectToJsonString(variantInfo, variantInfoAsJsonString); + [[maybe_unused]] const bool convertSuccess = AZ::RPI::JsonUtils::SaveObjectToJsonString(variantInfo, variantInfoAsJsonString); AZ_Assert(convertSuccess, "Failed to convert VariantInfo to json string"); AssetBuilderSDK::JobDescriptor jobDescriptor; @@ -755,7 +755,7 @@ namespace AZ const AZStd::string& variantJsonString = jobParameters.at(ShaderVariantJobVariantParam); RPI::ShaderVariantListSourceData::VariantInfo variantInfo; - const bool fromJsonStringSuccess = AZ::RPI::JsonUtils::LoadObjectFromJsonString(variantJsonString, variantInfo); + [[maybe_unused]] const bool fromJsonStringSuccess = AZ::RPI::JsonUtils::LoadObjectFromJsonString(variantJsonString, variantInfo); AZ_Assert(fromJsonStringSuccess, "Failed to convert json string to VariantInfo"); RPI::ShaderSourceData shaderSourceDescriptor; diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp index 0d089a26bf..e0812f633a 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp @@ -325,11 +325,11 @@ namespace AZ DirectionalLightFeatureProcessorInterface::LightHandle DirectionalLightFeatureProcessor::AcquireLight() { const uint16_t index = m_lightData.GetFreeSlotIndex(); - const uint16_t shadowPropIndex = m_shadowProperties.GetFreeSlotIndex(); + [[maybe_unused]] const uint16_t shadowPropIndex = m_shadowProperties.GetFreeSlotIndex(); AZ_Assert(index == shadowPropIndex, "light index is illegal."); for (const auto& viewIt : m_cameraViewNames) { - const uint16_t shadowIndex = m_shadowData.at(viewIt.first).GetFreeSlotIndex(); + [[maybe_unused]] const uint16_t shadowIndex = m_shadowData.at(viewIt.first).GetFreeSlotIndex(); AZ_Assert(index == shadowIndex, "light index is illegal."); } diff --git a/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp b/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp index a885708a47..b6ca1191dd 100644 --- a/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp @@ -38,7 +38,7 @@ namespace AZ { namespace { - static const char* PassName = "ImGuiPass"; + [[maybe_unused]] static const char* PassName = "ImGuiPass"; static const char* ImguiShaderFilePath = "Shaders/imgui/imgui.azshader"; } diff --git a/Gems/Atom/Feature/Common/Code/Source/Utils/GpuBufferHandler.cpp b/Gems/Atom/Feature/Common/Code/Source/Utils/GpuBufferHandler.cpp index 3115c5410b..7a2827bebe 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Utils/GpuBufferHandler.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/Utils/GpuBufferHandler.cpp @@ -17,7 +17,7 @@ namespace AZ { namespace Render { - static const char* ClassName = "GpuBufferHandler"; + [[maybe_unused]] static const char* ClassName = "GpuBufferHandler"; static const uint32_t BufferMinSize = 1 << 16; // Min 64Kb. GpuBufferHandler::GpuBufferHandler(const Descriptor& descriptor) diff --git a/Gems/Atom/RHI/Code/Source/RHI/FrameGraphExecuteGroup.cpp b/Gems/Atom/RHI/Code/Source/RHI/FrameGraphExecuteGroup.cpp index a493fbd143..d00991421f 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/FrameGraphExecuteGroup.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/FrameGraphExecuteGroup.cpp @@ -71,7 +71,7 @@ namespace AZ { EndContextInternal(m_contexts[contextIndex], contextIndex); - const int32_t activeCount = --m_contextCountActive; + [[maybe_unused]] const int32_t activeCount = --m_contextCountActive; AZ_Assert(activeCount >= 0, "Asymmetric calls to FrameSchedulerExecuteContext:: Begin / End."); ++m_contextCountCompleted; } diff --git a/Gems/Atom/RHI/Code/Source/RHI/Resource.cpp b/Gems/Atom/RHI/Code/Source/RHI/Resource.cpp index b7ae469f16..f27ea22d8a 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/Resource.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/Resource.cpp @@ -98,8 +98,8 @@ namespace AZ if (Validation::IsEnabled()) { // The frame attachment has tight control over lifecycle here. - const bool isAttach = (!m_frameAttachment && frameAttachment); - const bool isDetach = (m_frameAttachment && !frameAttachment); + [[maybe_unused]] const bool isAttach = (!m_frameAttachment && frameAttachment); + [[maybe_unused]] const bool isDetach = (m_frameAttachment && !frameAttachment); AZ_Assert(isAttach || isDetach, "The frame attachment for resource '%s' was not assigned properly."); } diff --git a/Gems/Atom/RHI/Code/Tests/BufferTests.cpp b/Gems/Atom/RHI/Code/Tests/BufferTests.cpp index 0ce4626b92..acf680a6d8 100644 --- a/Gems/Atom/RHI/Code/Tests/BufferTests.cpp +++ b/Gems/Atom/RHI/Code/Tests/BufferTests.cpp @@ -121,6 +121,7 @@ namespace UnitTest bufferPool->ForEach([&bufferIndex, &buffers]([[maybe_unused]] RHI::Buffer& buffer) { + AZ_UNUSED(buffers); // Prevent unused warning in release builds AZ_Assert(buffers[bufferIndex] == &buffer, "buffers don't match"); bufferIndex++; }); diff --git a/Gems/Atom/RHI/Code/Tests/FrameGraph.cpp b/Gems/Atom/RHI/Code/Tests/FrameGraph.cpp index e03c9d13b4..bc2dce056c 100644 --- a/Gems/Atom/RHI/Code/Tests/FrameGraph.cpp +++ b/Gems/Atom/RHI/Code/Tests/FrameGraph.cpp @@ -58,7 +58,7 @@ namespace UnitTest FrameGraphExecuteGroup* group = AddGroup(); group->Init(scope->GetId()); - const bool wasInserted = m_scopeIds.emplace(scope->GetId()).second; + [[maybe_unused]] const bool wasInserted = m_scopeIds.emplace(scope->GetId()).second; AZ_Assert(wasInserted, "scope was inserted already"); } } diff --git a/Gems/Atom/RHI/Code/Tests/ImageTests.cpp b/Gems/Atom/RHI/Code/Tests/ImageTests.cpp index d3f528c9cd..ebcc05abe1 100644 --- a/Gems/Atom/RHI/Code/Tests/ImageTests.cpp +++ b/Gems/Atom/RHI/Code/Tests/ImageTests.cpp @@ -108,6 +108,7 @@ namespace UnitTest imagePool->ForEach([&imageIndex, &images]([[maybe_unused]] const RHI::Image& image) { + AZ_UNUSED(images); // Prevent unused warning in release builds AZ_Assert(images[imageIndex] == &image, "images don't match"); imageIndex++; }); diff --git a/Gems/Atom/RHI/Code/Tests/QueryTests.cpp b/Gems/Atom/RHI/Code/Tests/QueryTests.cpp index f883f6a8bd..9eb45cbd96 100644 --- a/Gems/Atom/RHI/Code/Tests/QueryTests.cpp +++ b/Gems/Atom/RHI/Code/Tests/QueryTests.cpp @@ -112,6 +112,7 @@ namespace UnitTest queryPool->ForEach([&queryIndex, &queries]([[maybe_unused]] RHI::Query& query) { + AZ_UNUSED(queries); // Prevent unused warning in release builds AZ_Assert(queries[queryIndex] == &query, "Queries don't match"); queryIndex++; }); diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI.Builders/ShaderPlatformInterface.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI.Builders/ShaderPlatformInterface.cpp index 903b25e16f..7e41e50892 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI.Builders/ShaderPlatformInterface.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI.Builders/ShaderPlatformInterface.cpp @@ -191,7 +191,7 @@ namespace AZ StageDescriptor& outputDescriptor, const RHI::ShaderCompilerArguments& shaderCompilerArguments) const { - for (auto srgLayout : m_srgLayouts) + for ([[maybe_unused]] auto srgLayout : m_srgLayouts) { AZ_Assert(srgLayout != nullptr, "Most likely BuildPipelineLayoutDescriptor() was not called!"); } @@ -280,7 +280,7 @@ namespace AZ // Enable half precision types when shader model >= 6.2 int shaderModelMajor = 0; int shaderModelMinor = 0; - int numValuesRead = azsscanf(shaderModelVersion.c_str(), "%d_%d", &shaderModelMajor, &shaderModelMinor); + [[maybe_unused]] int numValuesRead = azsscanf(shaderModelVersion.c_str(), "%d_%d", &shaderModelMajor, &shaderModelMinor); AZ_Assert(numValuesRead == 2, "Unknown shader model version format"); if (shaderModelMajor >= 6 && shaderModelMinor >= 2) { diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/ArgumentBuffer.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/ArgumentBuffer.cpp index 05107128ad..b820a6bf76 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/ArgumentBuffer.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/ArgumentBuffer.cpp @@ -431,7 +431,7 @@ namespace AZ } else { - bool isBoundToGraphics = RHI::CheckBitsAny(visMaskIt->second, RHI::ShaderStageMask::Vertex) || RHI::CheckBitsAny(visMaskIt->second, RHI::ShaderStageMask::Fragment); + [[maybe_unused]] bool isBoundToGraphics = RHI::CheckBitsAny(visMaskIt->second, RHI::ShaderStageMask::Vertex) || RHI::CheckBitsAny(visMaskIt->second, RHI::ShaderStageMask::Fragment); AZ_Assert(isBoundToGraphics, "The visibility mask %i is not set for Vertex or fragment stage", visMaskIt->second); CollectResourcesForGraphics(commandEncoder, visMaskIt->second, it.second, resourcesToMakeResidentGraphics); } diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/BufferView.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/BufferView.cpp index 9b67f5c6e2..5508086fe5 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/BufferView.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/BufferView.cpp @@ -54,7 +54,7 @@ namespace AZ usage : textureUsage]; mtlTextureDesc.textureType = MTLTextureTypeTextureBuffer; - uint32_t bytesPerRow = viewDescriptor.m_elementCount * bytesPerPixel; + [[maybe_unused]] uint32_t bytesPerRow = viewDescriptor.m_elementCount * bytesPerPixel; AZ_Assert(bytesPerRow == (viewDescriptor.m_elementCount * viewDescriptor.m_elementSize), "Mismatch for bytesPerRow"); id mtlTexture = [mtlBuffer newTextureWithDescriptor : mtlTextureDesc offset : m_memoryView.GetOffset() diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/PipelineState.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/PipelineState.cpp index f1d9fdc3a6..8d6ab8fee3 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/PipelineState.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/PipelineState.cpp @@ -188,7 +188,7 @@ namespace AZ } else { - const char * errorStr = [ error.localizedDescription UTF8String ]; + [[maybe_unused]] const char * errorStr = [ error.localizedDescription UTF8String ]; AZ_Error("PipelineState", false, "Failed to compile compute pipeline state with error: %s.", errorStr); return RHI::ResultCode::Fail; } @@ -221,7 +221,7 @@ namespace AZ } else { - const char * errorStr = [ error.localizedDescription UTF8String ]; + [[maybe_unused]] const char * errorStr = [ error.localizedDescription UTF8String ]; AZ_Error("PipelineState", false, "Failed to compile compute pipeline state with error: %s.", errorStr); return RHI::ResultCode::Fail; } diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/BufferView.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/BufferView.cpp index d07ee5dde3..3cd016ba39 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/BufferView.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/BufferView.cpp @@ -108,7 +108,7 @@ namespace AZ VkAccelerationStructureKHR BufferView::GetNativeAccelerationStructure() const { bool hasOverrideFlags = GetDescriptor().m_overrideBindFlags != RHI::BufferBindFlags::None; - const RHI::BufferBindFlags bindFlags = hasOverrideFlags ? GetDescriptor().m_overrideBindFlags : GetBuffer().GetDescriptor().m_bindFlags; + [[maybe_unused]] const RHI::BufferBindFlags bindFlags = hasOverrideFlags ? GetDescriptor().m_overrideBindFlags : GetBuffer().GetDescriptor().m_bindFlags; AZ_Assert(RHI::CheckBitsAll(bindFlags, RHI::BufferBindFlags::RayTracingAccelerationStructure), "GetNativeAccelerationStructure() is only valid for buffers with the RayTracingAccelerationStructure bind flag"); diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImageView.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImageView.cpp index 44c36f5c70..9a92028b86 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImageView.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImageView.cpp @@ -117,10 +117,10 @@ namespace AZ const auto& device = static_cast(GetDevice()); const auto& physicalDevice = static_cast(GetDevice().GetPhysicalDevice()); - const uint16_t width = static_cast(imgDesc.m_size.m_width); - const uint16_t height = static_cast(imgDesc.m_size.m_height); + [[maybe_unused]] const uint16_t width = static_cast(imgDesc.m_size.m_width); + [[maybe_unused]] const uint16_t height = static_cast(imgDesc.m_size.m_height); const uint16_t depth = AZStd::min(static_cast(imgViewDesc.m_depthSliceMax - imgViewDesc.m_depthSliceMin), static_cast(imgDesc.m_size.m_depth - 1)) + 1; - const uint16_t samples = imgDesc.m_multisampleState.m_samples; + [[maybe_unused]] const uint16_t samples = imgDesc.m_multisampleState.m_samples; const uint16_t arrayLayers = AZStd::min(static_cast(imgViewDesc.m_arraySliceMax - imgViewDesc.m_arraySliceMin), static_cast(imgDesc.m_arraySize - 1)) + 1; // We cannot only use the number of layers of the ImageView to determinate if is a texture array. You can have a texture array with only 1 layer and the shader expects // an array type instead of a normal image type. diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Image/ImageSystem.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Image/ImageSystem.cpp index cb838eb2ba..d4a55d1c29 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Image/ImageSystem.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Image/ImageSystem.cpp @@ -254,7 +254,7 @@ namespace AZ poolAssetCreator.SetPoolDescriptor(AZStd::move(imagePoolDescriptor)); poolAssetCreator.SetControllerAsset(m_defaultStreamingImageControllerAsset); poolAssetCreator.SetPoolName(systemStreamingPoolDescriptor.m_name); - const bool created = poolAssetCreator.End(poolAsset); + [[maybe_unused]] const bool created = poolAssetCreator.End(poolAsset); AZ_Assert(created, "Failed to build streaming image pool"); m_systemStreamingPool = StreamingImagePool::FindOrCreate(poolAsset); @@ -272,7 +272,7 @@ namespace AZ poolAssetCreator.SetPoolDescriptor(AZStd::move(imagePoolDescriptor)); poolAssetCreator.SetControllerAsset(m_defaultStreamingImageControllerAsset); poolAssetCreator.SetPoolName(assetStreamingPoolDescriptor.m_name); - const bool created = poolAssetCreator.End(poolAsset); + [[maybe_unused]] const bool created = poolAssetCreator.End(poolAsset); AZ_Assert(created, "Failed to build streaming image pool for assets"); m_assetStreamingPool = StreamingImagePool::FindOrCreate(poolAsset); @@ -292,7 +292,7 @@ namespace AZ poolAssetCreator.Begin(systemAttachmentPoolDescriptor.m_assetId); poolAssetCreator.SetPoolDescriptor(AZStd::move(imagePoolDescriptor)); poolAssetCreator.SetPoolName(systemAttachmentPoolDescriptor.m_name); - const bool created = poolAssetCreator.End(poolAsset); + [[maybe_unused]] const bool created = poolAssetCreator.End(poolAsset); AZ_Assert(created, "Failed to build attachment image pool"); m_systemAttachmentPool = AttachmentImagePool::FindOrCreate(poolAsset); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Image/StreamingImageController.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Image/StreamingImageController.cpp index 97a3eb324b..a84d8ca9b7 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Image/StreamingImageController.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Image/StreamingImageController.cpp @@ -88,7 +88,7 @@ namespace AZ { if (StreamingImage* image = context->TryGetImage()) { - const RHI::ResultCode resultCode = image->ExpandMipChain(); + [[maybe_unused]] const RHI::ResultCode resultCode = image->ExpandMipChain(); AZ_Warning("StreamingImageController", resultCode == RHI::ResultCode::Success, "Failed to expand mip chain for streaming image."); } context->m_queuedForMipExpand = false; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/RenderPass.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/RenderPass.cpp index 9b182a3c4b..318ea7d11f 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/RenderPass.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/RenderPass.cpp @@ -494,6 +494,7 @@ namespace AZ { if (query->BeginQuery(context) == QueryResultCode::Fail) { + AZ_UNUSED(this); // Prevent unused warning in release builds AZ_WarningOnce("RenderPass", false, "BeginScopeQuery failed. Make sure AddScopeQueryToFrameGraph was called in SetupFrameGraphDependencies" " for this pass: %s", this->RTTI_GetTypeName()); } diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp index bd49a72f40..616aa44299 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp @@ -28,7 +28,7 @@ namespace AZ static constexpr uint32_t SubProductTypeBitPosition = 0; static constexpr uint32_t SubProductTypeNumBits = SupervariantIndexBitPosition - SubProductTypeBitPosition; - static constexpr uint32_t SubProductTypeMaxValue = (1 << SubProductTypeNumBits) - 1; + [[maybe_unused]] static constexpr uint32_t SubProductTypeMaxValue = (1 << SubProductTypeNumBits) - 1; static_assert(RhiIndexMaxValue == RHI::Limits::APIType::PerPlatformApiUniqueIndexMax); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderVariantAsset.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderVariantAsset.cpp index 5d31feb411..442fc6a79f 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderVariantAsset.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderVariantAsset.cpp @@ -25,11 +25,11 @@ namespace AZ { static constexpr uint32_t SubProductTypeBitPosition = 17; static constexpr uint32_t SubProductTypeNumBits = SupervariantIndexBitPosition - SubProductTypeBitPosition; - static constexpr uint32_t SubProductTypeMaxValue = (1 << SubProductTypeNumBits) - 1; + [[maybe_unused]] static constexpr uint32_t SubProductTypeMaxValue = (1 << SubProductTypeNumBits) - 1; static constexpr uint32_t StableIdBitPosition = 0; static constexpr uint32_t StableIdNumBits = SubProductTypeBitPosition - StableIdBitPosition; - static constexpr uint32_t StableIdMaxValue = (1 << StableIdNumBits) - 1; + [[maybe_unused]] static constexpr uint32_t StableIdMaxValue = (1 << StableIdNumBits) - 1; static_assert(RhiIndexMaxValue == RHI::Limits::APIType::PerPlatformApiUniqueIndexMax); diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Application/AtomToolsApplication.cpp b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Application/AtomToolsApplication.cpp index b8426f7528..36e45bb7ca 100644 --- a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Application/AtomToolsApplication.cpp +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Application/AtomToolsApplication.cpp @@ -238,6 +238,7 @@ namespace AtomToolsFramework connectionSettings.m_connectionIdentifier = GetBuildTargetName(); connectionSettings.m_loggingCallback = [targetName]([[maybe_unused]] AZStd::string_view logData) { + AZ_UNUSED(targetName); // Prevent unused warning in release builds AZ_TracePrintf(targetName.c_str(), "%.*s", aznumeric_cast(logData.size()), logData.data()); }; AzFramework::AssetSystemRequestBus::BroadcastResult( diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp index 0be6925701..0388af0134 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp +++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp @@ -112,7 +112,7 @@ namespace MaterialEditor requestedViewportSize.width(), requestedViewportSize.height(), m_materialViewport->size().width(), m_materialViewport->size().height()); - QSize newDeviceSize = m_materialViewport->size(); + [[maybe_unused]] QSize newDeviceSize = m_materialViewport->size(); AZ_Warning( "Material Editor", static_cast(newDeviceSize.width()) == width && static_cast(newDeviceSize.height()) == height, "Resizing the window did not give the expected frame size. Requested %d x %d but got %d x %d.", width, height, diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl index 49b6430221..9b2f2b0dd9 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl @@ -390,7 +390,7 @@ namespace AZ inline void ImGuiPipelineStatisticsView::CreateAttributeRow(const PassEntry* passEntry, const PassEntry* rootEntry) { - const uint32_t columnCount = static_cast(ImGui::GetColumnsCount()); + [[maybe_unused]] const uint32_t columnCount = static_cast(ImGui::GetColumnsCount()); AZ_Assert(columnCount == ImGuiPipelineStatisticsView::HeaderAttributeCount, "The column count needs to match HeaderAttributeCount."); ImGui::Separator(); @@ -1348,7 +1348,7 @@ namespace AZ PassEntry entry(pass, parent); // Set the time stamp in the database. - const auto passEntry = passEntryDatabase.find(entry.m_path); + [[maybe_unused]] const auto passEntry = passEntryDatabase.find(entry.m_path); AZ_Assert(passEntry == passEntryDatabase.end(), "There already is an entry with the name \"%s\".", entry.m_path.GetCStr()); // Set the entry in the map. diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Source/FontRenderer.cpp b/Gems/AtomLyIntegration/AtomFont/Code/Source/FontRenderer.cpp index 053a2eb419..f1fc8be965 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Source/FontRenderer.cpp +++ b/Gems/AtomLyIntegration/AtomFont/Code/Source/FontRenderer.cpp @@ -256,7 +256,7 @@ int AZ::FontRenderer::GetGlyph(GlyphBitmap* glyphBitmap, int* horizontalAdvance, // might happen if font characters are too big or cache dimenstions in font.xml is too small "" const bool charWidthFits = static_cast(iX + m_glyph->bitmap.width) <= textureSlotBufferWidth; const bool charHeightFits = static_cast(iY + m_glyph->bitmap.rows) <= textureSlotBufferHeight; - const bool charFitsInSlot = charWidthFits && charHeightFits; + [[maybe_unused]] const bool charFitsInSlot = charWidthFits && charHeightFits; AZ_Error("Font", charFitsInSlot, "Character code %d doesn't fit in font texture; check 'sizeRatio' attribute in font XML or adjust this character's sizing in the font.", characterCode); // Since we might be re-rendering/overwriting a glyph that already exists diff --git a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp index 16243235a2..a3161002a0 100644 --- a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp +++ b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp @@ -811,7 +811,7 @@ namespace AZ const uint64_t inputByteOffset = aznumeric_cast(inputBufferViewDescriptor.m_elementOffset) * aznumeric_cast(inputBufferViewDescriptor.m_elementSize); const uint32_t outputElementSize = SkinnedMeshVertexStreamPropertyInterface::Get()->GetOutputStreamInfo(outputStream).m_elementSize; - const uint64_t outputByteCount = aznumeric_cast(lodVertexCount) * aznumeric_cast(outputElementSize); + [[maybe_unused]] const uint64_t outputByteCount = aznumeric_cast(lodVertexCount) * aznumeric_cast(outputElementSize); const uint64_t outputByteOffset = aznumeric_cast(outputBufferOffsetsInBytes[static_cast(outputStream)]); // The byte count from input and output buffers doesn't have to match necessarily. diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionSetCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionSetCommands.cpp index c3d9a88471..34fee273c2 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionSetCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionSetCommands.cpp @@ -997,7 +997,7 @@ namespace CommandSystem else { AZStd::string result; - const bool success = GetCommandManager()->ExecuteCommand(AZStd::string::format("Unselect -motionName %s", selectedMotion->GetName()), result); + [[maybe_unused]] const bool success = GetCommandManager()->ExecuteCommand(AZStd::string::format("Unselect -motionName %s", selectedMotion->GetName()), result); AZ_Error("EMotionFX", success, result.c_str()); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Pipeline/RCExt/Motion/MotionDataBuilder.cpp b/Gems/EMotionFX/Code/EMotionFX/Pipeline/RCExt/Motion/MotionDataBuilder.cpp index 130aa41931..422baa5125 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Pipeline/RCExt/Motion/MotionDataBuilder.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Pipeline/RCExt/Motion/MotionDataBuilder.cpp @@ -406,7 +406,7 @@ namespace EMotionFX for (; iterator != sceneGraphDownardsIteratorView.end(); ++iterator) { SceneContainers::SceneGraph::HierarchyStorageConstIterator hierarchy = iterator.GetHierarchyIterator(); - SceneContainers::SceneGraph::NodeIndex currentIndex = graph.ConvertToNodeIndex(hierarchy); + [[maybe_unused]] SceneContainers::SceneGraph::NodeIndex currentIndex = graph.ConvertToNodeIndex(hierarchy); AZ_Assert(currentIndex.IsValid(), "While iterating through the Scene Graph an unexpected invalid entry was found."); AZStd::shared_ptr currentItem = iterator->second; if (hierarchy->IsEndPoint()) diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Pose.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/Pose.cpp index 99f1474c89..e2bff677ad 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Pose.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Pose.cpp @@ -728,7 +728,7 @@ namespace EMotionFX m_localSpaceTransforms[nodeNr].Zero(); } - const size_t numMorphs = m_morphWeights.size(); + [[maybe_unused]] const size_t numMorphs = m_morphWeights.size(); MCORE_ASSERT(m_actorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs); for (float& morphWeight : m_morphWeights) { @@ -743,7 +743,7 @@ namespace EMotionFX m_localSpaceTransforms[i].Zero(); } - const size_t numMorphs = m_morphWeights.size(); + [[maybe_unused]] const size_t numMorphs = m_morphWeights.size(); MCORE_ASSERT(m_actor->GetMorphSetup(0)->GetNumMorphTargets() == numMorphs); for (float& morphWeight : m_morphWeights) { diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeHierarchyWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeHierarchyWidget.cpp index 63934a380c..89e5363bbb 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeHierarchyWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeHierarchyWidget.cpp @@ -454,7 +454,7 @@ namespace EMStudio // get the actor instance id to which this item belongs to m_actorInstanceIdString = FromQtString(item->whatsThis(0)); int actorInstanceID; - const bool validConversion = AzFramework::StringFunc::LooksLikeInt(m_actorInstanceIdString.c_str(), &actorInstanceID); + [[maybe_unused]] const bool validConversion = AzFramework::StringFunc::LooksLikeInt(m_actorInstanceIdString.c_str(), &actorInstanceID); MCORE_ASSERT(validConversion); // remove the node from the selected nodes @@ -497,7 +497,7 @@ namespace EMStudio FromQtString(item->whatsThis(0), &m_actorInstanceIdString); int actorInstanceID; - const bool validConversion = AzFramework::StringFunc::LooksLikeInt(m_actorInstanceIdString.c_str(), &actorInstanceID); + [[maybe_unused]] const bool validConversion = AzFramework::StringFunc::LooksLikeInt(m_actorInstanceIdString.c_str(), &actorInstanceID); MCORE_ASSERT(validConversion); EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().FindActorInstanceByID(actorInstanceID); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGraph.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGraph.cpp index 596f3d7e30..759adbcb1c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGraph.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGraph.cpp @@ -2077,7 +2077,7 @@ namespace EMStudio if (visualStateConnection->GetModelIndex() == modelIndex) { // Transfer ownership from the previous visual node to where we relinked the transition to. - const bool connectionRemoveResult = visualNode->RemoveConnection(transition, false); + [[maybe_unused]] const bool connectionRemoveResult = visualNode->RemoveConnection(transition, false); AZ_Error("EMotionFX", connectionRemoveResult, "Removing connection failed."); targetGraphNode->AddConnection(visualStateConnection); diff --git a/Gems/GraphModel/Code/Source/Integration/GraphController.cpp b/Gems/GraphModel/Code/Source/Integration/GraphController.cpp index 3551e5ba41..86cfb42990 100644 --- a/Gems/GraphModel/Code/Source/Integration/GraphController.cpp +++ b/Gems/GraphModel/Code/Source/Integration/GraphController.cpp @@ -280,6 +280,7 @@ namespace GraphModelIntegration } else { + AZ_UNUSED(this); // Prevent unused warning in release builds AZ_Error(m_graph->GetSystemName(), false, "Failed to load position information for node [%d]", nodeId); } diff --git a/Gems/ImGui/Code/Include/ImGuiContextScope.h b/Gems/ImGui/Code/Include/ImGuiContextScope.h index 553430862e..f9b2df1834 100644 --- a/Gems/ImGui/Code/Include/ImGuiContextScope.h +++ b/Gems/ImGui/Code/Include/ImGuiContextScope.h @@ -39,6 +39,6 @@ namespace ImGui private: //////////////////////////////////////////////////////////////////////////////////////////// - ImGuiContext* m_previousContext = nullptr; + [[maybe_unused]] ImGuiContext* m_previousContext = nullptr; }; } diff --git a/Gems/InAppPurchases/Code/Source/Platform/Common/Apple/InAppPurchasesDelegate.mm b/Gems/InAppPurchases/Code/Source/Platform/Common/Apple/InAppPurchasesDelegate.mm index 09d087e97a..d1ec128236 100644 --- a/Gems/InAppPurchases/Code/Source/Platform/Common/Apple/InAppPurchasesDelegate.mm +++ b/Gems/InAppPurchases/Code/Source/Platform/Common/Apple/InAppPurchasesDelegate.mm @@ -131,7 +131,7 @@ -(void) productsRequest:(SKProductsRequest*) request didReceiveResponse:(SKProductsResponse*) response { - for (NSString* invalidId in response.invalidProductIdentifiers) + for ([[maybe_unused]] NSString* invalidId in response.invalidProductIdentifiers) { AZ_TracePrintf("O3DEInAppPurchases:", "Invalid product ID:", [invalidId cStringUsingEncoding:NSASCIIStringEncoding]); } diff --git a/Gems/LmbrCentral/Code/Source/Builders/SliceBuilder/SliceBuilderWorker.cpp b/Gems/LmbrCentral/Code/Source/Builders/SliceBuilder/SliceBuilderWorker.cpp index 88284ede1d..4fc350067d 100644 --- a/Gems/LmbrCentral/Code/Source/Builders/SliceBuilder/SliceBuilderWorker.cpp +++ b/Gems/LmbrCentral/Code/Source/Builders/SliceBuilder/SliceBuilderWorker.cpp @@ -388,11 +388,11 @@ namespace SliceBuilder bool sliceWritable = AZ::IO::SystemFile::IsWritable(fullPath.c_str()); if (!m_settings.m_enableSliceConversion || !sliceWritable) { - static const char* const s_OutOfDate = "This slice file is out of date: "; - static const char* const s_ToEnable = "To enable automatic upgrades:"; - static const char* const s_FixSettings1 = "In the settings file "; - static const char* const s_FixSettings2 = ", Set 'EnableSliceConversion' to true and restart the Asset Processor"; - static const char* const s_FixReadOnly = "Make sure the slice file isn't marked read-only. If using perforce, check out the slice file."; + [[maybe_unused]] static const char* const s_OutOfDate = "This slice file is out of date: "; + [[maybe_unused]] static const char* const s_ToEnable = "To enable automatic upgrades:"; + [[maybe_unused]] static const char* const s_FixSettings1 = "In the settings file "; + [[maybe_unused]] static const char* const s_FixSettings2 = ", Set 'EnableSliceConversion' to true and restart the Asset Processor"; + [[maybe_unused]] static const char* const s_FixReadOnly = "Make sure the slice file isn't marked read-only. If using perforce, check out the slice file."; // The Slice isn't marked as read only but Slice Upgrades aren't Enabled in the builder settings file if(!m_settings.m_enableSliceConversion && sliceWritable) @@ -512,10 +512,10 @@ namespace SliceBuilder // To avoid potential data loss, only delete the old file if there is a data patching error detected if (m_sliceDataPatchError) { - static const char* const s_overrideWarning = "At least one Data Patch Upgrade wasn't completed:"; - static const char* const s_checkLogs = "Please check the slice processing log for more information."; - static const char* const s_originalSliceAvailable = "The original slice file has been preserved at: "; - static const char* const s_recomendReload = "It's recomended that this slice be loaded into the editor and repaired before upgrading."; + [[maybe_unused]] static const char* const s_overrideWarning = "At least one Data Patch Upgrade wasn't completed:"; + [[maybe_unused]] static const char* const s_checkLogs = "Please check the slice processing log for more information."; + [[maybe_unused]] static const char* const s_originalSliceAvailable = "The original slice file has been preserved at: "; + [[maybe_unused]] static const char* const s_recomendReload = "It's recomended that this slice be loaded into the editor and repaired before upgrading."; AZ_Warning(s_sliceBuilder, false, "%s\n%s\n%s%s\n%s", s_overrideWarning, s_checkLogs, s_originalSliceAvailable, oldPath.c_str(), s_recomendReload); } diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp index 41397ce265..5d62f88310 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp @@ -178,8 +178,8 @@ void CUiAnimViewAnimNode::UiElementPropertyChanged() AZ::Component* oldComponent = oldComponents[componentIndex]; AZ::Component* newComponent = newComponents[componentIndex]; - AZ::Uuid oldComponentType = oldComponent->RTTI_GetType(); - AZ::Uuid newComponentType = newComponent->RTTI_GetType(); + [[maybe_unused]] AZ::Uuid oldComponentType = oldComponent->RTTI_GetType(); + [[maybe_unused]] AZ::Uuid newComponentType = newComponent->RTTI_GetType(); AZ_Assert(oldComponentType == newComponentType, "Components have different types"); diff --git a/Gems/LyShine/Code/Source/LyShineDebug.cpp b/Gems/LyShine/Code/Source/LyShineDebug.cpp index a30f816c73..160df96ac9 100644 --- a/Gems/LyShine/Code/Source/LyShineDebug.cpp +++ b/Gems/LyShine/Code/Source/LyShineDebug.cpp @@ -39,7 +39,7 @@ AllocateConstIntCVar(LyShineDebug, CV_r_DebugUIDraw2dLine); AllocateConstIntCVar(LyShineDebug, CV_r_DebugUIDraw2dDefer); static const int g_numColors = 8; -static const char* g_colorNames[g_numColors] = +[[maybe_unused]] static const char* g_colorNames[g_numColors] = { "white", "red", @@ -64,7 +64,7 @@ static AZ::Vector3 g_colorVec3[g_numColors] = }; static const int g_numSrcBlendModes = 11; -static int g_srcBlendModes[g_numSrcBlendModes] = +[[maybe_unused]] static int g_srcBlendModes[g_numSrcBlendModes] = { GS_BLSRC_ZERO, GS_BLSRC_ONE, @@ -80,7 +80,7 @@ static int g_srcBlendModes[g_numSrcBlendModes] = }; static const int g_numDstBlendModes = 10; -static int g_dstBlendModes[g_numDstBlendModes] = +[[maybe_unused]] static int g_dstBlendModes[g_numDstBlendModes] = { GS_BLDST_ZERO, GS_BLDST_ONE, @@ -94,7 +94,7 @@ static int g_dstBlendModes[g_numDstBlendModes] = GS_BLDST_ONEMINUSSRC1ALPHA, // dual source blending }; -static bool g_deferDrawsToEndOfFrame = false; +[[maybe_unused]] static bool g_deferDrawsToEndOfFrame = false; //////////////////////////////////////////////////////////////////////////////////////////////////// // LOCAL STATIC FUNCTIONS diff --git a/Gems/Maestro/Code/Source/Components/EditorSequenceAgentComponent.cpp b/Gems/Maestro/Code/Source/Components/EditorSequenceAgentComponent.cpp index 4264dd0ab3..acc9713291 100644 --- a/Gems/Maestro/Code/Source/Components/EditorSequenceAgentComponent.cpp +++ b/Gems/Maestro/Code/Source/Components/EditorSequenceAgentComponent.cpp @@ -146,7 +146,7 @@ namespace Maestro AZ::EntityId sequenceEntityId = busIdToDisconnect->first; // we only process DisconnectSequence events sent over an ID'ed bus - otherwise we don't know which SequenceComponent to disconnect - auto findIter = m_sequenceEntityIds.find(sequenceEntityId); + [[maybe_unused]] auto findIter = m_sequenceEntityIds.find(sequenceEntityId); AZ_Assert(findIter != m_sequenceEntityIds.end(), "A sequence not connected to SequenceAgentComponent on %s is requesting a disconnection", GetEntity()->GetName().c_str()); m_sequenceEntityIds.erase(sequenceEntityId); diff --git a/Gems/Maestro/Code/Source/Components/SequenceAgentComponent.cpp b/Gems/Maestro/Code/Source/Components/SequenceAgentComponent.cpp index 83599d7b40..5f38334c83 100644 --- a/Gems/Maestro/Code/Source/Components/SequenceAgentComponent.cpp +++ b/Gems/Maestro/Code/Source/Components/SequenceAgentComponent.cpp @@ -74,7 +74,7 @@ namespace Maestro AZ::EntityId sequenceEntityId = busIdToDisconnect->first; // we only process DisconnectSequence events sent over an ID'ed bus - otherwise we don't know which SequenceComponent to disconnect - auto findIter = m_sequenceEntityIds.find(sequenceEntityId); + [[maybe_unused]] auto findIter = m_sequenceEntityIds.find(sequenceEntityId); AZ_Assert(findIter != m_sequenceEntityIds.end(), "A sequence not connected to SequenceAgentComponent on %s is requesting a disconnection", GetEntity()->GetName().c_str()); m_sequenceEntityIds.erase(sequenceEntityId); diff --git a/Gems/Multiplayer/Code/Source/Debug/MultiplayerDebugPerEntityReporter.h b/Gems/Multiplayer/Code/Source/Debug/MultiplayerDebugPerEntityReporter.h index 8a68110b93..2d0fe4da39 100644 --- a/Gems/Multiplayer/Code/Source/Debug/MultiplayerDebugPerEntityReporter.h +++ b/Gems/Multiplayer/Code/Source/Debug/MultiplayerDebugPerEntityReporter.h @@ -53,8 +53,8 @@ namespace Multiplayer AZStd::map m_receivingEntityReports{}; MultiplayerDebugEntityReporter m_currentReceivingEntityReport; - float m_replicatedStateKbpsWarn = 10.f; - float m_replicatedStateMaxSizeWarn = 30.f; + [[maybe_unused]] float m_replicatedStateKbpsWarn = 10.f; + [[maybe_unused]] float m_replicatedStateMaxSizeWarn = 30.f; char m_statusBuffer[100] = {}; diff --git a/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp b/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp index 572dffbe60..4748d0f331 100644 --- a/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp +++ b/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp @@ -53,7 +53,7 @@ TEST_F(MultiplayerCompressionTest, MultiplayerCompression_CompressTest) MultiplayerCompression::LZ4Compressor lz4Compressor; startTime = AZStd::chrono::system_clock::now(); AzNetworking::CompressorError compressStatus = lz4Compressor.Compress(buffer.GetBuffer(), buffer.GetSize(), pCompressedBuffer, maxCompressedSize, compressedSize); - const AZ::u64 compressTime = (AZStd::chrono::system_clock::now() - startTime).count(); + [[maybe_unused]] const AZ::u64 compressTime = (AZStd::chrono::system_clock::now() - startTime).count(); ASSERT_TRUE(compressStatus == AzNetworking::CompressorError::Ok); EXPECT_TRUE(compressedSize < maxCompressedSize); @@ -61,7 +61,7 @@ TEST_F(MultiplayerCompressionTest, MultiplayerCompression_CompressTest) //Run and test decompress startTime = AZStd::chrono::system_clock::now(); AzNetworking::CompressorError decompressStatus = lz4Compressor.Decompress(pCompressedBuffer, compressedSize, pDecompressedBuffer, buffer.GetSize(), consumedSize, uncompressedSize); - const AZ::u64 decompressTime = (AZStd::chrono::system_clock::now() - startTime).count(); + [[maybe_unused]] const AZ::u64 decompressTime = (AZStd::chrono::system_clock::now() - startTime).count(); ASSERT_TRUE(decompressStatus == AzNetworking::CompressorError::Ok); EXPECT_TRUE(uncompressedSize = buffer.GetSize()); diff --git a/Gems/PhysX/Code/Source/Debug/PhysXDebug.h b/Gems/PhysX/Code/Source/Debug/PhysXDebug.h index 8286981032..58d6f7e03e 100644 --- a/Gems/PhysX/Code/Source/Debug/PhysXDebug.h +++ b/Gems/PhysX/Code/Source/Debug/PhysXDebug.h @@ -43,7 +43,7 @@ namespace PhysX void DisconnectFromPvd() override; private: - physx::PxPvdTransport* m_pvdTransport = nullptr; + [[maybe_unused]] physx::PxPvdTransport* m_pvdTransport = nullptr; physx::PxPvd* m_pvd = nullptr; DebugConfiguration m_config; diff --git a/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp b/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp index a2866b5a09..3b5c98ba2d 100644 --- a/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp +++ b/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp @@ -182,7 +182,7 @@ namespace PhysX SimulatedBodyType* newBody = aznew SimulatedBodyType(*configuration); if (!AZStd::holds_alternative(configuration->m_colliderAndShapeData)) { - const bool shapeAdded = AddShape(newBody, configuration->m_colliderAndShapeData); + [[maybe_unused]] const bool shapeAdded = AddShape(newBody, configuration->m_colliderAndShapeData); AZ_Warning("PhysXScene", shapeAdded, "No Collider or Shape information found when creating Rigid body [%s]", configuration->m_debugName.c_str()); } crc = AZ::Crc32(newBody, sizeof(*newBody)); @@ -194,7 +194,7 @@ namespace PhysX RigidBody* newBody = aznew RigidBody(*configuration); if (!AZStd::holds_alternative(configuration->m_colliderAndShapeData)) { - const bool shapeAdded = AddShape(newBody, configuration->m_colliderAndShapeData); + [[maybe_unused]] const bool shapeAdded = AddShape(newBody, configuration->m_colliderAndShapeData); AZ_Warning("PhysXScene", shapeAdded, "No Collider or Shape information found when creating Rigid body [%s]", configuration->m_debugName.c_str()); } const AzPhysics::MassComputeFlags& flags = configuration->GetMassComputeFlags(); diff --git a/Gems/SceneLoggingExample/Code/Processors/ExportTrackingProcessor.cpp b/Gems/SceneLoggingExample/Code/Processors/ExportTrackingProcessor.cpp index 7b3b99c641..0f169d1265 100644 --- a/Gems/SceneLoggingExample/Code/Processors/ExportTrackingProcessor.cpp +++ b/Gems/SceneLoggingExample/Code/Processors/ExportTrackingProcessor.cpp @@ -171,7 +171,7 @@ namespace SceneLoggingExample { // While it's generally preferable to stick with either index- or iterator-based traversal, there may be times where switching between one // or the other becomes necessary. The SceneGraph provides utility functions to convert between the two approaches. - AZ::SceneAPI::Containers::SceneGraph::NodeIndex itNodeIndex = graph.ConvertToNodeIndex(it.GetHierarchyIterator()); + [[maybe_unused]] AZ::SceneAPI::Containers::SceneGraph::NodeIndex itNodeIndex = graph.ConvertToNodeIndex(it.GetHierarchyIterator()); // Nodes in the SceneGraph can be marked as endpoints. To the graph, this means that these nodes are not allowed to have children. // While not a true one-to-one mapping, endpoints often act as attributes to a node. For example, a transform can be marked as an endpoint. diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp index 059b560cb0..2ae37b1253 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp @@ -2885,7 +2885,7 @@ namespace ScriptCanvas if (node == nullptr) { AZStd::string assetName = m_graphRequestBus->GetAssetName(); - AZ::EntityId assetNodeId = m_graphRequestBus->FindAssetNodeIdByRuntimeNodeId(endpoint.GetNodeId()); + [[maybe_unused]] AZ::EntityId assetNodeId = m_graphRequestBus->FindAssetNodeIdByRuntimeNodeId(endpoint.GetNodeId()); AZ_Warning("Script Canvas", false, "Unable to find node with id (id: %s) in the graph '%s'. Most likely the node was serialized with a type that is no longer reflected", assetNodeId.ToString().data(), assetName.data()); @@ -2900,7 +2900,7 @@ namespace ScriptCanvas if (!endpointSlot) { AZStd::string assetName = m_graphRequestBus->GetAssetName(); - AZ::EntityId assetNodeId = m_graphRequestBus->FindAssetNodeIdByRuntimeNodeId(endpoint.GetNodeId()); + [[maybe_unused]] AZ::EntityId assetNodeId = m_graphRequestBus->FindAssetNodeIdByRuntimeNodeId(endpoint.GetNodeId()); AZ_Warning("Script Canvas", false, "Endpoint was missing slot. id (id: %s) in the graph '%s'.", assetNodeId.ToString().data(), assetName.data()); @@ -2934,7 +2934,7 @@ namespace ScriptCanvas if (node == nullptr) { AZStd::string assetName = m_graphRequestBus->GetAssetName(); - AZ::EntityId assetNodeId = m_graphRequestBus->FindAssetNodeIdByRuntimeNodeId(endpoint.GetNodeId()); + [[maybe_unused]] AZ::EntityId assetNodeId = m_graphRequestBus->FindAssetNodeIdByRuntimeNodeId(endpoint.GetNodeId()); AZ_Error("Script Canvas", false, "Unable to find node with id (id: %s) in the graph '%s'. Most likely the node was serialized with a type that is no longer reflected", assetNodeId.ToString().data(), assetName.data()); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedAPI.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedAPI.cpp index cc2058f249..d7a4c360ac 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedAPI.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedAPI.cpp @@ -549,7 +549,7 @@ namespace ScriptCanvas { using namespace ExecutionInterpretedAPICpp; // Lua: usernodeable, keyCount - const int argsCount = lua_gettop(lua); + [[maybe_unused]] const int argsCount = lua_gettop(lua); AZ_Assert(argsCount == 2, "InitializeNodeableOutKeys: Error in compiled Lua file, not enough arguments"); AZ_Assert(lua_isuserdata(lua, 1), "InitializeNodeableOutKeys: Error in compiled lua file, 1st argument to SetExecutionOut is not userdata (Nodeable)"); Nodeable* nodeable = AZ::ScriptValue::StackRead(lua, 1); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/NodeableOut/NodeableOutNative.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/NodeableOut/NodeableOutNative.h index dc428cb480..ab6859db1e 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/NodeableOut/NodeableOutNative.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/NodeableOut/NodeableOutNative.h @@ -23,7 +23,7 @@ namespace ScriptCanvas { auto nodeCallWrapper = [callable = AZStd::forward(callable)](AZ::BehaviorValueParameter* result, AZ::BehaviorValueParameter* arguments, int numArguments) mutable { - constexpr size_t numFunctorArguments = sizeof...(Args); + [[maybe_unused]] constexpr size_t numFunctorArguments = sizeof...(Args); (void)numArguments; AZ_Assert(numArguments == numFunctorArguments, "number of arguments doesn't match number of parameters"); AZ_Assert(result, "no null result allowed"); @@ -39,7 +39,7 @@ namespace ScriptCanvas { auto nodeCallWrapper = [callable = AZStd::forward(callable)](AZ::BehaviorValueParameter*, AZ::BehaviorValueParameter* arguments, int numArguments) mutable { - constexpr size_t numFunctorArguments = sizeof...(Args); + [[maybe_unused]] constexpr size_t numFunctorArguments = sizeof...(Args); (void)numArguments; AZ_Assert(numArguments == numFunctorArguments, "number of arguments doesn't match number of parameters"); AZStd::invoke(callable, *arguments[IndexSequence].GetAsUnsafe()...); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Core/MethodUtility.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Core/MethodUtility.cpp index e2cfa8d9ad..0ddd161847 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Core/MethodUtility.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Core/MethodUtility.cpp @@ -45,7 +45,7 @@ namespace ScriptCanvas int tupleGetFuncIndex = -1; if (tupleGetFuncAttrReader.Read(tupleGetFuncIndex)) { - auto insertIter = tupleGetMethodMap.emplace(tupleGetFuncIndex, behaviorMethod); + [[maybe_unused]] auto insertIter = tupleGetMethodMap.emplace(tupleGetFuncIndex, behaviorMethod); AZ_Error("Script Canvas", insertIter.second, "Multiple methods with the same TupleGetFunctionIndex attribute" "has been registered for the class name: %s with typeid: %s", behaviorClass->m_name.data(), behaviorClass->m_typeId.ToString().data()) diff --git a/Gems/ScriptCanvas/Code/Source/SystemComponent.cpp b/Gems/ScriptCanvas/Code/Source/SystemComponent.cpp index 26af95fa8e..ba02fa8a62 100644 --- a/Gems/ScriptCanvas/Code/Source/SystemComponent.cpp +++ b/Gems/ScriptCanvas/Code/Source/SystemComponent.cpp @@ -260,7 +260,7 @@ namespace ScriptCanvas } LockType lock(m_ownedObjectsByAddressMutex); - auto emplaceResult = m_ownedObjectsByAddress.emplace(object, behaviorContextObject); + [[maybe_unused]] auto emplaceResult = m_ownedObjectsByAddress.emplace(object, behaviorContextObject); AZ_Assert(emplaceResult.second, "Adding second owned reference to memory"); }