diff options
author | Christian Strømme <christian.stromme@nokia.com> | 2011-07-12 09:09:53 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-07-12 12:28:12 +0200 |
commit | f8ad76417d2c52ef1392302e493d7a13b811915b (patch) | |
tree | e390b5323316f016ff7fe8702ed4602583c5c86d /tests/auto | |
parent | 82454b6014a7ee0b048b4db8d64a21de849d4ab9 (diff) |
Added macro to check if the malloc hooks should be volatile.
The malloc hooks changed in glibc 2.14, and are now volatile.
Note also that the malloc hooks are now marked as deprecated.
Ref:
http://sourceware.org/bugzilla/show_bug.cgi?id=11781
http://repo.or.cz/w/glibc.git/commitdiff/a33c44639a8784589c8386ac0b56baf6d0beca32
http://repo.or.cz/w/glibc.git/commitdiff/cf6bbbd701380accba8f709cf88b7bb160131e32
http://repo.or.cz/w/glibc.git/commitdiff/7d17596c198f11fa85cbcf9587443f262e63b616
Change-Id: Iab80bea7a7f5d72ac96cacd75468eefbfd9b8326
Reviewed-on: http://codereview.qt.nokia.com/1497
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/exceptionsafety_objects/oomsimulator.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/tests/auto/exceptionsafety_objects/oomsimulator.h b/tests/auto/exceptionsafety_objects/oomsimulator.h index a85a65eac5..3de181b57a 100644 --- a/tests/auto/exceptionsafety_objects/oomsimulator.h +++ b/tests/auto/exceptionsafety_objects/oomsimulator.h @@ -64,6 +64,13 @@ static void my_terminate_handler() #ifdef __GLIBC__ /* Use glibc's memory allocation hooks */ +// From glibc 2.14, the malloc hook variables are declared volatile. +// Note: The malloc hook implementation is marked as deprecated. + +#if !defined(__MALLOC_HOOK_VOLATILE) +# define __MALLOC_HOOK_VOLATILE +#endif + /* our hooks */ static void *my_malloc_hook(size_t, const void *); static void *my_realloc_hook(void *, size_t, const void *); @@ -71,16 +78,17 @@ static void *my_memalign_hook(size_t, size_t, const void *); static void my_free_hook(void *, const void *); /* original hooks. */ -static void *(*old_malloc_hook)(size_t, const void *); -static void *(*old_realloc_hook)(void *, size_t, const void *); -static void *(*old_memalign_hook)(size_t, size_t, const void *); -static void (*old_free_hook)(void *, const void *); +static void *(*__MALLOC_HOOK_VOLATILE old_malloc_hook)(size_t, const void *); +static void *(*__MALLOC_HOOK_VOLATILE old_realloc_hook)(void *, size_t, const void *); +static void *(*__MALLOC_HOOK_VOLATILE old_memalign_hook)(size_t, size_t, const void *); +static void (*__MALLOC_HOOK_VOLATILE old_free_hook)(void *, const void *); /* initializer function */ static void my_init_hook(); /* Override initialising hook from the C library. */ -void (*__malloc_initialize_hook) (void) = my_init_hook; + +void (*__MALLOC_HOOK_VOLATILE __malloc_initialize_hook) (void) = my_init_hook; static void disableHooks() { |