Handle THROW macro in its own scope.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2021-08-22 11:35:08 +02:00
parent a0488d7078
commit ec3c8e7701
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 11 additions and 4 deletions

View File

@ -5,7 +5,12 @@ project(Arbutils)
add_compile_options(-Wall -Wextra -Werror)
# We like new stuff, so set the c++ standard to c++20.
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if (NOT WINDOWS)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
else()
set(CMAKE_POSITION_INDEPENDENT_CODE OFF)
endif()
option(WINDOWS "Whether the build target is Windows or not." OFF)
option(SHARED "Whether we should build a shared library, instead of a static one." OFF)

View File

@ -152,9 +152,11 @@ static consteval const char* file_name(const char* path) {
}
#define THROW(message) \
std::stringstream ___ss; \
___ss << "[" << file_name(__FILE__) << ":" << __LINE__ << "] " << message; \
throw ArbUt::Exception(___ss.str());
{ \
std::stringstream ___ss; \
___ss << "[" << file_name(__FILE__) << ":" << __LINE__ << "] " << message; \
throw ArbUt::Exception(___ss.str()); \
}
#define NOT_REACHABLE THROW("Not reachable");
#define NOT_IMPLEMENTED THROW("Not implemented");