Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • jakub.both/dune-common
  • samuel.burbulla/dune-common
  • patrick.jaap/dune-common
  • tobias.leibner/dune-common
  • alexander.mueller/dune-common
  • pipping/dune-common
  • Xinyun.Li/dune-common
  • felix.schindler/dune-common
  • simon.praetorius/dune-common
  • ani.anciaux-sedrakian/dune-common
  • henrik.stolzmann/dune-common
  • matthew.t.collins/dune-common
  • liam.keegan/dune-common
  • felix.mueller/dune-common
  • ansgar/dune-common
  • dominic/dune-common
  • lars.lubkoll/dune-common
  • exadune/dune-common
  • felix.gruber/dune-common
  • govind.sahai/dune-common
  • michael.sghaier/dune-common
  • core/dune-common
  • kilian.weishaupt/dune-common
  • markus.blatt/dune-common
  • joscha.podlesny/dune-common
  • tobias.meyer.andersen/dune-common
  • andreas.thune/dune-common
  • lars.bilke/dune-common
  • daniel.kienle/dune-common
  • lukas.renelt/dune-common
  • smuething/dune-common
  • stephan.hilb/dune-common
  • tkoch/dune-common
  • nils.dreier/dune-common
  • rene.milk/dune-common
  • lasse.hinrichsen/dune-common
  • yunus.sevinchan/dune-common
  • lisa_julia.nebel/dune-common
  • claus-justus.heine/dune-common
  • lorenzo.cerrone/dune-common
  • eduardo.bueno/dune-common
41 results
Show changes
Commits on Source (2)
# Master (will become release 2.8) # Master (will become release 2.8)
- Remove the cmake check for `HAVE_MPROTECT` and also do not define this variable in the
`config.h` file. It is defined only inside the header `debugallocator.hh`.
- Deprecate fallback implementations `Dune::Std::apply`, `Dune::Std::bool_constant`, and - Deprecate fallback implementations `Dune::Std::apply`, `Dune::Std::bool_constant`, and
`Dune::Std::make_array` in favor of std c++ implementations. `Dune::Std::make_array` in favor of std c++ implementations.
......
...@@ -41,7 +41,6 @@ install(FILES ...@@ -41,7 +41,6 @@ install(FILES
FindInkscape.cmake FindInkscape.cmake
FindLatexMk.cmake FindLatexMk.cmake
FindMETIS.cmake FindMETIS.cmake
FindMProtect.cmake
FindParMETIS.cmake FindParMETIS.cmake
FindPTScotch.cmake FindPTScotch.cmake
FindQuadMath.cmake FindQuadMath.cmake
......
...@@ -16,7 +16,6 @@ include(AddQuadMathFlags) ...@@ -16,7 +16,6 @@ include(AddQuadMathFlags)
# find program for image manipulation # find program for image manipulation
find_package(Inkscape) find_package(Inkscape)
include(UseInkscape) include(UseInkscape)
include(FindMProtect)
# find the threading library # find the threading library
find_package(Threads) find_package(Threads)
......
# .. cmake_module::
#
# Module that detects mprotect support
#
# Sets the following variables:
#
# * :code:`HAVE_SYS_MMAN_H`
# * :code:`HAVE_MPROTECT`
#
include(CheckIncludeFile)
check_include_file("sys/mman.h" HAVE_SYS_MMAN_H)
include(CheckCSourceCompiles)
check_c_source_compiles("
#include <sys/mman.h>
int main(void){
mprotect(0,0,PROT_NONE);
}" HAVE_MPROTECT)
...@@ -59,12 +59,6 @@ ...@@ -59,12 +59,6 @@
to facilitate activating and deactivating Vc using compile flags. */ to facilitate activating and deactivating Vc using compile flags. */
#cmakedefine HAVE_VC ENABLE_VC #cmakedefine HAVE_VC ENABLE_VC
/* Define to 1 if you have the symbol mprotect. */
#cmakedefine HAVE_MPROTECT 1
/* Define to 1 if you have <sys/mman.h>. */
#cmakedefine HAVE_SYS_MMAN_H 1
/* Define to 1 if you have the Threading Building Blocks (TBB) library */ /* Define to 1 if you have the Threading Building Blocks (TBB) library */
#cmakedefine HAVE_TBB 1 #cmakedefine HAVE_TBB 1
......
...@@ -5,13 +5,9 @@ add_subdirectory("test") ...@@ -5,13 +5,9 @@ add_subdirectory("test")
#build the library dunecommon #build the library dunecommon
if(HAVE_MPROTECT)
set(debugallocator_src "debugallocator.cc")
endif(HAVE_MPROTECT)
dune_add_library("dunecommon" dune_add_library("dunecommon"
debugalign.cc debugalign.cc
${debugallocator_src} debugallocator.cc
exceptions.cc exceptions.cc
fmatrixev.cc fmatrixev.cc
ios_state.cc ios_state.cc
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include "debugallocator.hh" #include "debugallocator.hh"
#if HAVE_MPROTECT
#include <iostream> #include <iostream>
#include <unistd.h> #include <unistd.h>
#include <cstdlib> #include <cstdlib>
...@@ -29,3 +31,5 @@ namespace Dune ...@@ -29,3 +31,5 @@ namespace Dune
} // end namespace DebugMemory } // end namespace DebugMemory
} // end namespace Dune } // end namespace Dune
#endif // HAVE_MPROTECT
...@@ -3,6 +3,12 @@ ...@@ -3,6 +3,12 @@
#ifndef DUNE_DEBUG_ALLOCATOR_HH #ifndef DUNE_DEBUG_ALLOCATOR_HH
#define DUNE_DEBUG_ALLOCATOR_HH #define DUNE_DEBUG_ALLOCATOR_HH
#if __has_include(<sys/mman.h>)
#include <sys/mman.h>
#define HAVE_SYS_MMAN_H 1
#define HAVE_MPROTECT 1
#include <dune/common/unused.hh> #include <dune/common/unused.hh>
#include <exception> #include <exception>
#include <typeinfo> #include <typeinfo>
...@@ -12,18 +18,9 @@ ...@@ -12,18 +18,9 @@
#include <cstdint> #include <cstdint>
#include <cstdlib> #include <cstdlib>
#include <new> #include <new>
#if HAVE_SYS_MMAN_H && HAVE_MPROTECT
#include <sys/mman.h>
#else
enum DummyProtFlags { PROT_NONE, PROT_WRITE, PROT_READ };
#endif
#include "mallocallocator.hh" #include "mallocallocator.hh"
#if not HAVE_MPROTECT
#error mprotect is required to use the DebugAllocator
#else
namespace Dune namespace Dune
{ {
...@@ -352,6 +349,6 @@ void operator delete(void * p, size_t size) noexcept ...@@ -352,6 +349,6 @@ void operator delete(void * p, size_t size) noexcept
#endif // DEBUG_NEW_DELETE #endif // DEBUG_NEW_DELETE
#endif // HAVE_PROTECT #endif // __has_include(<sys/mman.h>)
#endif // DUNE_DEBUG_ALLOCATOR_HH #endif // DUNE_DEBUG_ALLOCATOR_HH
...@@ -341,7 +341,6 @@ dune_add_test(SOURCES stringutilitytest.cc ...@@ -341,7 +341,6 @@ dune_add_test(SOURCES stringutilitytest.cc
dune_add_test(SOURCES testdebugallocator.cc dune_add_test(SOURCES testdebugallocator.cc
LINK_LIBRARIES dunecommon LINK_LIBRARIES dunecommon
CMAKE_GUARD HAVE_MPROTECT
LABELS quick) LABELS quick)
dune_add_test(NAME testdebugallocator_fail1 dune_add_test(NAME testdebugallocator_fail1
...@@ -349,7 +348,6 @@ dune_add_test(NAME testdebugallocator_fail1 ...@@ -349,7 +348,6 @@ dune_add_test(NAME testdebugallocator_fail1
LINK_LIBRARIES dunecommon LINK_LIBRARIES dunecommon
COMPILE_DEFINITIONS "FAILURE1;EXPECTED_SIGNAL=SIGSEGV;EXPECTED_ALT_SIGNAL=SIGBUS" COMPILE_DEFINITIONS "FAILURE1;EXPECTED_SIGNAL=SIGSEGV;EXPECTED_ALT_SIGNAL=SIGBUS"
EXPECT_FAIL EXPECT_FAIL
CMAKE_GUARD HAVE_MPROTECT
LABELS quick) LABELS quick)
dune_add_test(NAME testdebugallocator_fail2 dune_add_test(NAME testdebugallocator_fail2
...@@ -357,7 +355,6 @@ dune_add_test(NAME testdebugallocator_fail2 ...@@ -357,7 +355,6 @@ dune_add_test(NAME testdebugallocator_fail2
LINK_LIBRARIES dunecommon LINK_LIBRARIES dunecommon
COMPILE_DEFINITIONS "FAILURE2;EXPECTED_SIGNAL=SIGABRT" COMPILE_DEFINITIONS "FAILURE2;EXPECTED_SIGNAL=SIGABRT"
EXPECT_FAIL EXPECT_FAIL
CMAKE_GUARD HAVE_MPROTECT
LABELS quick) LABELS quick)
dune_add_test(NAME testdebugallocator_fail3 dune_add_test(NAME testdebugallocator_fail3
...@@ -365,7 +362,6 @@ dune_add_test(NAME testdebugallocator_fail3 ...@@ -365,7 +362,6 @@ dune_add_test(NAME testdebugallocator_fail3
LINK_LIBRARIES dunecommon LINK_LIBRARIES dunecommon
COMPILE_DEFINITIONS "FAILURE3;EXPECTED_SIGNAL=SIGABRT" COMPILE_DEFINITIONS "FAILURE3;EXPECTED_SIGNAL=SIGABRT"
EXPECT_FAIL EXPECT_FAIL
CMAKE_GUARD HAVE_MPROTECT
LABELS quick) LABELS quick)
dune_add_test(NAME testdebugallocator_fail4 dune_add_test(NAME testdebugallocator_fail4
...@@ -373,7 +369,6 @@ dune_add_test(NAME testdebugallocator_fail4 ...@@ -373,7 +369,6 @@ dune_add_test(NAME testdebugallocator_fail4
LINK_LIBRARIES dunecommon LINK_LIBRARIES dunecommon
COMPILE_DEFINITIONS "FAILURE4;DEBUG_ALLOCATOR_KEEP=1;EXPECTED_SIGNAL=SIGSEGV;EXPECTED_ALT_SIGNAL=SIGBUS" COMPILE_DEFINITIONS "FAILURE4;DEBUG_ALLOCATOR_KEEP=1;EXPECTED_SIGNAL=SIGSEGV;EXPECTED_ALT_SIGNAL=SIGBUS"
EXPECT_FAIL EXPECT_FAIL
CMAKE_GUARD HAVE_MPROTECT
LABELS quick) LABELS quick)
dune_add_test(NAME testdebugallocator_fail5 dune_add_test(NAME testdebugallocator_fail5
...@@ -381,7 +376,6 @@ dune_add_test(NAME testdebugallocator_fail5 ...@@ -381,7 +376,6 @@ dune_add_test(NAME testdebugallocator_fail5
LINK_LIBRARIES dunecommon LINK_LIBRARIES dunecommon
COMPILE_DEFINITIONS "FAILURE5;EXPECTED_SIGNAL=SIGSEGV;EXPECTED_ALT_SIGNAL=SIGBUS" COMPILE_DEFINITIONS "FAILURE5;EXPECTED_SIGNAL=SIGSEGV;EXPECTED_ALT_SIGNAL=SIGBUS"
EXPECT_FAIL EXPECT_FAIL
CMAKE_GUARD HAVE_MPROTECT
LABELS quick) LABELS quick)
dune_add_test(SOURCES testfloatcmp.cc dune_add_test(SOURCES testfloatcmp.cc
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#define DEBUG_NEW_DELETE 3 #define DEBUG_NEW_DELETE 3
#include <dune/common/debugallocator.hh> #include <dune/common/debugallocator.hh>
#if HAVE_MPROTECT
#include <iostream> #include <iostream>
#include <csignal> #include <csignal>
...@@ -88,6 +89,8 @@ void new_delete_tests() ...@@ -88,6 +89,8 @@ void new_delete_tests()
z4 = 0; z4 = 0;
} }
#endif // HAVE_MPROTECT
int main(int, char**) int main(int, char**)
{ {
#if EXPECTED_SIGNAL #if EXPECTED_SIGNAL
...@@ -97,9 +100,12 @@ int main(int, char**) ...@@ -97,9 +100,12 @@ int main(int, char**)
std::signal(EXPECTED_ALT_SIGNAL, std::_Exit); std::signal(EXPECTED_ALT_SIGNAL, std::_Exit);
#endif #endif
#if HAVE_MPROTECT
basic_tests(); basic_tests();
allocator_tests(); allocator_tests();
new_delete_tests(); new_delete_tests();
#endif
#ifdef EXPECTED_SIGNAL #ifdef EXPECTED_SIGNAL
return 1; return 1;
#else #else
......