Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Mon, 1 Apr 2024 11:39:29 -0400
From: James Y Knight <jyknight@...gle.com>
To: musl@...ts.openwall.com
Cc: Denis Ovsienko <denis@...ienko.info>
Subject: Re: musl CMSG_NXTHDR() triggers a -Wsign-compare from Clang

On Fri, Mar 29, 2024 at 10:08 PM Rich Felker <dalias@...c.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.

Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.