]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
jemalloc: pick from upstream: Fix GCC-9.1 warning with macro GET_ARG_NUMERIC
authorrlibby <rlibby@FreeBSD.org>
Sat, 21 Dec 2019 02:44:38 +0000 (02:44 +0000)
committerrlibby <rlibby@FreeBSD.org>
Sat, 21 Dec 2019 02:44:38 +0000 (02:44 +0000)
commit74478f4b92aa78816c7a4f64f516fc9a802c2afc
tree407a255b86d778e5a42fdf8c47e2a0f168018595
parentcac2d671d4b632885c3b6d3cc5381703e2e713aa
jemalloc: pick from upstream: Fix GCC-9.1 warning with macro GET_ARG_NUMERIC

Pick 2d6d099fed05b1509e81e54458516528bfbbf38d from upstream jemalloc:

    Fix GCC-9.1 warning with macro GET_ARG_NUMERIC

    GCC-9.1 reports following error when trying to compile file
    src/malloc_io.c and with CFLAGS='-Werror' :

    src/malloc_io.c: In function ‘malloc_vsnprintf’:
    src/malloc_io.c:369:2: error: case label value exceeds maximum value for type [-Werror]
      369 |  case '?' | 0x80:      \
          |  ^~~~
    src/malloc_io.c:581:5: note: in expansion of macro ‘GET_ARG_NUMERIC’
      581 |     GET_ARG_NUMERIC(val, 'p');
          |     ^~~~~~~~~~~~~~~
    ...
    <snip>
    cc1: all warnings being treated as errors
    make: *** [Makefile:388: src/malloc_io.sym.o] Error 1

    The warning is reported as by default the type 'char' is 'signed char'
    and or-ing 0x80 will turn the case label char negative which will be
    beyond the printable ascii range (0 - 127).

    The patch fixes this by explicitly casting the 'len' variable as
    unsigned char' inside the 'switch' statement so that value of
    expression " '?' | 0x80 " falls within the legal values of the
    variable 'len'.

Discussed with: jasone (maintainer)
Sponsored by: Dell EMC Isilon
contrib/jemalloc/src/malloc_io.c