diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2020-01-23 12:49:43 +0300 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2020-01-23 12:52:37 +0300 |
commit | 8bbb5fb763547b11bb5a6738c3c3970baf4376ae (patch) | |
tree | a683fb1cee67a43a2b865eeab6dc062b680fbd77 /CMakeLists.txt | |
parent | f9818f0804e6e73ec8afcc523b7e7f8bfc362632 (diff) |
Make SmallVector noexcept.
Fixes a linting error from cppcheck where reserve() calls can throw, but
caller is marked noexcept to allow proper move semantics.
Only real place to throw would be if allocations fail, but these
allocations tend to be small, and if allocation actually fails here,
we're basically OOM anyways, so just terminate. Constructors and assignment
could also fail, but the only way that could happen is memory related in
SPIRV-Cross' case, so just terminate if that happens as well.
Also, for good measure, add missing -fno-exceptions to EXCEPTIONS_TO_ASSERTIONS
path in CMake.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 590ff9fe..a2ebb6ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,11 +75,14 @@ endif() string(TIMESTAMP spirv-cross-timestamp) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/gitversion.in.h ${CMAKE_CURRENT_BINARY_DIR}/gitversion.h @ONLY) -if(SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS) +if (SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS) set(spirv-compiler-defines ${spirv-compiler-defines} SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS) + if (NOT MSVC) + set(spirv-compiler-options ${spirv-compiler-options} -fno-exceptions) + endif() endif() -if(SPIRV_CROSS_FORCE_STL_TYPES) +if (SPIRV_CROSS_FORCE_STL_TYPES) set(spirv-compiler-defines ${spirv-compiler-defines} SPIRV_CROSS_FORCE_STL_TYPES) endif() |