summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2023-10-15 15:12:23 +0200
committerMoonchild <moonchild@palemoon.org>2023-11-05 13:16:24 +0100
commite29ae4e08ccce7f120f8ee88dd238bd2b4facbf4 (patch)
tree2e95759a94a713f3cf92ced3e305ccd6477b0edf /build
parent865d49bdc1a6e95012a93e593461a7128f602b20 (diff)
downloaduxp-e29ae4e08ccce7f120f8ee88dd238bd2b4facbf4.tar.gz
Issue #2281 - Default to C++17 when building.
Configure the toolchain to default to C++17 language standard with optional gnu extensions (if on GCC)
Diffstat (limited to 'build')
-rw-r--r--build/moz.configure/toolchain.configure19
-rw-r--r--build/moz.configure/warnings.configure2
2 files changed, 10 insertions, 11 deletions
diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
index cc0540ea1c..40b87cf626 100644
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -340,17 +340,16 @@ def check_compiler(compiler, language, target):
if info.type in ('clang-cl', 'clang', 'gcc'):
append_flag('-std=gnu99')
- # Note: this is a strict version check because we used to always add
- # -std=gnu++14.
- cxx14_version = 201402
+ cxx17_version = 201703
if info.language == 'C++':
- if info.type in ('clang', 'gcc') and info.language_version != cxx14_version:
- append_flag('-std=gnu++14')
- # MSVC 2015 headers include C++14 features, but don't guard them
- # with appropriate checks.
- if info.type == 'clang-cl' and info.language_version != cxx14_version:
- append_flag('-std=c++14')
- # MSVC from 2015 on defaults to C++14.
+ if info.language_version != cxx17_version:
+ # Compiler doesn't default to C++17, so add the appropriate flag.
+ if info.type in ('clang', 'gcc'):
+ # We're on Clang or GCC, enable C++17 and add GNU extensions.
+ append_flag('-std=gnu++17')
+ else:
+ # We're on MSVC; enable C++17 language mode.
+ append_flag('-std:c++17')
# We force clang-cl to emulate Visual C++ 2015 Update 3 with fallback to
# cl.exe.
diff --git a/build/moz.configure/warnings.configure b/build/moz.configure/warnings.configure
index 2edf1748ad..0704f94a09 100644
--- a/build/moz.configure/warnings.configure
+++ b/build/moz.configure/warnings.configure
@@ -52,7 +52,7 @@ check_and_add_gcc_warning('-Wclass-varargs')
check_and_add_gcc_warning('-Wloop-analysis')
# catches C++ version forward-compat issues
-check_and_add_gcc_warning('-Wc++1z-compat', cxx_compiler)
+# check_and_add_gcc_warning('-Wc++2a-compat', cxx_compiler)
# catches unintentional switch case fallthroughs
check_and_add_gcc_warning('-Wimplicit-fallthrough', cxx_compiler)