Add stack protection flags in the CMakeLists.txt file (only for the GNU and Clang compilers).

This commit is contained in:
Username404-59 2021-02-26 18:05:01 +01:00
parent aeafd990e4
commit ad2fcfd746
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
2 changed files with 5 additions and 5 deletions

View File

@ -6,6 +6,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "-pthread")
set(CMAKE_CXX_FLAGS_RELEASE "-Os")
if((${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) OR (${CMAKE_CXX_COMPILER_ID} STREQUAL Clang))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector -fstack-clash-protection -Wall")
endif()
if (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fira-loop-pressure -ftree-loop-distribution -floop-interchange -ftree-vectorize -fipa-pta -s")
set(CMAKE_CXX_FLAGS "-flto -fno-use-linker-plugin -fwhole-program ${CMAKE_CXX_FLAGS}")

View File

@ -18,11 +18,7 @@ pair<LANGUAGE, bool> validLanguage(const string& it) {
break;
}
}
pair<LANGUAGE, bool> result {
selected,
valid
};
return result;
return pair<LANGUAGE, bool>(selected, valid);
}
string transpile(string toTranspile, string language)