aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Hahnfeld <hahnjo@hahnjo.de>2019-07-30 18:37:28 +0000
committerJonas Hahnfeld <hahnjo@hahnjo.de>2019-07-30 18:37:28 +0000
commit6cbafacdcf6066b4a4073d817a66ac13cb19fddd (patch)
treee50ef2c80406bfb7df9b5d7817b111f733ae1c75
parent34b2830c8305adcd0710076127e8a817ba4ba4db (diff)
[OpenMP] Rename last file to cpp and remove LIBOMP_CFLAGS
All other files are already C++ and the build system has always passed '-x c++' for C files, effectively compiling them as C++. To stay warning free we need one fix in ittnotify_static.{c,cpp}: The variable dll_path can be written to, so it must not be const. GCC complained with -Wcast-qual and I think it's right. Differential Revision: https://reviews.llvm.org/D65285 git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@367343 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--README.rst9
-rw-r--r--runtime/CMakeLists.txt2
-rw-r--r--runtime/cmake/LibompHandleFlags.cmake12
-rw-r--r--runtime/cmake/config-ix.cmake2
-rw-r--r--runtime/src/CMakeLists.txt17
-rw-r--r--runtime/src/thirdparty/ittnotify/ittnotify_static.cpp (renamed from runtime/src/thirdparty/ittnotify/ittnotify_static.c)2
6 files changed, 11 insertions, 33 deletions
diff --git a/README.rst b/README.rst
index 900f8ad..7f747ca 100644
--- a/README.rst
+++ b/README.rst
@@ -221,9 +221,6 @@ These flags are **appended**, they do not overwrite any of the preset flags.
**LIBOMP_CPPFLAGS** = <space-separated flags>
Additional C preprocessor flags.
-**LIBOMP_CFLAGS** = <space-separated flags>
- Additional C compiler flags.
-
**LIBOMP_CXXFLAGS** = <space-separated flags>
Additional C++ compiler flags.
@@ -321,12 +318,12 @@ Advanced Builds with Various Options
$ cmake -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort -DLIBOMP_FORTRAN_MODULES=on ..
-- Have CMake find the C/C++ compiler and specify additional flags for the C
- compiler, preprocessor, and C++ compiler.
+- Have CMake find the C/C++ compiler and specify additional flags for the
+ preprocessor and C++ compiler.
.. code-blocks:: console
- $ cmake -DLIBOMP_CFLAGS='-specific-flag' -DLIBOMP_CPPFLAGS='-DNEW_FEATURE=1 -DOLD_FEATURE=0' -DLIBOMP_CXXFLAGS='--one-specific-flag --two-specific-flag' ..
+ $ cmake -DLIBOMP_CPPFLAGS='-DNEW_FEATURE=1 -DOLD_FEATURE=0' -DLIBOMP_CXXFLAGS='--one-specific-flag --two-specific-flag' ..
- Build the stubs library
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
index f74fbaf..14490c6 100644
--- a/runtime/CMakeLists.txt
+++ b/runtime/CMakeLists.txt
@@ -97,8 +97,6 @@ if(NOT DEFINED CMAKE_MACOSX_RPATH)
endif()
# User specified flags. These are appended to the configured flags.
-set(LIBOMP_CFLAGS "" CACHE STRING
- "Appended user specified C compiler flags.")
set(LIBOMP_CXXFLAGS "" CACHE STRING
"Appended user specified C++ compiler flags.")
set(LIBOMP_CPPFLAGS "" CACHE STRING
diff --git a/runtime/cmake/LibompHandleFlags.cmake b/runtime/cmake/LibompHandleFlags.cmake
index 030e6f0..3da7efa 100644
--- a/runtime/cmake/LibompHandleFlags.cmake
+++ b/runtime/cmake/LibompHandleFlags.cmake
@@ -74,18 +74,6 @@ function(libomp_get_c_and_cxxflags_common flags)
set(${flags} ${flags_local} PARENT_SCOPE)
endfunction()
-# C compiler flags
-function(libomp_get_cflags cflags)
- set(cflags_local)
- libomp_get_c_and_cxxflags_common(cflags_local)
- # flags only for the C Compiler
- libomp_append(cflags_local /TP LIBOMP_HAVE_TP_FLAG)
- libomp_append(cflags_local "-x c++" LIBOMP_HAVE_X_CPP_FLAG)
- set(cflags_local ${cflags_local} ${LIBOMP_CFLAGS})
- libomp_setup_flags(cflags_local)
- set(${cflags} ${cflags_local} PARENT_SCOPE)
-endfunction()
-
# C++ compiler flags
function(libomp_get_cxxflags cxxflags)
set(cxxflags_local)
diff --git a/runtime/cmake/config-ix.cmake b/runtime/cmake/config-ix.cmake
index c08a912..e0a5e68 100644
--- a/runtime/cmake/config-ix.cmake
+++ b/runtime/cmake/config-ix.cmake
@@ -48,7 +48,6 @@ endfunction()
# Checking C, CXX, Linker Flags
check_cxx_compiler_flag(-fno-exceptions LIBOMP_HAVE_FNO_EXCEPTIONS_FLAG)
check_cxx_compiler_flag(-fno-rtti LIBOMP_HAVE_FNO_RTTI_FLAG)
-check_c_compiler_flag("-x c++" LIBOMP_HAVE_X_CPP_FLAG)
check_cxx_compiler_flag(-Wcast-qual LIBOMP_HAVE_WCAST_QUAL_FLAG)
check_c_compiler_flag(-Wunused-function LIBOMP_HAVE_WNO_UNUSED_FUNCTION_FLAG)
check_c_compiler_flag(-Wunused-local-typedef LIBOMP_HAVE_WNO_UNUSED_LOCAL_TYPEDEF_FLAG)
@@ -74,7 +73,6 @@ libomp_check_architecture_flag(-m32 LIBOMP_HAVE_M32_FLAG)
if(WIN32)
if(MSVC)
# Check Windows MSVC style flags.
- check_c_compiler_flag(/TP LIBOMP_HAVE_TP_FLAG)
check_cxx_compiler_flag(/EHsc LIBOMP_HAVE_EHSC_FLAG)
check_cxx_compiler_flag(/GS LIBOMP_HAVE_GS_FLAG)
check_cxx_compiler_flag(/Oy- LIBOMP_HAVE_Oy__FLAG)
diff --git a/runtime/src/CMakeLists.txt b/runtime/src/CMakeLists.txt
index 7956ae0..a5654d6 100644
--- a/runtime/src/CMakeLists.txt
+++ b/runtime/src/CMakeLists.txt
@@ -31,7 +31,7 @@ add_custom_command(
# Set the -D definitions for all sources
# UNICODE and _UNICODE are set in LLVM's CMake system. They affect the
-# ittnotify code and should only be set when compiling ittnotify_static.c
+# ittnotify code and should only be set when compiling ittnotify_static.cpp
# on Windows (done below).
# TODO: Fix the UNICODE usage in ittnotify code for Windows.
remove_definitions(-DUNICODE -D_UNICODE)
@@ -51,11 +51,10 @@ if(${LIBOMP_USE_HWLOC})
endif()
# Getting correct source files to build library
-set(LIBOMP_CFILES)
set(LIBOMP_CXXFILES)
set(LIBOMP_ASMFILES)
-if(${STUBS_LIBRARY})
- set(LIBOMP_CFILES kmp_stub.cpp)
+if(STUBS_LIBRARY)
+ set(LIBOMP_CXXFILES kmp_stub.cpp)
else()
# Get C++ files
set(LIBOMP_CXXFILES
@@ -93,7 +92,7 @@ else()
libomp_append(LIBOMP_CXXFILES kmp_gsupport.cpp)
libomp_append(LIBOMP_ASMFILES z_Linux_asm.S) # Unix assembly file
endif()
- libomp_append(LIBOMP_CFILES thirdparty/ittnotify/ittnotify_static.c LIBOMP_USE_ITT_NOTIFY)
+ libomp_append(LIBOMP_CXXFILES thirdparty/ittnotify/ittnotify_static.cpp LIBOMP_USE_ITT_NOTIFY)
libomp_append(LIBOMP_CXXFILES kmp_debugger.cpp LIBOMP_USE_DEBUGGER)
libomp_append(LIBOMP_CXXFILES kmp_stats.cpp LIBOMP_STATS)
libomp_append(LIBOMP_CXXFILES kmp_stats_timing.cpp LIBOMP_STATS)
@@ -107,16 +106,14 @@ libomp_append(LIBOMP_CXXFILES kmp_version.cpp)
libomp_append(LIBOMP_CXXFILES ompt-general.cpp IF_TRUE LIBOMP_OMPT_SUPPORT)
libomp_append(LIBOMP_CXXFILES tsan_annotations.cpp IF_TRUE LIBOMP_TSAN_SUPPORT)
-set(LIBOMP_SOURCE_FILES ${LIBOMP_CFILES} ${LIBOMP_CXXFILES} ${LIBOMP_ASMFILES})
+set(LIBOMP_SOURCE_FILES ${LIBOMP_CXXFILES} ${LIBOMP_ASMFILES})
# For Windows, there is a resource file (.rc -> .res) that is also compiled
libomp_append(LIBOMP_SOURCE_FILES libomp.rc WIN32)
# Get compiler and assembler flags
-libomp_get_cflags(LIBOMP_CONFIGURED_CFLAGS)
libomp_get_cxxflags(LIBOMP_CONFIGURED_CXXFLAGS)
libomp_get_asmflags(LIBOMP_CONFIGURED_ASMFLAGS)
# Set the compiler flags for each type of source
-set_source_files_properties(${LIBOMP_CFILES} PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_CFLAGS}")
set_source_files_properties(${LIBOMP_CXXFILES} PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_CXXFLAGS}")
set_source_files_properties(${LIBOMP_ASMFILES} PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_ASMFLAGS}")
# Let the compiler handle the assembly files on Unix-like systems
@@ -191,12 +188,12 @@ if(WIN32)
libomp_append(LIBOMP_MASM_DEFINITIONS "-DOMPT_SUPPORT" IF_TRUE_1_0 LIBOMP_OMPT_SUPPORT)
libomp_list_to_string("${LIBOMP_MASM_DEFINITIONS}" LIBOMP_MASM_DEFINITIONS)
set_property(SOURCE z_Windows_NT-586_asm.asm APPEND_STRING PROPERTY COMPILE_FLAGS " ${LIBOMP_MASM_DEFINITIONS}")
- set_source_files_properties(thirdparty/ittnotify/ittnotify_static.c PROPERTIES COMPILE_DEFINITIONS "UNICODE")
+ set_source_files_properties(thirdparty/ittnotify/ittnotify_static.cpp PROPERTIES COMPILE_DEFINITIONS "UNICODE")
# Create Windows import library
# the import library is "re-linked" to include kmp_import.cpp which prevents
# linking of both Visual Studio OpenMP and newly built OpenMP
- set_source_files_properties(kmp_import.cpp PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_CFLAGS}")
+ set_source_files_properties(kmp_import.cpp PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_CXXFLAGS}")
set(LIBOMP_IMP_LIB_FILE ${LIBOMP_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX})
set(LIBOMP_GENERATED_IMP_LIB_FILENAME ${LIBOMP_LIB_FILE}${CMAKE_STATIC_LIBRARY_SUFFIX})
set_target_properties(omp PROPERTIES
diff --git a/runtime/src/thirdparty/ittnotify/ittnotify_static.c b/runtime/src/thirdparty/ittnotify/ittnotify_static.cpp
index a2a73ad..c771ae8 100644
--- a/runtime/src/thirdparty/ittnotify/ittnotify_static.c
+++ b/runtime/src/thirdparty/ittnotify/ittnotify_static.cpp
@@ -226,7 +226,7 @@ static __itt_api_info api_list[] = {
#pragma warning(pop)
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
-static const char dll_path[PATH_MAX] = { 0 };
+static char dll_path[PATH_MAX] = { 0 };
/* static part descriptor which handles. all notification api attributes. */
__itt_global _N_(_ittapi_global) = {