summaryrefslogtreecommitdiffstats
path: root/openmp/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'openmp/runtime')
-rw-r--r--openmp/runtime/CMakeLists.txt9
-rw-r--r--openmp/runtime/cmake/Definitions.cmake4
-rw-r--r--openmp/runtime/src/kmp_debug.h6
3 files changed, 15 insertions, 4 deletions
diff --git a/openmp/runtime/CMakeLists.txt b/openmp/runtime/CMakeLists.txt
index e2badb51e4f..24c9dfe8a0d 100644
--- a/openmp/runtime/CMakeLists.txt
+++ b/openmp/runtime/CMakeLists.txt
@@ -173,13 +173,18 @@ else()
check_variable(cmake_build_type_lowercase "${build_type_possible_values}")
endif()
-# Allow user to choose a suffix for the installation directory, or if part of
-# LLVM build then just use LLVM_LIBDIR_SUFFIX
if(${LIBOMP_STANDALONE_BUILD})
+ # Allow user to choose a suffix for the installation directory, or if part of
+ # LLVM build then just use LLVM_LIBDIR_SUFFIX
set(LIBOMP_LIBDIR_SUFFIX "" CACHE STRING
"suffix of lib installation directory e.g., 64 => lib64")
+ # Should assertions be enabled? They are on by default, or it part of
+ # LLVM build then just use LLVM_ENABLE_ASSERTIONS
+ set(LIBOMP_ENABLE_ASSERTIONS TRUE CACHE BOOL
+ "enable assertions?")
else()
set(LIBOMP_LIBDIR_SUFFIX ${LLVM_LIBDIR_SUFFIX})
+ set(LIBOMP_ENABLE_ASSERTIONS ${LLVM_ENABLE_ASSERTIONS})
endif()
# Check valid values
diff --git a/openmp/runtime/cmake/Definitions.cmake b/openmp/runtime/cmake/Definitions.cmake
index b797e04a7d0..fe367d3520e 100644
--- a/openmp/runtime/cmake/Definitions.cmake
+++ b/openmp/runtime/cmake/Definitions.cmake
@@ -83,7 +83,9 @@ function(append_cpp_flags input_cpp_flags)
##################################
# Other conditional definitions
- append_definitions("-D KMP_USE_ASSERT")
+ if(${LIBOMP_ENABLE_ASSERTIONS})
+ append_definitions("-D KMP_USE_ASSERT")
+ endif()
append_definitions("-D KMP_DYNAMIC_LIB")
if(${STUBS_LIBRARY})
append_definitions("-D KMP_STUB")
diff --git a/openmp/runtime/src/kmp_debug.h b/openmp/runtime/src/kmp_debug.h
index 729677790e2..abc923edc64 100644
--- a/openmp/runtime/src/kmp_debug.h
+++ b/openmp/runtime/src/kmp_debug.h
@@ -42,7 +42,11 @@
#define __KMP_BUILD_ASSERT( expr, suffix ) typedef char __kmp_build_check_##suffix[ (expr) ? 1 : -1 ]
#define _KMP_BUILD_ASSERT( expr, suffix ) __KMP_BUILD_ASSERT( (expr), suffix )
-#define KMP_BUILD_ASSERT( expr ) _KMP_BUILD_ASSERT( (expr), __LINE__ )
+#ifdef KMP_USE_ASSERT
+ #define KMP_BUILD_ASSERT( expr ) _KMP_BUILD_ASSERT( (expr), __LINE__ )
+#else
+ #define KMP_BUILD_ASSERT( expr ) /* nothing to do */
+#endif
// -------------------------------------------------------------------------------------------------
// Run-time assertions.
OpenPOWER on IntegriCloud