more fixes for Code

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-08-20 14:48:42 -07:00
parent a35464ca08
commit 9245a31196
54 changed files with 97 additions and 121 deletions
+1 -1
View File
@@ -66,7 +66,7 @@ typedef const GUID& REFIID;
const GUID name \
= { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
REFGUID GUID_NULL()
inline static REFGUID GUID_NULL()
{
static GUID guid = { 0x00000000L, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} };
return guid;
@@ -22,7 +22,7 @@ namespace AZ
{
// Note the parameter pack expansion, this creates the equivalent of a fold expression
// For each type, call InitAllocator<T>(), then put 0 in the initializer list
std::initializer_list<int> init{(InitAllocator<Allocators>(), 0)...};
[[maybe_unused]] std::initializer_list<int> init{(InitAllocator<Allocators>(), 0)...};
}
void DeactivateAllocators()
+2 -2
View File
@@ -493,7 +493,7 @@ namespace AZ
const void* result = GetTypeId() == asType ? instance : nullptr;
using dummy = bool[];
dummy{ true, (CastInternal<TArgs>(result, instance, asType), true)... };
[[maybe_unused]] dummy d { true, (CastInternal<TArgs>(result, instance, asType), true)... };
return result;
}
@@ -534,7 +534,7 @@ namespace AZ
callback(GetActualUuid(instance), instance);
using dummy = bool[];
dummy{ true, (RttiHelper<TArgs>{}.EnumHierarchy(callback, instance), true)... };
[[maybe_unused]] dummy d = { true, (RttiHelper<TArgs>{}.EnumHierarchy(callback, instance), true)... };
}
TypeTraits GetTypeTraits() const override
{
+1 -1
View File
@@ -293,7 +293,7 @@ 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(x) (void)x
#define AZ_DEFINE_ENUM_BITWISE_OPERATORS(EnumType) \
inline constexpr EnumType operator | (EnumType a, EnumType b) \
@@ -318,8 +318,6 @@ namespace UnitTest
using TestVariant2 = AZStd::variant<TestAlignedStorage, float, bool, int>;
static_assert(sizeof(TestVariant1) == sizeof(TestVariant2), "with different permutations variants of same types should be the same size");
using UnorderedVariant3 = AZStd::variant<AZStd::unordered_map<AZStd::string, AZStd::string>, TestAlignedStorage>;
constexpr size_t testVariant1Size = sizeof(TestVariant1);
constexpr size_t unorderedVariant3Size = sizeof(UnorderedVariant3);
static_assert(sizeof(TestVariant1) == sizeof(UnorderedVariant3), "with different permutations variants of same types should be the same size");
}
@@ -297,7 +297,7 @@ TEST_F(AssetDataStreamTest, IsFullyLoaded_FileDoesNotReadAllData_DataIsNotFullyL
using ::testing::_;
ON_CALL(m_mockStreamer, GetReadRequestResult(_, _, _, _))
.WillByDefault([this, incompleteAssetSize](
.WillByDefault([this](
[[maybe_unused]] FileRequestHandle request,
void*& buffer,
AZ::u64& numBytesRead,
@@ -72,7 +72,7 @@ namespace UnitTest
});
ON_CALL(m_mockStreamer, GetRequestStatus(_))
.WillByDefault([this]([[maybe_unused]] FileRequestHandle request)
.WillByDefault([]([[maybe_unused]] FileRequestHandle request)
{
// Return whatever request status has been set in this class
return IO::IStreamerTypes::RequestStatus::Completed;
@@ -226,8 +226,10 @@ namespace AZ::Debug
AZStd::thread threads[totalThreads];
for (size_t threadIndex = 0; threadIndex < totalThreads; ++threadIndex)
{
threads[threadIndex] = AZStd::thread([&startLogging, &totalRecordsWritten, &message, recordsPerThreadCount]()
threads[threadIndex] = AZStd::thread([&startLogging, &message, &totalRecordsWritten]()
{
AZ_UNUSED(message);
while (!startLogging)
{
AZStd::this_thread::yield();
+2 -2
View File
@@ -2837,7 +2837,7 @@ namespace UnitTest
handlerList.emplace_back(i, maxSleep);
}
auto work = [maxSleep, threadCount]()
auto work = []()
{
char sentinel[64] = { 0 };
char* end = sentinel + AZ_ARRAY_SIZE(sentinel);
@@ -2923,7 +2923,7 @@ namespace UnitTest
MyEventGroupImpl handler;
auto work = [maxSleep, &handler]()
auto work = [&handler]()
{
for (int i = 1; i < cycleCount; ++i)
{
+1 -1
View File
@@ -81,7 +81,7 @@ namespace UnitTest
auto EnumerateTestEnum = []() constexpr -> bool
{
int count = 0;
for (TestEnumEnumeratorValueAndString enumMember : TestEnumMembers)
for ([[maybe_unused]] TestEnumEnumeratorValueAndString enumMember : TestEnumMembers)
{
++count;
}
@@ -62,7 +62,7 @@ public:
// Reroute the mock stream to our output MemoryStream for writing.
ON_CALL(m_mockGenericStream, Write(_, _))
.WillByDefault([this, &outputStream](AZ::IO::SizeType bytes, const void* buffer)
.WillByDefault([&outputStream](AZ::IO::SizeType bytes, const void* buffer)
{
return outputStream.Write(bytes, buffer);
});
+1 -1
View File
@@ -1361,7 +1361,7 @@ namespace UnitTest
AZ::JobCompletion completion;
// Push a parent job that pushes the work as child jobs (requires the current job, so this is a real world test of "functor with current job as param")
AZ::Job* parentJob = AZ::CreateJobFunction([this, &jobData, JobCount](AZ::Job& thisJob)
AZ::Job* parentJob = AZ::CreateJobFunction([this, &jobData](AZ::Job& thisJob)
{
EXPECT_EQ(m_jobManager->GetCurrentJob(), &thisJob);
@@ -56,7 +56,7 @@ namespace Benchmark
// This function only exist to calculate AZ::Crc32 values at compile time
for (auto _ : state)
{
constexpr auto resultArray = Crc32Internal::GenerateTestCrc32Values();
[[maybe_unused]] constexpr auto resultArray = Crc32Internal::GenerateTestCrc32Values();
}
}
@@ -582,7 +582,6 @@ namespace UnitTest
TEST_F(NameTest, ConcurrencyDataTest_EachThreadCreatesOneName_NoCollision)
{
const uint32_t maxUniqueHashes = std::numeric_limits<uint32_t>::max();
AZ::NameDictionary::Destroy();
AZ::NameDictionary::Create();
@@ -592,7 +591,6 @@ namespace UnitTest
TEST_F(NameTest, ConcurrencyDataTest_EachThreadCreatesOneName_HighCollisions)
{
const uint32_t maxUniqueHashes = 25;
AZ::NameDictionary::Destroy();
AZ::NameDictionary::Create();
@@ -602,7 +600,6 @@ namespace UnitTest
TEST_F(NameTest, ConcurrencyDataTest_EachThreadRepeatedlyCreatesAndReleasesOneName_NoCollision)
{
const uint32_t maxUniqueHashes = std::numeric_limits<uint32_t>::max();
AZ::NameDictionary::Destroy();
AZ::NameDictionary::Create();
@@ -613,7 +610,6 @@ namespace UnitTest
TEST_F(NameTest, ConcurrencyDataTest_EachThreadRepeatedlyCreatesAndReleasesOneName_HighCollisions)
{
const uint32_t maxUniqueHashes = 25;
AZ::NameDictionary::Destroy();
AZ::NameDictionary::Create();
+2 -3
View File
@@ -171,7 +171,6 @@ namespace UnitTest
AZ_TEST_ASSERT(AzGenericTypeInfo::Uuid<MyClassTemplateType>() == templateUuid);
// Check all combinations return a valid id.
Uuid nullId = Uuid::CreateNull();
AZ_TEST_ASSERT(AzGenericTypeInfo::Uuid<AZStd::array>() == AZ::Uuid("{911B2EA8-CCB1-4F0C-A535-540AD00173AE}"));
AZ_TEST_ASSERT(AzGenericTypeInfo::Uuid<AZStd::bitset>() == AZ::Uuid("{6BAE9836-EC49-466A-85F2-F4B1B70839FB}"));
AZ_TEST_ASSERT(AzGenericTypeInfo::Uuid<AZStd::function>() == AZ::Uuid("{C9F9C644-CCC3-4F77-A792-F5B5DBCA746E}"));
@@ -460,8 +459,8 @@ namespace UnitTest
TEST_F(Rtti, IsAbstract)
{
// compile time proof that the two non-abstract classes are not abstract at compile time:
ExampleFullImplementationClass one;
ExampleCombined two;
[[maybe_unused]] ExampleFullImplementationClass one;
[[maybe_unused]] ExampleCombined two;
ASSERT_NE(GetRttiHelper<ExampleAbstractClass>(), nullptr);
ASSERT_NE(GetRttiHelper<ExampleFullImplementationClass>(), nullptr);
@@ -144,11 +144,6 @@ namespace JsonSerializationTests
{
return false;
}
auto compare = [](const int* lhs, const int* rhs) -> bool
{
return *lhs == *rhs;
};
return AZStd::equal(lhs.begin(), lhs.end(), rhs.begin(), SimplePointerTestDescriptionCompare{});
}
};
@@ -544,6 +544,7 @@ namespace JsonSerializationTests
ResultCode result = this->m_serializer->Store(convertedValue, &value, nullptr,
azrtti_typeid<typename SerializerInfo<TypeParam>::DataType>(), *this->m_jsonSerializationContext);
EXPECT_EQ(Outcomes::Success, result.GetOutcome());
if constexpr (AZStd::is_signed<typename SerializerInfo<TypeParam>::DataType>::value)
{
@@ -560,7 +560,6 @@ namespace JsonSerializationTests
{
using namespace AZ::JsonSerializationResult;
TemplatedClass<int> instance;
ResultCode result = AZ::JsonSerialization::Store(*m_jsonDocument, m_jsonDocument->GetAllocator(),
nullptr, nullptr, azrtti_typeid<int>(), *m_serializationSettings);
@@ -469,6 +469,7 @@ namespace JsonSerializationTests
*this->m_jsonDocument,
*this->m_jsonDeserializationContext);
ASSERT_EQ(Outcomes::Success, result.GetOutcome());
EXPECT_TRUE(defaultValue == output);
}
@@ -503,7 +504,6 @@ namespace JsonSerializationTests
using namespace AZ::JsonSerializationResult;
using Descriptor = typename JsonMathMatrixSerializerTests<TypeParam>::Descriptor;
const auto defaultValue = Descriptor::MatrixType::CreateIdentity();
rapidjson::Value& objectValue = this->m_jsonDocument->SetObject();
auto input = Descriptor::MatrixType::CreateIdentity();
DataHelper::AddData(objectValue, input, this->m_jsonDocument->GetAllocator());
@@ -250,7 +250,7 @@ namespace AZ::IO
constexpr s32 minValue = std::numeric_limits<s32>::min();
EXPECT_CALL(*mock, UpdateStatus(_))
.WillOnce([minValue](StreamStackEntry::Status& status)
.WillOnce([](StreamStackEntry::Status& status)
{
status.m_numAvailableSlots = minValue;
});