From: Konrad Lipinski Date: Tue, 7 Apr 2020 11:17:21 +0000 (+0200) Subject: Annotate fallthru switch statements X-Git-Tag: accepted/tizen/6.0/unified/20201030.115139~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6d7954586c82db7f963afbbd8ca53b3aa7b22c21;p=platform%2Fcore%2Fsecurity%2Fkey-manager.git Annotate fallthru switch statements As of gcc 7: * -Wimplicit-fallthrough is enabled via -Wextra * the standard statement attribute [[fallthrough]] is supported Change-Id: Iea6809980b5cb6c9abe28cbded74bcaa8997650d --- diff --git a/src/manager/crypto/tz-backend/internals.cpp b/src/manager/crypto/tz-backend/internals.cpp index 9962cf5..be96f1f 100644 --- a/src/manager/crypto/tz-backend/internals.cpp +++ b/src/manager/crypto/tz-backend/internals.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 Samsung Electronics Co., Ltd. All rights reserved + * Copyright (c) 2017-2020 Samsung Electronics Co., Ltd. All rights reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,6 +36,16 @@ #include +#ifndef __has_cpp_attribute +#define __has_cpp_attribute(_) 0 +#endif + +#if __has_cpp_attribute(fallthrough) +#define fallthru [[fallthrough]] +#else +#define fallthru ((void)0) +#endif + namespace { using DSAPtr = std::unique_ptr>; @@ -395,6 +405,7 @@ RawBuffer symmetricEncrypt(const RawBuffer &key, ThrowErr(Exc::Crypto::InputParam, "Invalid CTR length"); } // no break here, we still need to slide down to executeCrypt + fallthru; } case AlgoType::AES_CBC: case AlgoType::AES_CFB: { @@ -445,6 +456,7 @@ RawBuffer symmetricDecrypt(const RawBuffer &key, ThrowErr(Exc::Crypto::InputParam, "Invalid CTR length"); } // no break here, we still need to slide down to executeCrypt + fallthru; } case AlgoType::AES_CBC: case AlgoType::AES_CFB: {