mirror of
https://github.com/facebook/sapling.git
synced 2024-10-04 22:07:44 +03:00
438a3f43ba
Summary: Eden builds allow for shadow declarations to hide members, parameters, etc. This can lead to subtle bugs and frustrations. Lets fix that. This first update enables shadow warngings for most problematic types of shadows. With errors on by default, this will block local and CI builds. Reviewed By: xavierd Differential Revision: D50434604 fbshipit-source-id: 976bd2e86c620f1f0e62e19867c81840fee645c9
66 lines
1.6 KiB
Python
66 lines
1.6 KiB
Python
""" build mode definitions for eden """
|
|
|
|
load("@fbcode_macros//build_defs:create_build_mode.bzl", "create_build_mode")
|
|
|
|
COMPILE_TIME_TRACING = False
|
|
|
|
_extra_cxxflags = [
|
|
"-Wall",
|
|
"-Wextra",
|
|
"-Wuninitialized",
|
|
"-Wtype-limits",
|
|
"-Werror=return-type",
|
|
]
|
|
|
|
_extra_clang_flags = [
|
|
"-Wconstant-conversion",
|
|
"-Wgnu-conditional-omitted-operand",
|
|
"-Wheader-hygiene",
|
|
"-Wimplicit-fallthrough",
|
|
"-Wshadow",
|
|
"-Wshift-sign-overflow",
|
|
"-Wunused-const-variable",
|
|
"-Wunused-exception-parameter",
|
|
"-Wunused-lambda-capture",
|
|
"-Wunused-value",
|
|
"-Wunused-variable",
|
|
"-Wunreachable-code-aggressive",
|
|
"-Wno-nullability-completeness",
|
|
"-Winconsistent-missing-override",
|
|
] + (["-ftime-trace"] if COMPILE_TIME_TRACING else [])
|
|
|
|
_extra_gcc_flags = [
|
|
"-Wunused-but-set-variable",
|
|
"-Wshadow",
|
|
]
|
|
|
|
_os_preprocessor_flags = [
|
|
("windows", [
|
|
# Note: as of 2023, libevent undefines WIN32_LEAN_AND_MEAN after
|
|
# including <windows.h>. This can be confusing, but it should be
|
|
# okay. If libevent includes <windows.h>, then later includes of
|
|
# windows.h should not pull in Winsock 1.
|
|
"-DWIN32_LEAN_AND_MEAN",
|
|
"-DNOMINMAX",
|
|
"-DSTRICT",
|
|
]),
|
|
]
|
|
|
|
_mode = create_build_mode(
|
|
clang_flags = _extra_clang_flags,
|
|
cxx_flags = _extra_cxxflags,
|
|
gcc_flags = _extra_gcc_flags,
|
|
os_preprocessor_flags = _os_preprocessor_flags,
|
|
)
|
|
|
|
_modes = {
|
|
"dbg": _mode,
|
|
"dbgo": _mode,
|
|
"dev": _mode,
|
|
"opt": _mode,
|
|
}
|
|
|
|
def get_modes():
|
|
""" Return modes for this hierarchy """
|
|
return _modes
|