diff --git a/src/system/libroot/posix/malloc_debug/Jamfile b/src/system/libroot/posix/malloc_debug/Jamfile index ce2d68a298..903167d934 100644 --- a/src/system/libroot/posix/malloc_debug/Jamfile +++ b/src/system/libroot/posix/malloc_debug/Jamfile @@ -7,6 +7,10 @@ for architectureObject in [ MultiArchSubDirSetup ] { on $(architectureObject) { local architecture = $(TARGET_PACKAGING_ARCH) ; + if $(architecture) != x86_gcc2 { + SubDirC++Flags -std=gnu++11 ; + } + UsePrivateSystemHeaders ; MergeObject <$(architecture)>posix_malloc_debug.o : diff --git a/src/system/libroot/posix/malloc_debug/guarded_heap.cpp b/src/system/libroot/posix/malloc_debug/guarded_heap.cpp index 1e0bd70d48..5084e2c7bc 100644 --- a/src/system/libroot/posix/malloc_debug/guarded_heap.cpp +++ b/src/system/libroot/posix/malloc_debug/guarded_heap.cpp @@ -19,7 +19,14 @@ static bool sDebuggerCalls = true; + +#if __cplusplus >= 201103L +#include +using namespace std; +static size_t sDefaultAlignment = alignof(max_align_t); +#else static size_t sDefaultAlignment = 0; +#endif static void @@ -950,7 +957,7 @@ __init_heap_post_env(void) const char *argument = strchr(mode, 'a'); if (argument != NULL && sscanf(argument, "a%" B_SCNuSIZE, &defaultAlignment) == 1 - && defaultAlignment > 0) { + && defaultAlignment >= 0) { heap_debug_set_default_alignment(defaultAlignment); } } diff --git a/src/system/libroot/posix/malloc_debug/heap.cpp b/src/system/libroot/posix/malloc_debug/heap.cpp index 1b735b59ac..533a42b268 100644 --- a/src/system/libroot/posix/malloc_debug/heap.cpp +++ b/src/system/libroot/posix/malloc_debug/heap.cpp @@ -44,7 +44,14 @@ static bool sParanoidValidation = false; static thread_id sWallCheckThread = -1; static bool sStopWallChecking = false; static bool sUseGuardPage = false; -static bool sDefaultAlignment = 0; + +#if __cplusplus >= 201103L +#include +using namespace std; +static size_t sDefaultAlignment = alignof(max_align_t); +#else +static size_t sDefaultAlignment = 0; +#endif void @@ -1852,7 +1859,7 @@ __init_heap_post_env(void) const char *argument = strchr(mode, 'a'); if (argument != NULL && sscanf(argument, "a%" B_SCNuSIZE, &defaultAlignment) == 1 - && defaultAlignment > 0) { + && defaultAlignment >= 0) { heap_debug_set_default_alignment(defaultAlignment); } }