Changeset 19799fb in rtems


Ignore:
Timestamp:
Mar 9, 2015, 12:52:49 PM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
8552df6
Parents:
bf11690
Message:

libtests/stringto01: Fix for GCC 5.0

Location:
testsuites/libtests/stringto01
Files:
2 edited

Legend:

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

    rbf11690 r19799fb  
    2626#define __STRING(x)     #x              /* stringify without expanding x */
    2727#define __XSTRING(x)    __STRING(x)     /* expand x, then stringify */
     28
     29static int get_base_10_or_16(const char *s)
     30{
     31  return (s[0] == '0' && s[1] == 'x') ? 16 : 10;
     32}
    2833
    2934/* c99 has LLONG_MAX instead of LONG_LONG_MAX */
  • testsuites/libtests/stringto01/stringto_test_template.h

    rbf11690 r19799fb  
    4141  );
    4242  #if defined(STRING_TO_INTEGER)
    43     status = STRING_TO_NAME_METHOD( GOOD_VALUE_STRING, NULL, &endptr, 10 );
     43    status = STRING_TO_NAME_METHOD( GOOD_VALUE_STRING, NULL, &endptr,
     44        get_base_10_or_16( GOOD_VALUE_STRING ) );
    4445  #elif defined(STRING_TO_POINTER) || defined(STRING_TO_FLOAT)
    4546    status = STRING_TO_NAME_METHOD( GOOD_VALUE_STRING, NULL, &endptr );
     
    5354  );
    5455  #if defined(STRING_TO_INTEGER)
    55     status = STRING_TO_NAME_METHOD( GOOD_VALUE_STRING, &value, NULL, 10 );
     56    status = STRING_TO_NAME_METHOD( GOOD_VALUE_STRING, &value, NULL,
     57        get_base_10_or_16( GOOD_VALUE_STRING ) );
    5658  #elif defined(STRING_TO_POINTER) || defined(STRING_TO_FLOAT)
    5759    status = STRING_TO_NAME_METHOD( GOOD_VALUE_STRING, &value, NULL );
     
    6870    );
    6971    #if defined(STRING_TO_INTEGER)
    70       status = STRING_TO_NAME_METHOD(
    71         STRING_TO_MAX_STRING, &value, &endptr, 10 );
     72      status = STRING_TO_NAME_METHOD( STRING_TO_MAX_STRING, &value, &endptr,
     73          get_base_10_or_16( STRING_TO_MAX_STRING ) );
    7274    #elif defined(STRING_TO_POINTER) || defined(STRING_TO_FLOAT)
    7375      status = STRING_TO_NAME_METHOD( STRING_TO_MAX_STRING, &value, &endptr );
     
    8587  );
    8688  #if defined(STRING_TO_INTEGER)
    87     status = STRING_TO_NAME_METHOD( GOOD_VALUE_STRING, &value, &endptr, 10 );
     89    status = STRING_TO_NAME_METHOD( GOOD_VALUE_STRING, &value, &endptr,
     90        get_base_10_or_16( GOOD_VALUE_STRING ) );
    8891  #elif defined(STRING_TO_POINTER) || defined(STRING_TO_FLOAT)
    8992    status = STRING_TO_NAME_METHOD( GOOD_VALUE_STRING, &value, &endptr );
     
    100103  );
    101104  #if defined(STRING_TO_INTEGER)
    102     status = STRING_TO_NAME_METHOD( BAD_VALUE_STRING, &value, &endptr, 10 );
     105    status = STRING_TO_NAME_METHOD( BAD_VALUE_STRING, &value, &endptr,
     106        get_base_10_or_16( BAD_VALUE_STRING ) );
    103107  #elif defined(STRING_TO_POINTER) || defined(STRING_TO_FLOAT)
    104108    status = STRING_TO_NAME_METHOD( BAD_VALUE_STRING, &value, &endptr );
     
    115119  );
    116120  #if defined(STRING_TO_INTEGER)
    117     status = STRING_TO_NAME_METHOD( "", &value, &endptr, 10 );
     121    status = STRING_TO_NAME_METHOD( "", &value, &endptr,
     122        get_base_10_or_16( "" ) );
    118123  #elif defined(STRING_TO_POINTER) || defined(STRING_TO_FLOAT)
    119124    status = STRING_TO_NAME_METHOD( "", &value, &endptr );
     
    130135    STRING_TO_NAME_METHOD_STRING " - overflow - RTEMS_INVALID_NUMBER" );
    131136    #if defined(STRING_TO_INTEGER)
    132       status = STRING_TO_NAME_METHOD(
    133                  TEST_TOO_LARGE_STRING, &value, &endptr, 10 );
     137      status = STRING_TO_NAME_METHOD( TEST_TOO_LARGE_STRING, &value, &endptr,
     138          get_base_10_or_16( TEST_TOO_LARGE_STRING ) );
    134139    #elif defined(STRING_TO_POINTER) || defined(STRING_TO_FLOAT)
    135140      status = STRING_TO_NAME_METHOD( TEST_TOO_LARGE_STRING, &value, &endptr );
     
    149154    STRING_TO_NAME_METHOD_STRING " - overflow - RTEMS_INVALID_NUMBER" );
    150155    #if defined(STRING_TO_INTEGER)
    151       status = STRING_TO_NAME_METHOD(
    152                  TEST_TOO_LARGE_FOR_UCHAR, &value, &endptr, 10 );
     156      status = STRING_TO_NAME_METHOD( TEST_TOO_LARGE_FOR_UCHAR, &value,
     157          &endptr, get_base_10_or_16( TEST_TOO_LARGE_FOR_UCHAR ) );
    153158    #endif
    154159    if ( status != RTEMS_INVALID_NUMBER )
     
    164169    puts( STRING_TO_NAME_METHOD_STRING "- RTEMS_INVALID_NUMBER" );
    165170    #if defined(STRING_TO_INTEGER)
    166       status = STRING_TO_NAME_METHOD(
    167                  TEST_TOO_SMALL_STRING, &value, &endptr, 10 );
     171      status = STRING_TO_NAME_METHOD( TEST_TOO_SMALL_STRING, &value, &endptr,
     172          get_base_10_or_16( TEST_TOO_SMALL_STRING ) );
    168173    #elif defined(STRING_TO_POINTER) || defined(STRING_TO_FLOAT)
    169174      status = STRING_TO_NAME_METHOD( TEST_TOO_SMALL_STRING, &value, &endptr );
Note: See TracChangeset for help on using the changeset viewer.