mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1795207 - Move the remainder of warning flags setup in old-configure to python. r=firefox-build-system-reviewers,andi
While we're here, make the setup more consistent across host/target c/c++, and remove the C compiler warning flags from the C linker flags, where they are irrelevant. Differential Revision: https://phabricator.services.mozilla.com/D159358
This commit is contained in:
parent
02bc919daa
commit
8f4d47c529
@ -60,9 +60,6 @@ AC_DEFUN([MOZ_COMPILER_OPTS],
|
||||
[
|
||||
MOZ_DEBUGGING_OPTS
|
||||
MOZ_RTTI
|
||||
if test "$CLANG_CXX"; then
|
||||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-unknown-warning-option"
|
||||
fi
|
||||
|
||||
if test "$GNU_CC"; then
|
||||
if test -z "$DEVELOPER_OPTIONS"; then
|
||||
|
@ -1194,6 +1194,10 @@ def compiler(
|
||||
if info.type == "clang" and language == "C++" and host_or_target.os == "OSX":
|
||||
flags.append("-stdlib=libc++")
|
||||
|
||||
# Suppress Clang Argument Warnings
|
||||
if info.type in ("clang", "clang-cl"):
|
||||
flags.append("-Qunused-arguments")
|
||||
|
||||
# Check that the additional flags we got are enough to not require any
|
||||
# more flags. If we get an exception, just ignore it; it's liable to be
|
||||
# invalid command-line flags, which means the compiler we're checking
|
||||
|
@ -303,8 +303,12 @@ check_and_add_warning(
|
||||
# Warn if APIs are used without available() checks on macOS.
|
||||
check_and_add_warning("-Werror=unguarded-availability-new", when=target_is_osx)
|
||||
|
||||
# Please keep these last in this file
|
||||
add_old_configure_assignment("_WARNINGS_CFLAGS", warnings_flags.cflags)
|
||||
add_old_configure_assignment("_WARNINGS_CXXFLAGS", warnings_flags.cxxflags)
|
||||
add_old_configure_assignment("_WARNINGS_HOST_CFLAGS", warnings_flags.host_cflags)
|
||||
add_old_configure_assignment("_WARNINGS_HOST_CXXFLAGS", warnings_flags.host_cxxflags)
|
||||
# Please keep the following last in this file
|
||||
|
||||
# Avoid requiring complicated logic for extra warning flags in moz.build files.
|
||||
check_and_add_warning("-Wno-unknown-warning-option")
|
||||
|
||||
set_config("WARNINGS_CFLAGS", warnings_flags.cflags)
|
||||
set_config("WARNINGS_CXXFLAGS", warnings_flags.cxxflags)
|
||||
set_config("WARNINGS_HOST_CFLAGS", warnings_flags.host_cflags)
|
||||
set_config("WARNINGS_HOST_CXXFLAGS", warnings_flags.host_cxxflags)
|
||||
|
@ -61,6 +61,9 @@ def AllowCompilerWarnings():
|
||||
@template
|
||||
def DisableCompilerWarnings():
|
||||
COMPILE_FLAGS['WARNINGS_CFLAGS'] = []
|
||||
COMPILE_FLAGS['WARNINGS_CXXFLAGS'] = []
|
||||
HOST_COMPILE_FLAGS['WARNINGS_CFLAGS'] = []
|
||||
HOST_COMPILE_FLAGS['WARNINGS_CXXFLAGS'] = []
|
||||
|
||||
@template
|
||||
def RustLibrary(name, features=None, output_category=None, is_gkrust=False):
|
||||
|
@ -191,18 +191,6 @@ dnl ========================================================
|
||||
|
||||
MOZ_ANDROID_STLPORT
|
||||
|
||||
dnl ========================================================
|
||||
dnl Suppress Clang Argument Warnings
|
||||
dnl ========================================================
|
||||
WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
|
||||
if test -n "${CLANG_CC}${CLANG_CL}"; then
|
||||
WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
|
||||
CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
|
||||
fi
|
||||
if test -n "${CLANG_CXX}${CLANG_CL}"; then
|
||||
_WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
|
||||
fi
|
||||
|
||||
MOZ_CONFIG_SANITIZE
|
||||
|
||||
dnl ========================================================
|
||||
@ -991,7 +979,6 @@ dnl ========================================================
|
||||
|
||||
AC_SUBST_LIST(ASFLAGS)
|
||||
AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
|
||||
AC_SUBST_LIST(WARNINGS_CFLAGS)
|
||||
|
||||
AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
|
||||
|
||||
@ -1007,7 +994,6 @@ CFLAGS=`echo \
|
||||
$CFLAGS`
|
||||
|
||||
CXXFLAGS=`echo \
|
||||
$_WARNINGS_CXXFLAGS \
|
||||
$_COMPILATION_CXXFLAGS \
|
||||
$CXXFLAGS`
|
||||
|
||||
@ -1020,12 +1006,10 @@ COMPILE_CXXFLAGS=`echo \
|
||||
$COMPILE_CXXFLAGS`
|
||||
|
||||
HOST_CFLAGS=`echo \
|
||||
$_WARNINGS_HOST_CFLAGS \
|
||||
$_COMPILATION_HOST_CFLAGS \
|
||||
$HOST_CFLAGS`
|
||||
|
||||
HOST_CXXFLAGS=`echo \
|
||||
$_WARNINGS_HOST_CXXFLAGS \
|
||||
$_COMPILATION_HOST_CXXFLAGS \
|
||||
$HOST_CXXFLAGS`
|
||||
|
||||
|
@ -214,18 +214,6 @@ if test "$COMPILE_ENVIRONMENT"; then
|
||||
MOZ_ANDROID_STLPORT
|
||||
fi # COMPILE_ENVIRONMENT
|
||||
|
||||
dnl ========================================================
|
||||
dnl Suppress Clang Argument Warnings
|
||||
dnl ========================================================
|
||||
WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
|
||||
if test -n "${CLANG_CC}${CLANG_CL}"; then
|
||||
WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
|
||||
CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
|
||||
fi
|
||||
if test -n "${CLANG_CXX}${CLANG_CL}"; then
|
||||
_WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
|
||||
fi
|
||||
|
||||
if test -n "$COMPILE_ENVIRONMENT"; then
|
||||
MOZ_CONFIG_SANITIZE
|
||||
fi
|
||||
@ -1163,7 +1151,6 @@ dnl ========================================================
|
||||
|
||||
AC_SUBST_LIST(ASFLAGS)
|
||||
AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
|
||||
AC_SUBST_LIST(WARNINGS_CFLAGS)
|
||||
|
||||
AC_SUBST(MOZ_STUB_INSTALLER)
|
||||
|
||||
@ -1315,7 +1302,6 @@ CFLAGS=`echo \
|
||||
$CFLAGS`
|
||||
|
||||
CXXFLAGS=`echo \
|
||||
$_WARNINGS_CXXFLAGS \
|
||||
$_COMPILATION_CXXFLAGS \
|
||||
$CXXFLAGS`
|
||||
|
||||
@ -1328,12 +1314,10 @@ COMPILE_CXXFLAGS=`echo \
|
||||
$COMPILE_CXXFLAGS`
|
||||
|
||||
HOST_CFLAGS=`echo \
|
||||
$_WARNINGS_HOST_CFLAGS \
|
||||
$_COMPILATION_HOST_CFLAGS \
|
||||
$HOST_CFLAGS`
|
||||
|
||||
HOST_CXXFLAGS=`echo \
|
||||
$_WARNINGS_HOST_CXXFLAGS \
|
||||
$_COMPILATION_HOST_CXXFLAGS \
|
||||
$HOST_CXXFLAGS`
|
||||
|
||||
|
@ -380,6 +380,16 @@ class HostCompileFlags(BaseCompileFlags):
|
||||
["-I%s/dist/include" % context.config.topobjdir],
|
||||
("HOST_CFLAGS", "HOST_CXXFLAGS"),
|
||||
),
|
||||
(
|
||||
"WARNINGS_CFLAGS",
|
||||
context.config.substs.get("WARNINGS_HOST_CFLAGS"),
|
||||
("HOST_CFLAGS",),
|
||||
),
|
||||
(
|
||||
"WARNINGS_CXXFLAGS",
|
||||
context.config.substs.get("WARNINGS_HOST_CXXFLAGS"),
|
||||
("HOST_CXXFLAGS",),
|
||||
),
|
||||
)
|
||||
BaseCompileFlags.__init__(self, context)
|
||||
|
||||
@ -645,7 +655,12 @@ class CompileFlags(TargetCompileFlags):
|
||||
(
|
||||
"WARNINGS_CFLAGS",
|
||||
context.config.substs.get("WARNINGS_CFLAGS"),
|
||||
("CFLAGS", "C_LDFLAGS"),
|
||||
("CFLAGS",),
|
||||
),
|
||||
(
|
||||
"WARNINGS_CXXFLAGS",
|
||||
context.config.substs.get("WARNINGS_CXXFLAGS"),
|
||||
("CXXFLAGS",),
|
||||
),
|
||||
("MOZBUILD_CFLAGS", None, ("CFLAGS",)),
|
||||
("MOZBUILD_CXXFLAGS", None, ("CXXFLAGS",)),
|
||||
|
@ -494,14 +494,14 @@ class LinuxToolchainTest(BaseToolchainTest):
|
||||
"Only clang/llvm 5.0 or newer is supported (found version 4.0.2)."
|
||||
)
|
||||
CLANG_5_0_RESULT = CompilerResult(
|
||||
flags=["-std=gnu99"],
|
||||
flags=["-Qunused-arguments", "-std=gnu99"],
|
||||
version="5.0.1",
|
||||
type="clang",
|
||||
compiler="/usr/bin/clang-5.0",
|
||||
language="C",
|
||||
)
|
||||
CLANGXX_5_0_RESULT = CompilerResult(
|
||||
flags=["-std=gnu++17"],
|
||||
flags=["-Qunused-arguments", "-std=gnu++17"],
|
||||
version="5.0.1",
|
||||
type="clang",
|
||||
compiler="/usr/bin/clang++-5.0",
|
||||
@ -867,14 +867,14 @@ class OSXToolchainTest(BaseToolchainTest):
|
||||
"Only clang/llvm 5.0 or newer is supported (found version 4.0.0.or.less)."
|
||||
)
|
||||
DEFAULT_CLANG_RESULT = CompilerResult(
|
||||
flags=["-std=gnu99"],
|
||||
flags=["-Qunused-arguments", "-std=gnu99"],
|
||||
version="5.0.2",
|
||||
type="clang",
|
||||
compiler="/usr/bin/clang",
|
||||
language="C",
|
||||
)
|
||||
DEFAULT_CLANGXX_RESULT = CompilerResult(
|
||||
flags=["-stdlib=libc++", "-std=gnu++17"],
|
||||
flags=["-stdlib=libc++", "-Qunused-arguments", "-std=gnu++17"],
|
||||
version="5.0.2",
|
||||
type="clang",
|
||||
compiler="/usr/bin/clang++",
|
||||
@ -987,7 +987,7 @@ class WindowsToolchainTest(BaseToolchainTest):
|
||||
)
|
||||
CLANG_CL_8_0_RESULT = CompilerResult(
|
||||
version="8.0.0",
|
||||
flags=["-Xclang", "-std=gnu99"],
|
||||
flags=["-Qunused-arguments", "-Xclang", "-std=gnu99"],
|
||||
type="clang-cl",
|
||||
compiler="/usr/bin/clang-cl",
|
||||
language="C",
|
||||
@ -997,7 +997,7 @@ class WindowsToolchainTest(BaseToolchainTest):
|
||||
)
|
||||
CLANGXX_CL_8_0_RESULT = CompilerResult(
|
||||
version="8.0.0",
|
||||
flags=["-Xclang", "-std=c++17"],
|
||||
flags=["-Qunused-arguments", "-Xclang", "-std=c++17"],
|
||||
type="clang-cl",
|
||||
compiler="/usr/bin/clang-cl",
|
||||
language="C++",
|
||||
@ -1433,14 +1433,14 @@ class OSXCrossToolchainTest(BaseToolchainTest):
|
||||
}
|
||||
)
|
||||
DEFAULT_CLANG_RESULT = CompilerResult(
|
||||
flags=["-std=gnu99"],
|
||||
flags=["-Qunused-arguments", "-std=gnu99"],
|
||||
version="5.0.1",
|
||||
type="clang",
|
||||
compiler="/usr/bin/clang",
|
||||
language="C",
|
||||
)
|
||||
DEFAULT_CLANGXX_RESULT = CompilerResult(
|
||||
flags=["-std=gnu++17"],
|
||||
flags=["-Qunused-arguments", "-std=gnu++17"],
|
||||
version="5.0.1",
|
||||
type="clang",
|
||||
compiler="/usr/bin/clang++",
|
||||
|
@ -2456,9 +2456,7 @@ with only_when(requires_wasm_sandboxing & compile_environment):
|
||||
|
||||
set_config("WASM_CXX", wasm_cxx_with_flags)
|
||||
|
||||
wasm_compile_flags = dependable(
|
||||
["-fno-exceptions", "-fno-strict-aliasing", "-Qunused-arguments"]
|
||||
)
|
||||
wasm_compile_flags = dependable(["-fno-exceptions", "-fno-strict-aliasing"])
|
||||
option(env="WASM_CFLAGS", nargs=1, help="Options to pass to WASM_CC")
|
||||
|
||||
@depends("WASM_CFLAGS", wasm_compile_flags)
|
||||
|
Loading…
Reference in New Issue
Block a user