unikraft/lib-newlib

Newlib compilation throws hundreds of errors with `gcc-11`

craciunoiuc opened this issue · 1 comments

When using newlib with anything and compiling with gcc-11 hundreds of warnings are shown regarding alloc_size.

These warnings have the following format:

In file included from /home/***/.unikraft/libs/newlib/include/stdlib.h:37,
                 from /home/***/.unikraft/apps/hello-test/build/libnewlibc/origin/newlib-2.5.0.20170922/newlib/libc/argz/envz_remove.c:10:
/home/***/.unikraft/apps/hello-test/build/libnewlibc/origin/newlib-2.5.0.20170922/newlib/libc/include/stdlib.h:144:13: warning: ignoring attribute ‘alloc_size (3)’ because it conflicts with previous ‘alloc_size (2)’ [-Wattributes]
  144 |             __alloc_size(3);
      | 

This is because chained alloc_size attributes are deprecated in gcc-11.
To fix this, multiple arguments are given to alloc_size as per the documentation.

This has been fixed in newer versions of newlib. The patch that fixes this issue will no longer apply when bumping the version.

I will add these fixes as a Pull Request and link this issue.

Solved in #13