From 0ab1b1150340fd24ac2d4ce48c4714eb5f5636e4 Mon Sep 17 00:00:00 2001 From: Eunki Hong Date: Fri, 7 Jul 2023 09:08:56 +0900 Subject: [PATCH] Fix more compile error/warnings for gcc-13 - Let we ignore -Wself-move for some UTC - Include vector-wrapper and cstdint Change-Id: I0bfe5be0cbc4f76645618fcdd52bdeb87df00da5 Signed-off-by: Eunki Hong --- .../utc-Dali-Internal-ActorObserver.cpp | 18 +++++++++++++++++- ...utc-Dali-Internal-IndexedConstStringMap.cpp | 15 +++++++-------- .../utc-Dali-Internal-OwnerPointer.cpp | 10 +++++++++- .../dali-test-suite-utils/test-actor-utils.h | 1 + .../src/dali/utc-Dali-PropertyArray.cpp | 10 +++++++++- .../src/dali/utc-Dali-PropertyMap.cpp | 10 +++++++++- .../src/dali/utc-Dali-PropertyValue.cpp | 10 +++++++++- dali/devel-api/addons/addon-dispatch-table.h | 3 ++- dali/public-api/math/random.h | 5 ++++- 9 files changed, 67 insertions(+), 15 deletions(-) diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-ActorObserver.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-ActorObserver.cpp index 50d1e87b1..c6478e342 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-ActorObserver.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-ActorObserver.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -153,11 +153,19 @@ int UtcDaliActorObserverMoveConstructorAndAssignmentEmpty(void) DALI_TEST_EQUALS(observer1.GetActor(), nullptr, TEST_LOCATION); DALI_TEST_EQUALS(observer2.GetActor(), nullptr, TEST_LOCATION); + // Self std::move assignment make compile warning over gcc-13. Let we ignore the warning. +#if (__GNUC__ >= 13) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wself-move" +#endif // Ensure self assignment doesn't change anything observer1 = std::move(observer1); observer2 = std::move(observer2); DALI_TEST_EQUALS(observer1.GetActor(), nullptr, TEST_LOCATION); DALI_TEST_EQUALS(observer2.GetActor(), nullptr, TEST_LOCATION); +#if (__GNUC__ >= 13) +#pragma GCC diagnostic pop +#endif END_TEST; } @@ -185,11 +193,19 @@ int UtcDaliActorObserverMoveConstructorAndAssignment(void) DALI_TEST_EQUALS(observer1.GetActor(), &actorImpl, TEST_LOCATION); DALI_TEST_EQUALS(observer2.GetActor(), nullptr, TEST_LOCATION); + // Self std::move assignment make compile warning over gcc-13. Let we ignore the warning. +#if (__GNUC__ >= 13) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wself-move" +#endif // Self assignment observer1 = std::move(observer1); observer2 = std::move(observer2); DALI_TEST_EQUALS(observer1.GetActor(), &actorImpl, TEST_LOCATION); DALI_TEST_EQUALS(observer2.GetActor(), nullptr, TEST_LOCATION); +#if (__GNUC__ >= 13) +#pragma GCC diagnostic pop +#endif END_TEST; } diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-IndexedConstStringMap.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-IndexedConstStringMap.cpp index 37fba196c..70ad4fde4 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-IndexedConstStringMap.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-IndexedConstStringMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,16 +49,15 @@ std::string RandomString(size_t length) return s; } -// Custom << operator to print debugging log. -std::basic_ostream& operator<<(std::basic_ostream& os, const ConstString& constString) +} // namespace + +// Custom DALI_TEST_EQUALS for ConstString +template<> +inline void DALI_TEST_EQUALS(ConstString str1, ConstString str2, const char* location) { - std::string convertedString = std::string(constString.GetStringView()); - os << convertedString; - return os; + DALI_TEST_EQUALS(str1.GetStringView(), str2.GetStringView(), location); } -} // namespace - void utc_dali_internal_indexed_conststring_map_startup(void) { test_return_value = TET_UNDEF; diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-OwnerPointer.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-OwnerPointer.cpp index 01af1adbb..f1aba8723 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-OwnerPointer.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-OwnerPointer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -163,12 +163,20 @@ int UtcDaliOwnerPointerMove(void) DALI_TEST_CHECK(second.Get() == owned); DALI_TEST_EQUALS(deleted, false, TEST_LOCATION); + // Self std::move assignment make compile warning over gcc-13. Let we ignore the warning. +#if (__GNUC__ >= 13) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wself-move" +#endif // Self assignment, nothing should change or be deleted. first = std::move(first); second = std::move(second); DALI_TEST_CHECK(first.Get() == nullptr); DALI_TEST_CHECK(second.Get() == owned); DALI_TEST_EQUALS(deleted, false, TEST_LOCATION); +#if (__GNUC__ >= 13) +#pragma GCC diagnostic pop +#endif // Assign second to first, no deletion, second should have a nullptr now first = std::move(second); diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-actor-utils.h b/automated-tests/src/dali/dali-test-suite-utils/test-actor-utils.h index 657136548..03a65c181 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-actor-utils.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-actor-utils.h @@ -19,6 +19,7 @@ */ // EXTERNAL INCLUDES +#include #include #include #include // For std::multiset diff --git a/automated-tests/src/dali/utc-Dali-PropertyArray.cpp b/automated-tests/src/dali/utc-Dali-PropertyArray.cpp index 2858170d9..40a7c125c 100644 --- a/automated-tests/src/dali/utc-Dali-PropertyArray.cpp +++ b/automated-tests/src/dali/utc-Dali-PropertyArray.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -368,9 +368,17 @@ int UtcDaliPropertyArrayMoveAssignmentOperator(void) DALI_TEST_ASSERTION(const_cast(array1)[0], exceptionMessage); DALI_TEST_ASSERTION(Property::Array temp; array1 = temp, exceptionMessage); + // Self std::move assignment make compile warning over gcc-13. Let we ignore the warning. +#if (__GNUC__ >= 13) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wself-move" +#endif // Self assignemnt array2 = std::move(array2); DALI_TEST_EQUALS(3u, array2.Size(), TEST_LOCATION); // still works, no debug assert +#if (__GNUC__ >= 13) +#pragma GCC diagnostic pop +#endif END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-PropertyMap.cpp b/automated-tests/src/dali/utc-Dali-PropertyMap.cpp index 61edaee0f..c992bafd5 100755 --- a/automated-tests/src/dali/utc-Dali-PropertyMap.cpp +++ b/automated-tests/src/dali/utc-Dali-PropertyMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -162,9 +162,17 @@ int UtcDaliPropertyMapMoveAssignmentOperator(void) DALI_TEST_ASSERTION(const_cast(map1)[0], exceptionMessage); DALI_TEST_ASSERTION(Property::Map temp; map1 = temp, exceptionMessage); + // Self std::move assignment make compile warning over gcc-13. Let we ignore the warning. +#if (__GNUC__ >= 13) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wself-move" +#endif // Self assignment map2 = std::move(map2); DALI_TEST_EQUALS(3u, map2.Count(), TEST_LOCATION); // No debug assert as nothing should happen +#if (__GNUC__ >= 13) +#pragma GCC diagnostic pop +#endif END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-PropertyValue.cpp b/automated-tests/src/dali/utc-Dali-PropertyValue.cpp index bf9c4b0d4..449fce250 100644 --- a/automated-tests/src/dali/utc-Dali-PropertyValue.cpp +++ b/automated-tests/src/dali/utc-Dali-PropertyValue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -812,10 +812,18 @@ int UtcDaliPropertyValueMoveAssignmentOperator(void) DALI_TEST_EQUALS(true, value2.Get(valueFloat), TEST_LOCATION); // Should be able to convert to a float now DALI_TEST_EQUALS(valueFloat, 1.0f, TEST_LOCATION); + // Self std::move assignment make compile warning over gcc-13. Let we ignore the warning. +#if (__GNUC__ >= 13) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wself-move" +#endif // Ensure self assignment doesn't do anything silly value2 = std::move(value2); DALI_TEST_EQUALS(true, value2.Get(valueFloat), TEST_LOCATION); DALI_TEST_EQUALS(valueFloat, 1.0f, TEST_LOCATION); +#if (__GNUC__ >= 13) +#pragma GCC diagnostic pop +#endif END_TEST; } diff --git a/dali/devel-api/addons/addon-dispatch-table.h b/dali/devel-api/addons/addon-dispatch-table.h index 12c9c64e9..d50826f45 100644 --- a/dali/devel-api/addons/addon-dispatch-table.h +++ b/dali/devel-api/addons/addon-dispatch-table.h @@ -2,7 +2,7 @@ #define DALI_ADDON_DISPATCH_TABLE_H /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ #include #include #include +#include namespace Dali { diff --git a/dali/public-api/math/random.h b/dali/public-api/math/random.h index 066e4ba24..4d9fd4f6d 100644 --- a/dali/public-api/math/random.h +++ b/dali/public-api/math/random.h @@ -2,7 +2,7 @@ #define DALI_RANDOM_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,10 @@ // INTERNAL INCLUDES #include + +// EXTERNAL INCLUDES #include +#include ///< for time(nullptr) namespace Dali { -- 2.34.1