diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-10-24 07:16:46 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-10-24 10:19:14 +0200 |
commit | 522d4b9186d4a1c5b5a329f323250a90fde5d91a (patch) | |
tree | 36dade0c8d6eb7e4f34d1cc78d54608e2cf81c50 /testsuites/libtests/malloctest/init.c | |
parent | bsp/imx: Adjust workspace according to device tree (diff) | |
download | rtems-522d4b9186d4a1c5b5a329f323250a90fde5d91a.tar.bz2 |
malloctest: Hide NULL pointer from compiler
Disabling a warning does not prevent the compiler from reasoning what it
is supposed to do with a somewhat undefined function call.
Diffstat (limited to 'testsuites/libtests/malloctest/init.c')
-rw-r--r-- | testsuites/libtests/malloctest/init.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/testsuites/libtests/malloctest/init.c b/testsuites/libtests/malloctest/init.c index a775129f0d..be6f2c4755 100644 --- a/testsuites/libtests/malloctest/init.c +++ b/testsuites/libtests/malloctest/init.c @@ -1173,21 +1173,20 @@ static void test_heap_size_with_overhead(void) static void test_posix_memalign(void) { void *p1; + void **p2; size_t i; int sc; int maximumShift; /* * posix_memalign() is declared as never having a NULL first parameter. - * We need to explicitly disable this compiler warning to make this code - * warning free. + * We need to hide the NULL value from the compiler. */ - COMPILER_DIAGNOSTIC_SETTINGS_PUSH - COMPILER_DIAGNOSTIC_SETTINGS_DISABLE_NONNULL puts( "posix_memalign - NULL return pointer -- EINVAL" ); - sc = posix_memalign( NULL, 32, 8 ); + p2 = NULL; + RTEMS_OBFUSCATE_VARIABLE( p2 ); + sc = posix_memalign( p2, 32, 8 ); fatal_posix_service_status( sc, EINVAL, "posix_memalign NULL pointer" ); - COMPILER_DIAGNOSTIC_SETTINGS_POP puts( "posix_memalign - alignment of 0 -- EINVAL" ); sc = posix_memalign( &p1, 0, 8 ); |