-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc] [Task] Prepare to enable disabled warnings #122835
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
base: main
Are you sure you want to change the base?
Changes from all commits
00a77f0
3c023ed
bbec43a
badca59
1a2a90d
f375ca5
ba19d9a
90e7a06
d4b2fec
9c71b2a
fb7d4ba
26d4b30
dd8de4c
85acd9a
71dcc06
67ed339
be54a01
9e7c2f8
61e3690
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,34 +25,53 @@ function(_get_common_test_compile_options output_var c_test flags) | |
list(APPEND compile_options "-ffixed-point") | ||
endif() | ||
|
||
# list(APPEND compile_options "-Wall") | ||
# list(APPEND compile_options "-Wextra") | ||
list(APPEND compile_options "-Wall") | ||
list(APPEND compile_options "-Wextra") | ||
# -DLIBC_WNO_ERROR=ON if you can't build cleanly with -Werror. | ||
if(NOT LIBC_WNO_ERROR) | ||
# list(APPEND compile_options "-Werror") | ||
list(APPEND compile_options "-Werror") | ||
|
||
# TODO (https://github.com/llvm/llvm-project/issues/122367#issuecomment-2581374103) | ||
list(APPEND compile_options "-Wno-unused-command-line-argument") | ||
|
||
# TODO (https://github.com/llvm/llvm-project/issues/123434) | ||
list(APPEND compile_options "-Wno-missing-field-initializers") | ||
endif() | ||
# list(APPEND compile_options "-Wconversion") | ||
# list(APPEND compile_options "-Wno-sign-conversion") | ||
# list(APPEND compile_options "-Wimplicit-fallthrough") | ||
# list(APPEND compile_options "-Wwrite-strings") | ||
# list(APPEND compile_options "-Wextra-semi") | ||
list(APPEND compile_options "-Wconversion") | ||
list(APPEND compile_options "-Wno-sign-conversion") | ||
list(APPEND compile_options "-Wimplicit-fallthrough") | ||
list(APPEND compile_options "-Wwrite-strings") | ||
list(APPEND compile_options "-Wextra-semi") | ||
# Silence this warning because _Complex is a part of C99. | ||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | ||
if(NOT c_test) | ||
list(APPEND compile_options "-fext-numeric-literals") | ||
endif() | ||
else() | ||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang$") | ||
list(APPEND compile_options "-Wnewline-eof") | ||
list(APPEND compile_options "-Wnonportable-system-include-path") | ||
list(APPEND compile_options "-Wstrict-prototypes") | ||
list(APPEND compile_options "-Wthread-safety") | ||
# TODO(https://github.com/llvm/llvm-project/issues/119281) triggered in TEST_F implementation | ||
list(APPEND compile_options "-Wno-global-constructors") | ||
|
||
# TODO(https://github.com/llvm/llvm-project/issues/119281) | ||
# These have been disabled for the time being to create explicit PRs for each change. | ||
list(APPEND compile_options "-Wno-unused-parameter") | ||
list(APPEND compile_options "-Wno-implicit-int-conversion") | ||
list(APPEND compile_options "-Wno-shorten-64-to-32") | ||
list(APPEND compile_options "-Wno-float-conversion") | ||
list(APPEND compile_options "-Wno-implicit-float-conversion") | ||
list(APPEND compile_options "-Wno-extra-semi") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's better to just start submitting these fixes first, then revisit this PR. Here's an example for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh ok, I can do that, let me raise the ones for the other issues There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "simple" warning fixes that could be done are in: #124036. All the other warnings seem to need fixes in multiple files and aren't straight forward to enable/trigger (i.e. to solve unused parameter, I need to enable Wextra which ends up raising a few other issues as well, like "omitting parameter name is a C23 extension"). In that case, IMO it would be a good idea to merge this PR after #124036, and then in each subsequent PR, work on removing the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. I don't mind if you need to enable |
||
|
||
|
||
list(APPEND compile_options "-Wno-c99-extensions") | ||
list(APPEND compile_options "-Wno-gnu-imaginary-constant") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we also remove these There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not in this PR. I'm not familiar with these two diagnostics in particular, so I'm not certain why they were explicitly disabled. |
||
|
||
endif() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's fine; today we only support gcc and clang. If someone cares to support a third compiler for llvm-libc, we'd like to know about it. |
||
|
||
list(APPEND compile_options "-Wno-pedantic") | ||
# if(NOT CMAKE_COMPILER_IS_GNUCXX) | ||
# list(APPEND compile_options "-Wnewline-eof") | ||
# list(APPEND compile_options "-Wnonportable-system-include-path") | ||
# list(APPEND compile_options "-Wstrict-prototypes") | ||
# list(APPEND compile_options "-Wthread-safety") | ||
# list(APPEND compile_options "-Wglobal-constructors") | ||
# endif() | ||
|
||
endif() | ||
set(${output_var} ${compile_options} PARENT_SCOPE) | ||
endfunction() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come you use
MATCHES
with$
rather thanSTREQUAL
without$
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, since I'm using
AppleClang
on a macOS m1, I figured I could use MATCHES to match Clang and other clang-like compilers