Skip to content

Commit

Permalink
Properly implement the memory_termination build option
Browse files Browse the repository at this point in the history
It seems my last commit doesn't properly implement the way we
add a define to the dictionary. It seems this is the proper way
to do it instead of just calling add_definitions.
  • Loading branch information
Teemperor authored and dpiparo committed Sep 8, 2017
1 parent 0922781 commit 7fb447d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ if (JEMALLOC_FOUND)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ljemalloc -L ${JEMALLOC_LIBRARY_PATH}")
endif()

#---Add the define for the experimental deallocation code when memory_termination is on---------
if(memory_termination)
add_definitions(-DR__COMPLETE_MEM_TERMINATION)
endif()

#---Populate the configure arguments returned by 'root-config --config'-------------------------
get_cmake_property(variables CACHE_VARIABLES)
foreach(var ${variables})
Expand Down
5 changes: 5 additions & 0 deletions cmake/modules/RootConfiguration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,11 @@ if(gcctoolchain)
else()
set(setgcctoolchain undef)
endif()
if(memory_termination)
set(memory_term define)
else()
set(memory_term undef)
endif()

CHECK_CXX_SOURCE_COMPILES("#include <string_view>
int main() { char arr[3] = {'B', 'a', 'r'}; std::string_view strv(arr, sizeof(arr)); return 0;}" found_stdstringview)
Expand Down
1 change: 1 addition & 0 deletions config/RConfigure.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#@hasstdinvoke@ R__HAS_STD_INVOKE /**/
#@hasllvm@ R__EXTERN_LLVMDIR @llvmdir@
#@useimt@ R__USE_IMT /**/
#@memory_term@ R__COMPLETE_MEM_TERMINATION /**/

#if defined(R__HAS_VECCORE) && defined(R__HAS_VC)
#ifndef VECCORE_ENABLE_VC
Expand Down
5 changes: 5 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -2804,6 +2804,10 @@ if test "x$enable_cxxmodules" = "xyes"; then
fi
fi

######################################################################
# Destruct global/static variables. Always off in classic build.
memory_term="undef"

######################################################################
#
### echo %%% libc++ - compile and link using libc++
Expand Down Expand Up @@ -8188,6 +8192,7 @@ sed \
-e "s|@usec++14@|$usecxx14|" \
-e "s|@usec++17@|$usecxx17|" \
-e "s|@usecxxmodules@|$usecxxmodules|" \
-e "s|@memory_term@|$memory_term|" \
-e "s|@uselibc++@|$uselibcxx|" \
-e "s|@hasstdstringview@|$hasstdstringview|" \
-e "s|@hasstdexpstringview@|$hasstdexpstringview|" \
Expand Down

0 comments on commit 7fb447d

Please sign in to comment.