-
Notifications
You must be signed in to change notification settings - Fork 13.4k
-Wnull-pointer-arithmetic and -Wno-gnu #54444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
See https://reviews.llvm.org/D37042 for why this warning exists in its current form. |
Handling this is beyond my knowledge of the front end diagnostics infrastructure. I had even forgotten that I was the person who added this warning. Based on the discussion in the review, it sounds like marking the warning specifically as a GNU extension will cause it to be an error with -pedantic-errors, but not doing so is the reason it isn't suppressed by -Wno-gnu. Is that right? @AaronBallman Can you help with this? |
I think the issue is that the GNU extension diagnostic was added to the |
This should now be fixed in c3fe8dd. |
Clang 15 changes the behaviour of -Wnull-pointer-arithmetics to control -Wgnu-null-pointer-arithmetics either. Since uJIT is built with -Wextra (including -Wnull-pointer-arithmetics) and -Werror flags being set in CMAKE_C_FLAGS list, compilation of src/utils/lj_alloc.c fails due to NULL pointer arithmetics in TOP_FOOT_SIZE constant definition. Furthermore, -Wno-gnu flag to silence GNU extension diagnostics for pointer arithmetic is allowed since Clang 15 (llvm/llvm-project#54444). Considering everything above, tweak the CMAKE_C_FLAGS list for Clang toolchain only for Clang 15.0.0 and later. It's worth to mention, that fixing the root cause of the warning is also an option to fix the issue, but it's better to be in sync with the LuaJIT upstream at this point Signed-off-by: Igor Munkin <[email protected]>
Clang 15 changes the behaviour of -Wnull-pointer-arithmetics to control -Wgnu-null-pointer-arithmetics either. Since uJIT is built with -Wextra (including -Wnull-pointer-arithmetics) and -Werror flags being set in CMAKE_C_FLAGS list, compilation of src/utils/lj_alloc.c fails due to NULL pointer arithmetics in TOP_FOOT_SIZE constant definition. Furthermore, -Wno-gnu flag to silence GNU extension diagnostics for pointer arithmetic is allowed since Clang 15 (llvm/llvm-project#54444). Considering everything above, tweak the CMAKE_C_FLAGS list for Clang toolchain only for Clang 15.0.0 and later. It's worth to mention, that fixing the root cause of the warning is also an option to fix the issue, but it's better to be in sync with the LuaJIT upstream at this point. Signed-off-by: Igor Munkin <[email protected]>
The following code w/ ToT LLVM (clang-15) produces the following warnings:
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.
The text was updated successfully, but these errors were encountered: