On Fri, Mar 29, 2024 at 10:08 PM Rich Felker <dalias@libc.org> wrote:
It's not clear to me why clang
(ang gcc?) fail to suppress this as coming from -isystem. Clearly they
now where the macro was expanded from; it's even in the above message.

 
Clang and GCC suppress diagnostics in system headers, but as a general rule, do not suppress diagnostics arising from expanding macros which were defined in system headers. There are special cases for some diagnostics, but this is not one of them in Clang.

As an example with a different diagnostic, the following triggers -Wincompatible-pointer-types for the definition of "z", but not "y", in both GCC and Clang:

// System header "test.h"
int yy;
float *y = &yy;
#define FOO float *z = &yy;

// User file "test.c"
#include <test.h>
FOO

If there's no path forward on getting compilers not to do this, maybe
we should look into working around the warning this one time? :/ 
 
 Inserting an explicit cast in the musl macro would seem appropriate here.