Skip to content

compile warnings with gcc 9 #1612

Open
Open

Description

@jsteemann

Compiling jemalloc 5.2.0 with gcc-9 (9.1.0) on Ubuntu x86_64 produces the following warnings:

src/jemalloc.c:2986:7: warning: ‘__libc_calloc’ specifies less restrictive attributes than its target ‘calloc’: ‘alloc_size’, ‘leaf’, ‘malloc’, ‘nothrow’ [-Wmissing-attributes]
 2986 | void *__libc_calloc(size_t n, size_t size) PREALIAS(je_calloc);
      |       ^~~~~~~~~~~~~
In file included from include/jemalloc/internal/jemalloc_internal_decls.h:63,
                 from include/jemalloc/internal/jemalloc_preamble.h:5,
                 from src/jemalloc.c:2:
/usr/include/stdlib.h:541:14: note: ‘__libc_calloc’ target declared here
  541 | extern void *calloc (size_t __nmemb, size_t __size)
      |              ^~~~~~
src/jemalloc.c:3001:7: warning: ‘__libc_valloc’ specifies less restrictive attributes than its target ‘valloc’: ‘leaf’, ‘malloc’, ‘nothrow’ [-Wmissing-attributes]
 3001 | void *__libc_valloc(size_t size) PREALIAS(je_valloc);
      |       ^~~~~~~~~~~~~
In file included from include/jemalloc/internal/jemalloc_internal_decls.h:63,
                 from include/jemalloc/internal/jemalloc_preamble.h:5,
                 from src/jemalloc.c:2:
/usr/include/stdlib.h:572:14: note: ‘__libc_valloc’ target declared here
  572 | extern void *valloc (size_t __size) __THROW __attribute_malloc__ __wur;
      |              ^~~~~~
src/jemalloc.c:2998:7: warning: ‘__libc_realloc’ specifies less restrictive attributes than its target ‘realloc’: ‘alloc_size’, ‘leaf’, ‘nothrow’ [-Wmissing-attributes]
 2998 | void *__libc_realloc(void* ptr, size_t size) PREALIAS(je_realloc);
      |       ^~~~~~~~~~~~~~
In file included from include/jemalloc/internal/jemalloc_internal_decls.h:63,
                 from include/jemalloc/internal/jemalloc_preamble.h:5,
                 from src/jemalloc.c:2:
/usr/include/stdlib.h:549:14: note: ‘__libc_realloc’ target declared here
  549 | extern void *realloc (void *__ptr, size_t __size)
      |              ^~~~~~~
src/jemalloc.c:2995:7: warning: ‘__libc_memalign’ specifies less restrictive attributes than its target ‘memalign’: ‘malloc’, ‘nothrow’ [-Wmissing-attributes]
 2995 | void *__libc_memalign(size_t align, size_t s) PREALIAS(je_memalign);
      |       ^~~~~~~~~~~~~~~
In file included from include/jemalloc/internal/jemalloc_preamble.h:21,
                 from src/jemalloc.c:2:
include/jemalloc/internal/../jemalloc.h:83:23: note: ‘__libc_memalign’ target declared here
   83 | #  define je_memalign memalign
      |                       ^~~~~~~~
src/jemalloc.c:2885:1: note: in expansion of macro ‘je_memalign’
 2885 | je_memalign(size_t alignment, size_t size) {
      | ^~~~~~~~~~~
src/jemalloc.c:2992:7: warning: ‘__libc_malloc’ specifies less restrictive attributes than its target ‘malloc’: ‘alloc_size’, ‘leaf’, ‘malloc’, ‘nothrow’ [-Wmissing-attributes]
 2992 | void *__libc_malloc(size_t size) PREALIAS(je_malloc);
      |       ^~~~~~~~~~~~~
In file included from include/jemalloc/internal/jemalloc_internal_decls.h:63,
                 from include/jemalloc/internal/jemalloc_preamble.h:5,
                 from src/jemalloc.c:2:
/usr/include/stdlib.h:539:14: note: ‘__libc_malloc’ target declared here
  539 | extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;
      |              ^~~~~~
src/jemalloc.c:2989:6: warning: ‘__libc_free’ specifies less restrictive attributes than its target ‘free’: ‘leaf’, ‘nothrow’ [-Wmissing-attributes]
 2989 | void __libc_free(void* ptr) PREALIAS(je_free);
      |      ^~~~~~~~~~~
In file included from include/jemalloc/internal/jemalloc_internal_decls.h:63,
                 from include/jemalloc/internal/jemalloc_preamble.h:5,
                 from src/jemalloc.c:2:
/usr/include/stdlib.h:563:13: note: ‘__libc_free’ target declared here
  563 | extern void free (void *__ptr) __THROW;
      |             ^~~~
ar: `u' modifier ignored since `D' is the default (see `U')
src/jemalloc.c:2986:7: warning: ‘__libc_calloc’ specifies less restrictive attributes than its target ‘calloc’: ‘alloc_size’, ‘leaf’, ‘malloc’, ‘nothrow’ [-Wmissing-attributes]
 2986 | void *__libc_calloc(size_t n, size_t size) PREALIAS(je_calloc);
      |       ^~~~~~~~~~~~~
In file included from include/jemalloc/internal/jemalloc_internal_decls.h:63,
                 from include/jemalloc/internal/jemalloc_preamble.h:5,
                 from src/jemalloc.c:2:
/usr/include/stdlib.h:541:14: note: ‘__libc_calloc’ target declared here
  541 | extern void *calloc (size_t __nmemb, size_t __size)
      |              ^~~~~~
src/jemalloc.c:3001:7: warning: ‘__libc_valloc’ specifies less restrictive attributes than its target ‘valloc’: ‘leaf’, ‘malloc’, ‘nothrow’ [-Wmissing-attributes]
 3001 | void *__libc_valloc(size_t size) PREALIAS(je_valloc);
      |       ^~~~~~~~~~~~~
In file included from include/jemalloc/internal/jemalloc_internal_decls.h:63,
                 from include/jemalloc/internal/jemalloc_preamble.h:5,
                 from src/jemalloc.c:2:
/usr/include/stdlib.h:572:14: note: ‘__libc_valloc’ target declared here
  572 | extern void *valloc (size_t __size) __THROW __attribute_malloc__ __wur;
      |              ^~~~~~
src/jemalloc.c:2998:7: warning: ‘__libc_realloc’ specifies less restrictive attributes than its target ‘realloc’: ‘alloc_size’, ‘leaf’, ‘nothrow’ [-Wmissing-attributes]
 2998 | void *__libc_realloc(void* ptr, size_t size) PREALIAS(je_realloc);
      |       ^~~~~~~~~~~~~~
In file included from include/jemalloc/internal/jemalloc_internal_decls.h:63,
                 from include/jemalloc/internal/jemalloc_preamble.h:5,
                 from src/jemalloc.c:2:
/usr/include/stdlib.h:549:14: note: ‘__libc_realloc’ target declared here
  549 | extern void *realloc (void *__ptr, size_t __size)
      |              ^~~~~~~
src/jemalloc.c:2995:7: warning: ‘__libc_memalign’ specifies less restrictive attributes than its target ‘memalign’: ‘malloc’, ‘nothrow’ [-Wmissing-attributes]
 2995 | void *__libc_memalign(size_t align, size_t s) PREALIAS(je_memalign);
      |       ^~~~~~~~~~~~~~~
In file included from include/jemalloc/internal/jemalloc_preamble.h:21,
                 from src/jemalloc.c:2:
include/jemalloc/internal/../jemalloc.h:83:23: note: ‘__libc_memalign’ target declared here
   83 | #  define je_memalign memalign
      |                       ^~~~~~~~
src/jemalloc.c:2885:1: note: in expansion of macro ‘je_memalign’
 2885 | je_memalign(size_t alignment, size_t size) {
      | ^~~~~~~~~~~
src/jemalloc.c:2992:7: warning: ‘__libc_malloc’ specifies less restrictive attributes than its target ‘malloc’: ‘alloc_size’, ‘leaf’, ‘malloc’, ‘nothrow’ [-Wmissing-attributes]
 2992 | void *__libc_malloc(size_t size) PREALIAS(je_malloc);
      |       ^~~~~~~~~~~~~
In file included from include/jemalloc/internal/jemalloc_internal_decls.h:63,
                 from include/jemalloc/internal/jemalloc_preamble.h:5,
                 from src/jemalloc.c:2:
/usr/include/stdlib.h:539:14: note: ‘__libc_malloc’ target declared here
  539 | extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;
      |              ^~~~~~
src/jemalloc.c:2989:6: warning: ‘__libc_free’ specifies less restrictive attributes than its target ‘free’: ‘leaf’, ‘nothrow’ [-Wmissing-attributes]
 2989 | void __libc_free(void* ptr) PREALIAS(je_free);
      |      ^~~~~~~~~~~
In file included from include/jemalloc/internal/jemalloc_internal_decls.h:63,
                 from include/jemalloc/internal/jemalloc_preamble.h:5,
                 from src/jemalloc.c:2:
/usr/include/stdlib.h:563:13: note: ‘__libc_free’ target declared here
  563 | extern void free (void *__ptr) __THROW;
      |             ^~~~

Just double-checked it and this seems to happen also when compiling jemalloc 5.1.0 with gcc-9. So it is not a regression in the source but rather seems that gcc 9 is stricter than 8.

Also I am getting the following warnings from gcc 9:

src/malloc_io.c: In function ‘malloc_vsnprintf’:
src/malloc_io.c:369:2: warning: case label value exceeds maximum value for type
  369 |  case '?' | 0x80:      \
      |  ^~~~
src/malloc_io.c:581:5: note: in expansion of macro ‘GET_ARG_NUMERIC’
  581 |     GET_ARG_NUMERIC(val, 'p');
      |     ^~~~~~~~~~~~~~~
src/malloc_io.c:387:2: warning: case label value exceeds maximum value for type
  387 |  case 'j' | 0x80:      \
      |  ^~~~
src/malloc_io.c:581:5: note: in expansion of macro ‘GET_ARG_NUMERIC’
  581 |     GET_ARG_NUMERIC(val, 'p');
      |     ^~~~~~~~~~~~~~~
src/malloc_io.c:375:2: warning: case label value exceeds maximum value for type
  375 |  case 'l' | 0x80:      \
      |  ^~~~
src/malloc_io.c:581:5: note: in expansion of macro ‘GET_ARG_NUMERIC’
  581 |     GET_ARG_NUMERIC(val, 'p');
      |     ^~~~~~~~~~~~~~~
src/malloc_io.c:381:2: warning: case label value exceeds maximum value for type
  381 |  case 'q' | 0x80:      \
      |  ^~~~
src/malloc_io.c:581:5: note: in expansion of macro ‘GET_ARG_NUMERIC’
  581 |     GET_ARG_NUMERIC(val, 'p');
      |     ^~~~~~~~~~~~~~~
src/malloc_io.c:396:2: warning: case label value exceeds maximum value for type
  396 |  case 'z' | 0x80:      \
      |  ^~~~
src/malloc_io.c:581:5: note: in expansion of macro ‘GET_ARG_NUMERIC’
  581 |     GET_ARG_NUMERIC(val, 'p');
      |     ^~~~~~~~~~~~~~~

Activity

  1. added this to the 6.0 milestone on Aug 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions