Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

-Wnull-pointer-arithmetic and -Wno-gnu #54444

Closed
Assignees
AaronBallman
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconfirmedVerified by a second party
@nickdesaulniers

Description

@nickdesaulniers

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 inthis thread.

Metadata

Metadata

Assignees

Labels

clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconfirmedVerified by a second party

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp