CMakeLists: Fix REACTOR_EMIT_DEBUG_INFO builds
ENABLE_RR_DEBUG_INFO was not being passed to the ReactorLLVM target.
This introduced a subtle calling mismatch as the RValue<T> copy constructor is conditionally added only when ENABLE_RR_DEBUG_INFO is defined.
This would cause parameters to go out of sync for inlined functions (not entirely sure I understand the underlying cause here), leading to hilarity.
This change also moves "-fno-exceptions" back to the global cpp_flags. This is a true global setting and should not have been moved to SWIFTSHADER_COMPILE_OPTIONS.
Change-Id: Ib20777f1ee4b443358ada667902f9a6a1ac3513a
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/29932
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cfbad8e..d6df879 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -229,8 +229,9 @@
add_definitions(-D_SBCS) # Single Byte Character Set (ASCII)
else()
set_cpp_flag("--std=c++11")
+ set_cpp_flag("-fno-exceptions")
+
list(APPEND SWIFTSHADER_COMPILE_OPTIONS
- "-fno-exceptions"
"-Wall"
"-Werror=reorder"
"-Werror=sign-compare"
@@ -1883,6 +1884,7 @@
INCLUDE_DIRECTORIES "${COMMON_INCLUDE_DIR}"
POSITION_INDEPENDENT_CODE 1
FOLDER "Core"
+ COMPILE_OPTIONS "${SWIFTSHADER_COMPILE_OPTIONS}"
)
target_link_libraries(ReactorLLVM llvm ${OS_LIBS})
diff --git a/src/Reactor/LLVMReactor.cpp b/src/Reactor/LLVMReactor.cpp
index 643ef05..ccee399 100644
--- a/src/Reactor/LLVMReactor.cpp
+++ b/src/Reactor/LLVMReactor.cpp
@@ -26,6 +26,13 @@
#undef min
#undef max
+#if defined(__clang__)
+// LLVM has occurances of the extra-semi warning in its headers, which will be
+// treated as an error in SwiftShader targets.
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wextra-semi"
+#endif // defined(__clang__)
+
#include "llvm/Analysis/LoopPass.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include "llvm/ExecutionEngine/JITSymbol.h"
@@ -52,6 +59,10 @@
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Scalar/GVN.h"
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif // defined(__clang__)
+
#include "LLVMRoutine.hpp"
#define ARGS(...) {__VA_ARGS__}