Changeset 163519a0 in rtems


Ignore:
Timestamp:
Nov 19, 2014, 7:57:37 PM (5 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master
Children:
bc95f816
Parents:
a5201ea
git-author:
Joel Sherrill <joel.sherrill@…> (11/19/14 19:57:37)
git-committer:
Joel Sherrill <joel.sherrill@…> (11/20/14 18:57:33)
Message:

libtests/malloctest/init.c: Fix warning

posix_memalign() is prototyped to take a non-NULL parameter. But our
test is deliberately passing one in. With the -Wnon-null warning flag
enabled, we will always get warnings on this test unless we disable
that warning for this single test case.

Location:
testsuites
Files:
2 edited

Legend:

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

    ra5201ea r163519a0  
    1 /*  Init
    2  *
    3  *  This routine is the initialization task for this test program.
    4  *  It is a user initialization task and has the responsibility for creating
    5  *  and starting the tasks that make up the test.  If the time of day
    6  *  clock is required for the test, it should also be set to a known
    7  *  value by this function.
    8  *
    9  *  Input parameters:
    10  *    argument - task argument
    11  *
    12  *  Output parameters:  NONE
    13  *
    14  *  COPYRIGHT (c) 1989-2011.
     1/*
     2 *  COPYRIGHT (c) 1989-2011, 2014.
    153 *  On-Line Applications Research Corporation (OAR).
    164 *
     
    11891177  int maximumShift;
    11901178
     1179  /*
     1180   * posix_memalign() is declared as never having a NULL first parameter.
     1181   * We need to explicitly disable this compiler warning to make this code
     1182   * warning free.
     1183   */
     1184  COMPILER_DIAGNOSTIC_SETTINGS_PUSH
     1185  COMPILER_DIAGNOSTIC_SETTINGS_DISABLE_NONNULL
    11911186  puts( "posix_memalign - NULL return pointer -- EINVAL" );
    11921187  sc = posix_memalign( NULL, 32, 8 );
    11931188  fatal_posix_service_status( sc, EINVAL, "posix_memalign NULL pointer" );
     1189  COMPILER_DIAGNOSTIC_SETTINGS_POP
    11941190
    11951191  puts( "posix_memalign - alignment of 0 -- EINVAL" );
  • testsuites/support/include/tmacros.h

    ra5201ea r163519a0  
    1 /*  tmacros.h
     1/**
     2 * @file
    23 *
    3  *  This include file contains macros which are useful in the RTEMS
    4  *  test suites.
    5  *
    6  *  COPYRIGHT (c) 1989-2009.
     4 * This include file contains macros which are useful in the RTEMS
     5 * test suites.
     6 */
     7
     8/*
     9 *  COPYRIGHT (c) 1989-2014.
    710 *  On-Line Applications Research Corporation (OAR).
    811 *
     
    298301#define PRIxino_t "lx"
    299302
     303/**
     304 * This assists in clearly disabling warnings on GCC in certain very
     305 * specific cases.
     306 *
     307 * + -Wnon-null - If a method is declared as never having a NULL first
     308 *   parameter. We need to explicitly disable this compiler warning to make
     309 *   the code warning free.
     310 */
     311#ifdef __GNUC__
     312  #define COMPILER_DIAGNOSTIC_SETTINGS_PUSH _Pragma("GCC diagnostic push")
     313  #define COMPILER_DIAGNOSTIC_SETTINGS_POP _Pragma("GCC diagnostic pop")
     314  #define COMPILER_DIAGNOSTIC_SETTINGS_DISABLE_NONNULL \
     315    _Pragma("GCC diagnostic ignored \"-Wnonnull\"")
     316#else
     317  #define COMPILER_DIAGNOSTIC_SETTINGS_PUSH
     318  #define COMPILER_DIAGNOSTIC_SETTINGS_POP
     319  #define COMPILER_DIAGNOSTIC_SETTINGS_DISABLE_NONNULL
     320#endif
     321
    300322#ifdef __cplusplus
    301323}
Note: See TracChangeset for help on using the changeset viewer.