Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions build/config/clang/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Contributor

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?


# 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",
Copy link
Contributor

Choose a reason for hiding this comment

The 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" ]
}
44 changes: 37 additions & 7 deletions build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ config("compiler") {
"/GS", # Enable buffer security checking.
"/FS", # Preserve previous PDB behavior.
]

ldflags += [ "/ignore:4217" ]
Copy link
Contributor

Choose a reason for hiding this comment

The 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.
# --------------------------------
Expand Down Expand Up @@ -324,6 +326,7 @@ config("compiler") {
"STRICT=1",
"-s",
"WARN_UNALIGNED=1",

# Reduces global namespace pollution.
"-s",
"MODULARIZE=1",
Expand Down Expand Up @@ -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",
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

]
}

Expand Down Expand Up @@ -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",
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Member Author

Choose a reason for hiding this comment

The 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.
Expand All @@ -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",
Expand Down Expand Up @@ -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" ]
}
}
Expand Down
5 changes: 4 additions & 1 deletion build/config/gcc/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ config("symbol_visibility_hidden") {
# config since that can almost always be applied.
if (!enable_profiling) {
defines = [ "_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS" ]
cflags = [ "-fvisibility=hidden" ]

if (is_clang && !is_win) {
cflags = [ "-fvisibility=hidden" ]
}
}
}

Expand Down