Adds unused calls to Trace functions to prevent constant failures in release builds

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-09-09 09:11:19 -07:00
committed by GitHub
32 changed files with 73 additions and 80 deletions
@@ -213,7 +213,7 @@ namespace AZ
void AssetData::Acquire()
{
AZ_Assert(m_useCount >= 0, "AssetData has been deleted")
AZ_Assert(m_useCount >= 0, "AssetData has been deleted");
AcquireWeak();
++m_useCount;
@@ -990,7 +990,7 @@ namespace AZ
template<class T>
u8 Asset<T>::GetFlags() const
{
AZ_Warning("Asset", false, "Deprecated - replaced by GetAutoLoadBehavior")
AZ_Warning("Asset", false, "Deprecated - replaced by GetAutoLoadBehavior");
return static_cast<u8>(m_loadBehavior);
}
@@ -1012,7 +1012,7 @@ namespace AZ
template<class T>
bool Asset<T>::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<u8>(AssetLoadBehavior::Count), "Flags value is out of range");
@@ -2132,7 +2132,7 @@ namespace AZ
}
else
{
AZ_Warning("AssetManager", false, "Couldn't find handler for asset %s (%s)", asset.GetId().ToString<AZStd::string>().c_str(), asset.GetHint().c_str())
AZ_Warning("AssetManager", false, "Couldn't find handler for asset %s (%s)", asset.GetId().ToString<AZStd::string>().c_str(), asset.GetHint().c_str());
}
// Notify any dependent jobs.
+12 -12
View File
@@ -8,8 +8,7 @@
#pragma once
#include <AzCore/PlatformDef.h>
#define AZ_VA_HAS_ARGS(...) ""#__VA_ARGS__[0] != 0
#include <AzCore/base.h>
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
@@ -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;
}
@@ -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;
};
@@ -222,7 +222,7 @@ namespace AZ
int AddRefCount(int value)
{
AZ_Assert(value == 1 || value == -1, "ModRefCount is only for incrementing or decrementing on copy or destruction of ExposedLambda")
AZ_Assert(value == 1 || value == -1, "ModRefCount is only for incrementing or decrementing on copy or destruction of ExposedLambda");
lua_rawgeti(m_lua, LUA_REGISTRYINDEX, m_refCountRegistryIndex);
// Lua: refCount-old
const int refCount = Internal::azlua_tointeger(m_lua, -1) + value;
@@ -293,7 +293,7 @@ namespace AZ
}
AZ_Assert(!keyValues.Empty(), "Intermediate array for associative container can't be empty "
"because an empty array would be stored as an empty default object.")
"because an empty array would be stored as an empty default object.");
if (CanBeConvertedToObject(keyValues))
{
@@ -2300,7 +2300,7 @@ namespace AZ
{
if (classData->m_converter)
{
AZ_Assert(false, "A deprecated element with a data converter was passed to CloneObject, this is not supported.")
AZ_Assert(false, "A deprecated element with a data converter was passed to CloneObject, this is not supported.");
}
// push a dummy node in the stack
cloneData->m_parentStack.push_back();
@@ -109,12 +109,12 @@ namespace AZ::Internal
{
FixedValueString engineName;
settingsRegistry.Get(engineName, engineMonikerKey);
AZ_Warning("SettingsRegistryMergeUtils",engineInfo.m_moniker == engineName,
AZ_Warning("SettingsRegistryMergeUtils", engineInfo.m_moniker == engineName,
R"(The engine name key "%s" mapped to engine path "%s" within the global manifest of "%s")"
R"( does not match the "engine_name" field "%s" in the engine.json)" "\n"
"This engine should be re-registered.",
engineInfo.m_moniker.c_str(), engineInfo.m_path.c_str(), engineManifestPath.c_str(),
engineName.c_str())
engineName.c_str());
engineInfo.m_moniker = engineName;
}
}
@@ -3464,7 +3464,7 @@ namespace AZ
const SliceComponent::DataFlagsPerEntity* SliceComponent::GetCorrectBundleOfDataFlags(EntityId entityId) const
{
// It would be possible to search non-instantiated slices by crawling over lists, but we haven't needed the capability yet.
AZ_Assert(IsInstantiated(), "Data flag access is only permitted after slice is instantiated.")
AZ_Assert(IsInstantiated(), "Data flag access is only permitted after slice is instantiated.");
if (IsInstantiated())
{
+26 -10
View File
@@ -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) \
@@ -42,7 +42,7 @@ namespace AZ
}
else
{
AZ_Error("System", false, "Failed to open HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography\\MachineGuid!")
AZ_Error("System", false, "Failed to open HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography\\MachineGuid!");
}
wchar_t* hostname = machineInfo + wcslen(machineInfo);
+1 -1
View File
@@ -2651,7 +2651,7 @@ namespace UnitTest
if (!rootElement.GetChildData(AZ_CRC("InnerBaseStringField"), stringField))
{
AZ_Error("PatchingTest", false, "Unable to retrieve 'InnerBaseStringField' data for %u version of the InnerObjectFieldConverterClass",
rootElement.GetVersion())
rootElement.GetVersion());
return false;
}
@@ -281,7 +281,7 @@ namespace AzFramework
AZ_PROFILE_FUNCTION(AzCore);
auto data = AZStd::get_if<FileRequest::ReadData>(&request->GetCommand());
AZ_Assert(data, "Request doing reading in the RemoteStorageDrive didn't contain read data.")
AZ_Assert(data, "Request doing reading in the RemoteStorageDrive didn't contain read data.");
HandleType file = InvalidHandle;
@@ -303,7 +303,7 @@ VectorInput::~VectorInput()
void VectorInput::setLabel(int index, const QString& label)
{
AZ_Warning("PropertyGrid", index < m_elementCount,
"This control handles only %i controls", m_elementCount)
"This control handles only %i controls", m_elementCount);
if (index < m_elementCount)
{
m_elements[index]->setLabel(label);
@@ -313,7 +313,7 @@ void VectorInput::setLabel(int index, const QString& label)
void VectorInput::setLabelStyle(int index, const QString& qss)
{
AZ_Warning("PropertyGrid", index < m_elementCount,
"This control handles only %i controls", m_elementCount)
"This control handles only %i controls", m_elementCount);
if (index < m_elementCount)
{
m_elements[index]->getLabelWidget()->setStyleSheet(qss);
@@ -323,7 +323,7 @@ void VectorInput::setLabelStyle(int index, const QString& qss)
void VectorInput::setValuebyIndex(double value, int elementIndex)
{
AZ_Warning("PropertyGrid", elementIndex < m_elementCount,
"This control handles only %i controls", m_elementCount)
"This control handles only %i controls", m_elementCount);
if (elementIndex < m_elementCount)
{
m_elements[elementIndex]->setValue(value);
@@ -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);
@@ -236,7 +236,7 @@ namespace AZ
case TextureMapType::Bump:
return m_normalMap;
default:
AZ_Assert(false, "Invalid Texture map requested.")
AZ_Assert(false, "Invalid Texture map requested.");
return m_empty;
}
}
@@ -255,7 +255,7 @@ namespace AZ
m_normalMap = texture;
break;
default:
AZ_Assert(false, "Invalid Texture map requested.")
AZ_Assert(false, "Invalid Texture map requested.");
break;
}
}
@@ -599,7 +599,7 @@ namespace AZ
if (!materialNode)
{
AZ_Assert(false, "Attempted to add material to invalid xml document.")
AZ_Assert(false, "Attempted to add material to invalid xml document.");
return false;
}
@@ -351,7 +351,7 @@ namespace GridMate
DataSetBase* dataset = descriptor->GetDataSet(this, i);
if (!dataset)
{
AZ_Assert(false, "How can we have a dirty dataset that doesn't exist?")
AZ_Assert(false, "How can we have a dirty dataset that doesn't exist?");
continue;
}
@@ -64,7 +64,7 @@ namespace GridMate
// Create Callback
AZStd::weak_ptr<TargetCallbackBase> CreateCallback(AZ::u64 revision)
{
AZ_Assert(IsAckEnabled(), "ACK disabled.") //Shouldn't happen
AZ_Assert(IsAckEnabled(), "ACK disabled."); //Shouldn't happen
AZ_Assert(m_replicaRevision <= revision, "Cannot decrease replica revision");
if(!m_callback || m_callback->m_revision != revision)
@@ -1583,7 +1583,7 @@ GridSession::OnStateCreate(HSM& sm, const HSM::Event& e)
// Bind member replica
bool isAdded = AddMember(m_myMember);
AZ_Error("GridMate", isAdded, "Failed to add my replica, check the number of open slots!")
AZ_Error("GridMate", isAdded, "Failed to add my replica, check the number of open slots!");
if (!isAdded)
{
sm.Transition(SS_DELETE);
@@ -698,7 +698,7 @@ namespace GridMate
static void* UserDataCopier(const void* sourceData, unsigned int sourceDataSize)
{
(void)sourceDataSize;
AZ_Assert(sizeof(T) == sourceDataSize, "Data size %d doesn't match the type size %d", sourceDataSize, sizeof(T))
AZ_Assert(sizeof(T) == sourceDataSize, "Data size %d doesn't match the type size %d", sourceDataSize, sizeof(T));
return azcreate(T, (*static_cast<const T*>(sourceData)), GridMateAllocatorMP, "UserDataCopier");
}
template<class T>