Skip to content

Commit 9266b5e

Browse files
authored
Switch to C++20 (#8657)
* Update doc about C++ version agreement. * Update vscode setting. * Update std version of external code. * Update std version. * Fix warnings about incrementing volatile variables. * Fix warnings about lambda capture. * Fix Windows build errors. * Fix problem of mixing MetaString and MetaName in comparations.
1 parent 77feb7e commit 9266b5e

File tree

96 files changed

+430
-405
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+430
-405
lines changed

.vscode/c_cpp_properties.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
"compilerPath": "/usr/bin/clang",
1515
"cStandard": "c17",
16-
"cppStandard": "c++17",
16+
"cppStandard": "c++20",
1717
"intelliSenseMode": "linux-clang-x64"
1818
}
1919
],

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,14 @@ if (MINGW)
205205
set(CMAKE_STATIC_LIBRARY_PREFIX)
206206

207207
add_definitions(-D_WIN32_WINNT=0x0600)
208-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4 -std=c++17")
208+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4 -std=c++20")
209209
endif()
210210

211211
if (UNIX)
212212
set(OS_DIR posix)
213213

214214
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
215-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -msse4 -std=c++17")
215+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -msse4 -std=c++20")
216216

217217
if (NOT CMAKE_CROSSCOMPILING)
218218
set(LIB_readline readline)

builds/docker/linux/arm32-arm64/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,15 @@ RUN cd ~/build && \
185185
tar xvf icu4c-${ARG_ICU_VERSION}-src.tgz --strip 1 -C icu4c-${ARG_ICU_VERSION}-src && \
186186
mkdir icu4c-${ARG_ICU_VERSION}-build-x86_64 && \
187187
cd icu4c-${ARG_ICU_VERSION}-build-x86_64 && \
188-
CXXFLAGS='-std=c++17 -static-libstdc++' ../icu4c-${ARG_ICU_VERSION}-src/source/runConfigureICU \
188+
CXXFLAGS='-std=c++20 -static-libstdc++' ../icu4c-${ARG_ICU_VERSION}-src/source/runConfigureICU \
189189
Linux \
190190
--host=x86_64-pc-linux-gnu && \
191191
make -j${ARG_CPUCOUNT}
192192

193193
RUN cd ~/build && \
194194
mkdir icu4c-${ARG_ICU_VERSION}-build && \
195195
cd icu4c-${ARG_ICU_VERSION}-build && \
196-
CXXFLAGS='-std=c++17 -static-libstdc++' ../icu4c-${ARG_ICU_VERSION}-src/source/runConfigureICU \
196+
CXXFLAGS='-std=c++20 -static-libstdc++' ../icu4c-${ARG_ICU_VERSION}-src/source/runConfigureICU \
197197
Linux \
198198
--host=${ARG_TARGET_ARCH} \
199199
--with-cross-build=/home/ctng/build/icu4c-${ARG_ICU_VERSION}-build-x86_64 \

builds/docker/linux/x86-x64/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ RUN cd ~/build && \
183183
tar xvf icu4c-${ARG_ICU_VERSION}-src.tgz --strip 1 -C icu4c-${ARG_ICU_VERSION}-src && \
184184
mkdir icu4c-${ARG_ICU_VERSION}-build && \
185185
cd icu4c-${ARG_ICU_VERSION}-build && \
186-
CXXFLAGS='-std=c++17 -static-libstdc++' setarch $ARG_SET_ARCH ../icu4c-${ARG_ICU_VERSION}-src/source/runConfigureICU \
186+
CXXFLAGS='-std=c++20 -static-libstdc++' setarch $ARG_SET_ARCH ../icu4c-${ARG_ICU_VERSION}-src/source/runConfigureICU \
187187
Linux \
188188
--host=${ARG_TARGET_ARCH} \
189189
--prefix=/home/ctng/x-tools/${ARG_TARGET_ARCH}/${ARG_TARGET_ARCH}/sysroot/usr/local \

builds/posix/Makefile.in.plugins_examples

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ else
3636
DefaultTarget := Release
3737
endif
3838

39-
CPPFLAGS += -std=c++17 -I$(FB_BUILD)/include
39+
CPPFLAGS += -std=c++20 -I$(FB_BUILD)/include
4040

4141
include $(ROOT)/gen/make.defaults
4242

builds/posix/make.defaults

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ GLOB_OPTIONS:=
111111
#____________________________________________________________________________
112112

113113
# Global c++ flags: firebird needs no RTTI, choose build standard and c++ specific warnings level
114-
PLUSPLUS_FLAGS:= -fno-rtti -std=c++17 -Werror=delete-incomplete -Werror=return-type
114+
PLUSPLUS_FLAGS:= -fno-rtti -std=c++20 -Werror=delete-incomplete -Werror=return-type
115115

116116
# If this is defined then we use special rules useful for developers only
117117
IsDeveloper = @DEVEL_FLG@

builds/posix/prefix.freebsd_amd64

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ DEV_FLAGS=-ggdb -DFREEBSD -DAMD64 -pipe -MMD -p -fPIC -Wall -Wno-non-virtual-dto
2626
# This file must be compiled with SSE4.2 support
2727
%/CRC32C.o: CXXFLAGS += -msse4
2828

29-
CXXFLAGS := $(CXXFLAGS) -std=c++17
29+
CXXFLAGS := $(CXXFLAGS) -std=c++20

builds/win32/msvc15/FirebirdCommon.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<WarningLevel>Level3</WarningLevel>
2424
<SuppressStartupBanner>true</SuppressStartupBanner>
2525
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
26-
<LanguageStandard>stdcpp17</LanguageStandard>
26+
<LanguageStandard>stdcpp20</LanguageStandard>
2727
<CompileAs>Default</CompileAs>
2828
<UseFullPaths>false</UseFullPaths>
2929
<MultiProcessorCompilation>true</MultiProcessorCompilation>

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ dnl if 64-bit mode, then archive tool, ar, needs -X64 option
10781078
fi
10791079

10801080
XE_SAVE_ENV()
1081-
CXXFLAGS="$CXXFLAGS -std=c++17"
1081+
CXXFLAGS="$CXXFLAGS -std=c++20"
10821082
AC_CACHE_CHECK([whether the C++ compiler understands noexcept], [ac_cv_cxx_noexcept], [
10831083
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int f(int x) noexcept { return x + 1; }]], [[]])],
10841084
[ac_cv_cxx_noexcept=yes], [ac_cv_cxx_noexcept=no])])

doc/README.modern_cpp.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# Modern C++ features
22

3-
It's allowed to use in Firebird internal code C++ features up to and including C++17.
3+
It's allowed to use in Firebird internal code C++ features up to and including C++20.
44

55
Public files (as API headers) is limited to C++11.
66

77
Exceptions to these rules should be listed below and must be agreed by the team,
88
discussing in the devel list or by pull request.
99

10-
## Allowed features
11-
12-
### C++20
10+
## Disallowed features

0 commit comments

Comments
 (0)