-
Notifications
You must be signed in to change notification settings - Fork 254
Suppress Windows specific Clang warnings and treat the rest as errors. #381
Changes from all commits
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 |
|---|---|---|
|
|
@@ -12,14 +12,16 @@ config("find_bad_constructs") { | |
| # Enables some extra Clang-specific warnings. Some third-party code won't | ||
| # compile with these so may want to remove this config. | ||
| config("extra_warnings") { | ||
| cflags = [ | ||
| # Warns when a const char[] is converted to bool. | ||
| "-Wstring-conversion", | ||
| if (!is_win) { | ||
| cflags = [ | ||
| # Warns when a const char[] is converted to bool. | ||
| "-Wstring-conversion", | ||
|
|
||
| # Warns when a source file doesn't have a newline at end-of-file. | ||
| # This is to match Fuchsia, which enables this warning. | ||
| "-Wnewline-eof", | ||
| ] | ||
| # Warns when a source file doesn't have a newline at end-of-file. | ||
| # This is to match Fuchsia, which enables this warning. | ||
| "-Wnewline-eof", | ||
|
Contributor
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 have a fix for this landed in ANGLE, I just need to find time to update the licenses to roll it (flutter/engine#19105) |
||
| ] | ||
| } | ||
|
|
||
| defines = [ "_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS" ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,6 +78,8 @@ config("compiler") { | |
| "/GS", # Enable buffer security checking. | ||
| "/FS", # Preserve previous PDB behavior. | ||
| ] | ||
|
|
||
| ldflags += [ "/ignore:4217" ] | ||
|
Contributor
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. This needs a comment; I'm not sure what it is, or why we need to suppress it instead of fix it. |
||
| } else { | ||
| # Common GCC compiler flags setup. | ||
| # -------------------------------- | ||
|
|
@@ -324,6 +326,7 @@ config("compiler") { | |
| "STRICT=1", | ||
| "-s", | ||
| "WARN_UNALIGNED=1", | ||
|
|
||
| # Reduces global namespace pollution. | ||
| "-s", | ||
| "MODULARIZE=1", | ||
|
|
@@ -535,6 +538,8 @@ config("runtime_library") { | |
| "_CRT_SECURE_NO_DEPRECATE", | ||
| "_HAS_EXCEPTIONS=0", | ||
| "_SCL_SECURE_NO_DEPRECATE", | ||
| "_CRT_NONSTDC_NO_WARNINGS", | ||
| "_CRT_NONSTDC_NO_DEPRECATE", | ||
|
Contributor
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. We should't blank-suppress these. They are almost all from Dart, and they have an in-progress PR to fix them. |
||
| ] | ||
| } | ||
|
|
||
|
|
@@ -642,14 +647,35 @@ if (is_win) { | |
| "/wd4311", # Pointer truncation from PVOID to DWORD. | ||
| "/wd4477", # Format string requires wchar_t* | ||
| ] | ||
| import("//build/toolchain/goma.gni") | ||
| if (is_clang && use_goma) { | ||
| # goma compilation doesn't preserve file case, so don't warn about | ||
| # case-mismatches. | ||
| default_warning_flags += [ | ||
|
|
||
| if (is_clang) { | ||
| # These warning flags seem to be Clang specific in addition to those | ||
| # specified for MSVC above. | ||
| extra_warning_flags = [ | ||
| # Warnings as errors. | ||
| "-Werror", | ||
|
|
||
| # Some third party dependencies like ICU add flags that are not supported | ||
| # by clang-cl yet. | ||
| "-Wno-unknown-argument", | ||
|
|
||
| "-Wno-nonportable-include-path", | ||
| "-Wno-nonportable-system-include-path", | ||
|
Contributor
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. Why are you turning these on more often? The are working around a goma bug.
Member
Author
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 ran into these on my non-corp workstation without goma setup. |
||
| "-Wno-implicit-int-float-conversion", | ||
| "-Wno-double-promotion", | ||
| "-Wno-ignored-pragma-optimize", | ||
| "-Wno-microsoft-unqualified-friend", | ||
| "-Wno-microsoft-cast", | ||
| "-Wno-tautological-constant-out-of-range-compare", | ||
| "-Wno-string-compare", | ||
| "-Wno-undefined-var-template", | ||
|
|
||
| # TODO: There only seems to one legitimate case of this happening in Dart. | ||
| # Patch that callsite or move the flag to Dart GN rules. | ||
| "-Wno-deprecated-declarations", | ||
| ] | ||
| default_warning_flags += extra_warning_flags | ||
| default_warning_flags_cc += extra_warning_flags | ||
| } | ||
| } else { | ||
| # Common GCC warning setup. | ||
|
|
@@ -667,6 +693,7 @@ if (is_win) { | |
| default_warning_flags += [ | ||
| # zlib needs this | ||
| "-Wno-shift-negative-value", | ||
|
|
||
| # freetype2 needs these two | ||
| "-Wno-unused-function", | ||
| "-Wno-unused-variable", | ||
|
|
@@ -919,8 +946,11 @@ config("no_optimize") { | |
| } | ||
| ldflags = common_optimize_on_ldflags | ||
| } else if (is_wasm) { | ||
| cflags = [ "-O0", "-g4" ] | ||
| } else { | ||
| cflags = [ | ||
| "-O0", | ||
| "-g4", | ||
| ] | ||
| } else { | ||
| cflags = [ "-O0" ] | ||
| } | ||
| } | ||
|
|
||
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.
Do we actually hit this on Windows?