From 6594030b55a0d4ae431bc45948697ce961488660 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Fri, 27 May 2022 01:46:38 +0900 Subject: [PATCH] Revrert "Enable assert alwayd in Dali::Vector" Due to the DALI_ASSERT_ALWAYS, Dali::Vector try to check the range of index every times. It might make some performance reducing. Change-Id: I2fdcf435bda147f9ea102c3106cb44f0772a4899 Signed-off-by: Eunki, Hong --- .../src/dali/utc-Dali-CircularQueue.cpp | 4 +++- automated-tests/src/dali/utc-Dali-Vector.cpp | 4 +++- dali/public-api/common/dali-vector.h | 16 +++++++++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/automated-tests/src/dali/utc-Dali-CircularQueue.cpp b/automated-tests/src/dali/utc-Dali-CircularQueue.cpp index e5c718c33..881e29df8 100644 --- a/automated-tests/src/dali/utc-Dali-CircularQueue.cpp +++ b/automated-tests/src/dali/utc-Dali-CircularQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -15,6 +15,8 @@ * */ +#define ENABLE_VECTOR_ASSERTS + #include #include #include diff --git a/automated-tests/src/dali/utc-Dali-Vector.cpp b/automated-tests/src/dali/utc-Dali-Vector.cpp index 815cf6952..b6ae5bd6a 100644 --- a/automated-tests/src/dali/utc-Dali-Vector.cpp +++ b/automated-tests/src/dali/utc-Dali-Vector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -15,6 +15,8 @@ * */ +#define ENABLE_VECTOR_ASSERTS + #include #include #include diff --git a/dali/public-api/common/dali-vector.h b/dali/public-api/common/dali-vector.h index 80c636475..5bdccc1a2 100644 --- a/dali/public-api/common/dali-vector.h +++ b/dali/public-api/common/dali-vector.h @@ -2,7 +2,7 @@ #define DALI_VECTOR_H /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -28,7 +28,21 @@ #include #include +/** + * @brief For DALi internal use, asserts are enabled in debug builds. + * + * For Application use, asserts can be enabled manually. + * @SINCE_2_1.23 + */ +#if defined(DEBUG_ENABLED) +#define ENABLE_VECTOR_ASSERTS +#endif + +#if defined(ENABLE_VECTOR_ASSERTS) #define DALI_ASSERT_VECTOR(cond) DALI_ASSERT_ALWAYS(cond) +#else +#define DALI_ASSERT_VECTOR(cond) +#endif namespace Dali { -- 2.34.1