[Openmp-commits] [openmp] r239546 - Remove unused variables '__kmp_build_check_*' for non assert builds.
Jonathan Peyton
jonathan.l.peyton at intel.com
Thu Jun 11 10:36:17 PDT 2015
Author: jlpeyton
Date: Thu Jun 11 12:36:16 2015
New Revision: 239546
URL: http://llvm.org/viewvc/llvm-project?rev=239546&view=rev
Log:
Remove unused variables '__kmp_build_check_*' for non assert builds.
Add new LIBOMP_ENABLE_ASSERTIONS macro which can be set in a standalone build
or takes the value of LLVM_ENABLE_ASSERTIONS when inside llvm/projects. This
change also defines the KMP_BUILD_ASSERT() macro to do nothing when ENABLE_ASSERTIONS
is off. This means the __kmp_build_check_* types won't be defined and thus, no warnings.
http://lists.cs.uiuc.edu/pipermail/openmp-dev/2015-June/000719.html
Patch by Jack Howarth and Jonathan Peyton
Modified:
openmp/trunk/runtime/CMakeLists.txt
openmp/trunk/runtime/cmake/Definitions.cmake
openmp/trunk/runtime/src/kmp_debug.h
Modified: openmp/trunk/runtime/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/CMakeLists.txt?rev=239546&r1=239545&r2=239546&view=diff
==============================================================================
--- openmp/trunk/runtime/CMakeLists.txt (original)
+++ openmp/trunk/runtime/CMakeLists.txt Thu Jun 11 12:36:16 2015
@@ -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
Modified: openmp/trunk/runtime/cmake/Definitions.cmake
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/cmake/Definitions.cmake?rev=239546&r1=239545&r2=239546&view=diff
==============================================================================
--- openmp/trunk/runtime/cmake/Definitions.cmake (original)
+++ openmp/trunk/runtime/cmake/Definitions.cmake Thu Jun 11 12:36:16 2015
@@ -83,7 +83,9 @@ function(append_cpp_flags input_cpp_flag
##################################
# 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")
Modified: openmp/trunk/runtime/src/kmp_debug.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_debug.h?rev=239546&r1=239545&r2=239546&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_debug.h (original)
+++ openmp/trunk/runtime/src/kmp_debug.h Thu Jun 11 12:36:16 2015
@@ -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.
More information about the Openmp-commits
mailing list