A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/llvm/llvm-project/issues/54444 below:

-Wnull-pointer-arithmetic and -Wno-gnu · Issue #54444 · llvm/llvm-project · GitHub

The following code w/ ToT LLVM (clang-15) produces the following warnings:

void *x(void) {
    return (char*)0 + 42;
}

void *y(void) {
    return (void*)0 + 42;
}
<source>:2:21: warning: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Wnull-pointer-arithmetic]
    return (char*)0 + 42;
           ~~~~~~~~ ^
<source>:6:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
    return (void*)0 + 42;
           ~~~~~~~~ ^

for the Linux kernel, we're using -std=gnu11 -Wno-gnu, so we should not be observing ANY warnings that we're using GNU C extensions.

I suspect that these two checks should be split into two different named command line flags, such that the one pertaining to GNU C extensions is placed within the -Wgnu flag group, such that -Wno-gnu implicitly disables it.

cc @AaronBallman @andykaylor

(link #4440)

As reported in this thread.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4