From: Arnaud Giersch Date: Wed, 30 Jan 2019 20:41:07 +0000 (+0100) Subject: Define COVERAGE for C++ too. X-Git-Tag: v3_22~436 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b8603f92740dd11e62295146f653577f1766804a Define COVERAGE for C++ too. --- diff --git a/src/xbt/xbt_main.cpp b/src/xbt/xbt_main.cpp index dc5441573e..32ac1d2eb1 100644 --- a/src/xbt/xbt_main.cpp +++ b/src/xbt/xbt_main.cpp @@ -146,12 +146,15 @@ void xbt_free_ref(void *d) xbt_free(*(void**)d); } +#ifdef COVERAGE +extern "C" void __gcov_flush(); // used in xbt_abort() +#endif + /** @brief Kill the program in silence */ void xbt_abort() { #ifdef COVERAGE /* Call __gcov_flush on abort when compiling with coverage options. */ - extern void __gcov_flush(); __gcov_flush(); #endif #ifdef _WIN32 diff --git a/tools/cmake/Flags.cmake b/tools/cmake/Flags.cmake index 95ff1f9744..c067fd1827 100644 --- a/tools/cmake/Flags.cmake +++ b/tools/cmake/Flags.cmake @@ -193,6 +193,7 @@ if(enable_coverage) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fprofile-arcs -ftest-coverage") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOVERAGE") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") add_definitions(-fprofile-arcs -ftest-coverage) endif()