summaryrefslogtreecommitdiffstats
path: root/js/src
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-11-03 14:20:26 -0500
committerMatt A. Tobin <email@mattatobin.com>2020-11-03 14:20:26 -0500
commit5bf19933d83d4c018eb222d2fd7b13c0e9df3c5f (patch)
treeb394675f50337af935a3778e8aa6282319c8f5f9 /js/src
parent395ef79b913ca414e9f69bdfd40662e3a73973e8 (diff)
downloadUXP-5bf19933d83d4c018eb222d2fd7b13c0e9df3c5f.tar
UXP-5bf19933d83d4c018eb222d2fd7b13c0e9df3c5f.tar.gz
UXP-5bf19933d83d4c018eb222d2fd7b13c0e9df3c5f.tar.lz
UXP-5bf19933d83d4c018eb222d2fd7b13c0e9df3c5f.tar.xz
UXP-5bf19933d83d4c018eb222d2fd7b13c0e9df3c5f.zip
Issue #1676 - Part 2: Split CFLAGS and CXXFLAGS directives out of js/src/moz.build
Diffstat (limited to 'js/src')
-rw-r--r--js/src/js-cxxflags.mozbuild42
-rw-r--r--js/src/moz.build37
2 files changed, 45 insertions, 34 deletions
diff --git a/js/src/js-cxxflags.mozbuild b/js/src/js-cxxflags.mozbuild
new file mode 100644
index 000000000..3cab923f1
--- /dev/null
+++ b/js/src/js-cxxflags.mozbuild
@@ -0,0 +1,42 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+CFLAGS += CONFIG['MOZ_ICU_CFLAGS']
+CXXFLAGS += CONFIG['MOZ_ICU_CFLAGS']
+
+if CONFIG['_MSC_VER']:
+ # Prevent floating point errors caused by VC++ optimizations
+ CFLAGS += ['-fp:precise']
+ CXXFLAGS += ['-fp:precise']
+
+ # C4805 warns mixing bool with other integral types in computation.
+ # But given the conversion from bool is specified, and this is a
+ # pattern widely used in code in js/src, suppress this warning here.
+ CXXFLAGS += ['-wd4805']
+
+ # C4661 ("no suitable definition provided for explicit template
+ # instantiation request") is emitted for all Parser methods that
+ # have a Parser<FullParseHandler> definition but no
+ # Parser<SyntaxParseHandler> definition, see bug 1167030.
+ CXXFLAGS += ['-wd4661', '-we4067', '-we4258', '-we4275']
+ CXXFLAGS += ['-wd4146'] # FIXME: unary minus operator applied to unsigned type (bug 1229189)
+
+ # This is intended as a temporary hack to support building with VS2015.
+ # 'noexcept' used with no exception handling mode specified;
+ # termination on exception is not guaranteed. Specify /EHsc
+ CXXFLAGS += ['-wd4577', '-wd4312']
+
+if CONFIG['GNU_CXX']:
+ # Disable strict-aliasing for GCC, which is enabled by default
+ # starting with version 7.1, see Mozilla bug 1363009.
+ CXXFLAGS += ['-Wno-shadow', '-Werror=format', '-fno-strict-aliasing']
+
+if CONFIG['JS_HAS_CTYPES'] and CONFIG['MOZ_SYSTEM_FFI']:
+ CXXFLAGS += CONFIG['MOZ_FFI_CFLAGS']
+
+if CONFIG['JS_CODEGEN_ARM'] and CONFIG['JS_SIMULATOR_ARM']:
+ # Configuration used only for testing.
+ if CONFIG['OS_ARCH'] == 'Linux' or CONFIG['OS_ARCH'] == 'Darwin':
+ CXXFLAGS += [ '-msse2', '-mfpmath=sse' ] \ No newline at end of file
diff --git a/js/src/moz.build b/js/src/moz.build
index c8988fafc..09e471416 100644
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -3,6 +3,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+include('js-cxxflags.mozbuild')
include('js-testing.mozbuild')
FILES_PER_UNIFIED_FILE = 6
@@ -446,9 +447,6 @@ elif CONFIG['JS_CODEGEN_ARM']:
UNIFIED_SOURCES += [
'jit/arm/Simulator-arm.cpp'
]
- # Configuration used only for testing.
- if CONFIG['OS_ARCH'] == 'Linux' or CONFIG['OS_ARCH'] == 'Darwin':
- CXXFLAGS += [ '-msse2', '-mfpmath=sse' ]
elif CONFIG['OS_ARCH'] == 'Darwin':
SOURCES += [
'jit/arm/llvm-compiler-rt/arm/aeabi_idivmod.S',
@@ -641,26 +639,6 @@ if CONFIG['_MSC_VER']:
SOURCES['builtin/RegExp.cpp'].no_pgo = True # Bug 772303
elif CONFIG['CPU_ARCH'] == 'x86_64' and CONFIG['JS_HAS_CTYPES']:
SOURCES['ctypes/CTypes.cpp'].no_pgo = True # Bug 810661
- # Prevent floating point errors caused by VC++ optimizations
- CFLAGS += ['-fp:precise']
- CXXFLAGS += ['-fp:precise']
- # C4805 warns mixing bool with other integral types in computation.
- # But given the conversion from bool is specified, and this is a
- # pattern widely used in code in js/src, suppress this warning here.
- CXXFLAGS += ['-wd4805']
- # C4661 ("no suitable definition provided for explicit template
- # instantiation request") is emitted for all Parser methods that
- # have a Parser<FullParseHandler> definition but no
- # Parser<SyntaxParseHandler> definition, see bug 1167030.
- CXXFLAGS += ['-wd4661']
- CXXFLAGS += ['-we4067', '-we4258', '-we4275']
- CXXFLAGS += ['-wd4146'] # FIXME: unary minus operator applied to unsigned type (bug 1229189)
-
- # This is intended as a temporary hack to support building with VS2015.
- # 'noexcept' used with no exception handling mode specified;
- # termination on exception is not guaranteed. Specify /EHsc
- CXXFLAGS += ['-wd4577']
- CXXFLAGS += ['-wd4312']
if CONFIG['OS_ARCH'] not in ('WINNT'):
OS_LIBS += [
@@ -687,9 +665,6 @@ if CONFIG['OS_ARCH'] == 'SunOS':
OS_LIBS += CONFIG['REALTIME_LIBS']
-CFLAGS += CONFIG['MOZ_ICU_CFLAGS']
-CXXFLAGS += CONFIG['MOZ_ICU_CFLAGS']
-
NO_EXPAND_LIBS = True
DIST_INSTALL = True
@@ -732,18 +707,12 @@ selfhosted.inputs = [
]
if CONFIG['JS_HAS_CTYPES']:
- if CONFIG['MOZ_SYSTEM_FFI']:
- CXXFLAGS += CONFIG['MOZ_FFI_CFLAGS']
- else:
+ if not CONFIG['MOZ_SYSTEM_FFI']:
# Windows needs this to be linked with a static library.
DEFINES['FFI_BUILDING'] = True
-if CONFIG['GNU_CXX']:
- # Disable strict-aliasing for GCC, which is enabled by default
- # starting with version 7.1, see Mozilla bug 1363009.
- CXXFLAGS += ['-Wno-shadow', '-Werror=format', '-fno-strict-aliasing']
-
# Suppress warnings in third-party code.
+# We are keeping this in the main moz.build because it is file specific
if CONFIG['CLANG_CXX'] or CONFIG['GNU_CXX']:
SOURCES['jsdtoa.cpp'].flags += ['-Wno-implicit-fallthrough']