Changeset 522d4b91 in rtems for testsuites


Ignore:
Timestamp:
Oct 24, 2018, 5:16:46 AM (14 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
c1ce9a2
Parents:
01595a4
git-author:
Sebastian Huber <sebastian.huber@…> (10/24/18 05:16:46)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/24/18 08:19:14)
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/libtests/malloctest/init.c

    r01595a4 r522d4b91  
    11741174{
    11751175  void *p1;
     1176  void **p2;
    11761177  size_t i;
    11771178  int sc;
     
    11801181  /*
    11811182   * posix_memalign() is declared as never having a NULL first parameter.
    1182    * We need to explicitly disable this compiler warning to make this code
    1183    * warning free.
     1183   * We need to hide the NULL value from the compiler.
    11841184   */
    1185   COMPILER_DIAGNOSTIC_SETTINGS_PUSH
    1186   COMPILER_DIAGNOSTIC_SETTINGS_DISABLE_NONNULL
    11871185  puts( "posix_memalign - NULL return pointer -- EINVAL" );
    1188   sc = posix_memalign( NULL, 32, 8 );
     1186  p2 = NULL;
     1187  RTEMS_OBFUSCATE_VARIABLE( p2 );
     1188  sc = posix_memalign( p2, 32, 8 );
    11891189  fatal_posix_service_status( sc, EINVAL, "posix_memalign NULL pointer" );
    1190   COMPILER_DIAGNOSTIC_SETTINGS_POP
    11911190
    11921191  puts( "posix_memalign - alignment of 0 -- EINVAL" );
Note: See TracChangeset for help on using the changeset viewer.