Skip to content

Commit

Permalink
Enable C++20 for macOS, Linux, and Android
Browse files Browse the repository at this point in the history
We have already enabled C++20 for Windows [1] including Qt6 [2].
Let's globally enable C++20 for other platforms.

There must be no user observable behavior change.

Closes google#783.

 [1]: 07d9335
 [2]: 43449d0

PiperOrigin-RevId: 573458525
  • Loading branch information
yukawa authored and coooooooozy committed Nov 25, 2023
1 parent 09b90a8 commit e0e1768
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Common options
build --cxxopt "-std=c++17"
build --cxxopt "-std=c++20"
build --copt "-funsigned-char"
build --copt "-Wno-sign-compare"
build --copt "-Wno-char-subscripts"
build --host_cxxopt "-std=c++17"
build --host_cxxopt "-std=c++20"
build --host_copt "-funsigned-char"
build --host_copt "-Wno-sign-compare"
build --host_copt "-Wno-char-subscripts"
Expand Down
4 changes: 2 additions & 2 deletions src/build_tools/build_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ def make_configure_options(args: argparse.Namespace) -> list[str]:
raise ValueError(f'Only Qt6 is supported but specified {qt_version}.')

qt_configure_options = ['-opensource',
'-c++std', 'c++20',
'-silent',
'-no-cups',
'-no-dbus',
Expand Down Expand Up @@ -306,8 +307,7 @@ def make_configure_options(args: argparse.Namespace) -> list[str]:
'-DCMAKE_OSX_ARCHITECTURES:STRING=' + ';'.join(macos_cpus),
]
elif is_windows():
qt_configure_options += ['-c++std', 'c++20',
'-force-debug-info',
qt_configure_options += ['-force-debug-info',
'-ltcg', # Note: ignored in debug build
'-no-freetype',
'-no-harfbuzz',
Expand Down
6 changes: 3 additions & 3 deletions src/gyp/common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
}],
['compiler_target=="clang" or compiler_target=="gcc"', {
'cflags_cc': [
'-std=c++17',
'-std=c++20',
],
}],
],
Expand All @@ -199,7 +199,7 @@
}],
['compiler_host=="clang" or compiler_host=="gcc"', {
'cflags_cc': [
'-std=c++17',
'-std=c++20',
],
}],
],
Expand Down Expand Up @@ -262,7 +262,7 @@
'-Wno-covered-switch-default',
'-Wno-unnamed-type-template-args',
],
'CLANG_CXX_LANGUAGE_STANDARD': 'c++17',
'CLANG_CXX_LANGUAGE_STANDARD': 'c++20',
'CLANG_CXX_LIBRARY': 'libc++',
'OTHER_CPLUSPLUSFLAGS': [
'$(inherited)',
Expand Down

0 comments on commit e0e1768

Please sign in to comment.