Move to -std=c++14 58/227958/2
authorKonrad Lipinski <k.lipinski2@samsung.com>
Tue, 17 Mar 2020 11:09:20 +0000 (12:09 +0100)
committerKonrad Lipinski <k.lipinski2@samsung.com>
Tue, 17 Mar 2020 13:22:14 +0000 (14:22 +0100)
Change-Id: Id2f9eaa0ab2237aa8a8da379949cd239ec69d565

CMakeLists.txt
src/manager/crypto/sw-backend/store.cpp
src/manager/crypto/tz-backend/store.cpp

index e0d9bc5..cfa5cc2 100644 (file)
@@ -29,13 +29,13 @@ INCLUDE(FindPkgConfig)
 ############################# compiler flags ##################################
 
 SET(CMAKE_C_FLAGS_PROFILING    "-g -O0 -pg -Wp,-U_FORTIFY_SOURCE")
-SET(CMAKE_CXX_FLAGS_PROFILING  "-g -std=c++0x -O0 -pg -Wp,-U_FORTIFY_SOURCE")
+SET(CMAKE_CXX_FLAGS_PROFILING  "-g -std=c++14 -O0 -pg -Wp,-U_FORTIFY_SOURCE")
 SET(CMAKE_C_FLAGS_DEBUG        "-g -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
-SET(CMAKE_CXX_FLAGS_DEBUG      "-g -std=c++0x -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
+SET(CMAKE_CXX_FLAGS_DEBUG      "-g -std=c++14 -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
 SET(CMAKE_C_FLAGS_RELEASE      "-g -O2")
-SET(CMAKE_CXX_FLAGS_RELEASE    "-g -std=c++0x -O2")
+SET(CMAKE_CXX_FLAGS_RELEASE    "-g -std=c++14 -O2")
 SET(CMAKE_C_FLAGS_CCOV         "-g -O2 --coverage")
-SET(CMAKE_CXX_FLAGS_CCOV       "-g -std=c++0x -O2 --coverage")
+SET(CMAKE_CXX_FLAGS_CCOV       "-g -std=c++14 -O2 --coverage")
 
 # Force PIE
 SET(CMAKE_POSITION_INDEPENDENT_CODE "True")
index 0f27005..62dd580 100644 (file)
@@ -44,12 +44,6 @@ enum EncryptionScheme {
        PASSWORD = 1 << 0
 };
 
-template <typename T, typename ...Args>
-std::unique_ptr<T> make_unique(Args &&...args)
-{
-       return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
-}
-
 RawBuffer generateRandIV()
 {
        RawBuffer civ(EVP_MAX_IV_LENGTH);
@@ -164,16 +158,16 @@ GObjUPtr Store::getObject(const Token &token, const Password &pass)
        RawBuffer data = unpack(token.data, pass);
 
        if (token.dataType.isKeyPrivate() || token.dataType.isKeyPublic())
-               return make_unique<AKey>(data, token.dataType);
+               return std::make_unique<AKey>(data, token.dataType);
 
        if (token.dataType == DataType(DataType::KEY_AES))
-               return make_unique<SKey>(data, token.dataType);
+               return std::make_unique<SKey>(data, token.dataType);
 
        if (token.dataType.isCertificate() || token.dataType.isChainCert())
-               return make_unique<Cert>(data, token.dataType);
+               return std::make_unique<Cert>(data, token.dataType);
 
        if (token.dataType.isBinaryData())
-               return make_unique<BData>(data, token.dataType);
+               return std::make_unique<BData>(data, token.dataType);
 
        ThrowErr(Exc::Crypto::DataTypeNotSupported,
                         "This type of data is not supported by openssl backend: ", (int)token.dataType);
index 978a155..e5402ea 100644 (file)
@@ -34,12 +34,6 @@ namespace TZ {
 
 namespace {
 
-template <typename T, typename ...Args>
-std::unique_ptr<T> make_unique(Args &&...args)
-{
-       return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
-}
-
 // internal SW encryption scheme flags
 enum EncryptionScheme {
        NONE = 0,
@@ -115,17 +109,17 @@ GObjUPtr Store::getObject(const Token &token, const Password &pass)
        }
 
        if (token.dataType.isKeyPrivate() || token.dataType.isKeyPublic())
-               return make_unique<AKey>(scheme, id, Pwd(pass, iv, tag), token.dataType);
+               return std::make_unique<AKey>(scheme, id, Pwd(pass, iv, tag), token.dataType);
 
        if (token.dataType.isSKey())
-               return make_unique<SKey>(scheme, id, Pwd(pass, iv, tag), token.dataType);
+               return std::make_unique<SKey>(scheme, id, Pwd(pass, iv, tag), token.dataType);
 
        if (token.dataType.isCertificate() || token.dataType.isChainCert())
-               return make_unique<Cert>(scheme, id, Pwd(pass, iv, tag), token.dataType);
+               return std::make_unique<Cert>(scheme, id, Pwd(pass, iv, tag), token.dataType);
 
        if (token.dataType.isBinaryData()) {
                RawBuffer exported_data = Internals::getData(id, Pwd(pass, iv, tag));
-               return make_unique<BData>(std::move(exported_data));
+               return std::make_unique<BData>(std::move(exported_data));
        }
 
        ThrowErr(Exc::Crypto::DataTypeNotSupported,