diff options
author | Dongkyun, Son <dongkyun.s@samsung.com> | 2016-10-31 20:23:31 +0900 |
---|---|---|
committer | Jaehun Jeong <jh4u.jeong@samsung.com> | 2016-12-23 14:30:11 +0900 |
commit | 0a115c517884556a68b9ac006019066c02d2d77a (patch) | |
tree | 5a2e5add45bdada2a6a59494bd94fbf63c935a8d | |
parent | 747ac2d728bba3eb2f2f1a0ecef6a905f64a2e7a (diff) | |
download | cert-checker-0a115c517884556a68b9ac006019066c02d2d77a.tar.gz cert-checker-0a115c517884556a68b9ac006019066c02d2d77a.tar.bz2 cert-checker-0a115c517884556a68b9ac006019066c02d2d77a.zip |
fix build error by [-Werror=terminate]sandbox/jaehun77/gcc6x
Destructors are noexcept by default
As of C++11, destructors have an implicit noexcept exception-specification (unless a base class or non-static member variable has a destructor that is noexcept(false)). In practice this means that the following program behaves differently in C++11 than in C++03:
#include <stdexcept>
struct S
{
~S() { throw std::runtime_error ("oops"); }
};
int
main (void)
{
try { S s; }
catch (...) {
return 42;
}
}
While in C++03 this program returns 42, in C++11 it terminates with a call to std::terminate. By default GCC will now issue a warning for throw-expressions in noexcept functions, including destructors, that would immediately result in a call to terminate. The new warning can be disabled with -Wno-terminate. It is possible to restore the old behavior when defining the destructor like this:
~S() noexcept(false) { throw std::runtime_error ("oops"); }
Signed-off-by: Dongkyun, Son <dongkyun.s@samsung.com>
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/CMakeLists.txt | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ff70e3..d175ce1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,7 @@ SET(CMAKE_CXX_FLAGS_RELEASE "-g -std=c++0x -O2") SET(CMAKE_CXX_FLAGS_CCOV "-g -std=c++0x -O2 --coverage") # Set compiler warning flags -ADD_DEFINITIONS("-Werror") # Make all warnings into errors. +ADD_DEFINITIONS("-Werror -Wno-terminate") # Make all warnings into errors. ADD_DEFINITIONS("-Wall") # Generate all warnings ADD_DEFINITIONS("-Wextra") # Generate even more extra warnings ADD_DEFINITIONS("-fvisibility=hidden -fPIE") # Hide symbols by default diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 25a1363..be0347a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -76,6 +76,7 @@ TARGET_LINK_LIBRARIES(${TARGET_CERT_CHECKER} ${${TARGET_CERT_CHECKER}_DEP_LIBRARIES} ${TARGET_CERT_CHECKER_COMMON} -pie + -pthread ) INSTALL(TARGETS ${TARGET_CERT_CHECKER} DESTINATION ${BIN_DIR}) |