unikraft / lib-newlib

Unikraft port of newlib, a C standard library
Other
5 stars 23 forks source link

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

Closed craciunoiuc closed 2 years ago

craciunoiuc commented 3 years ago

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.

razvand commented 2 years ago

Solved in #13