Skip to content

Commit 7ec1765

Browse files
roubertmarkusicu
authored andcommitted
ICU-21107 Update ICU4C minimum standard version from C++11 to C++17.
1 parent 4a7d61d commit 7ec1765

File tree

11 files changed

+30
-27
lines changed

11 files changed

+30
-27
lines changed

.github/workflows/icu4c.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,17 @@ jobs:
130130
make check;
131131
132132
# Out of source build with gcc 10, c++14, and extra warnings; executes icuinfo.
133-
gcc-10-stdlib14:
133+
gcc-10-stdlib17:
134134
runs-on: ubuntu-latest
135135
steps:
136136
- uses: actions/checkout@v3
137137

138-
- name: ICU4C with gcc 10 and c++14 and extra warnings.
138+
- name: ICU4C with gcc 10 and c++17 and extra warnings.
139139
env:
140140
PREFIX: /tmp/icu-prefix
141141
CC: gcc-10
142142
CXX: g++-10
143-
CXXFLAGS: -std=c++14 -Wextra
143+
CXXFLAGS: -std=c++17 -Wextra
144144
run: |
145145
mkdir build;
146146
cd build;

docs/userguide/icu4c/build.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ The value of `v140` corresponds to the Visual Studio 2015 compiler tool set, whe
200200
201201
In order to build the non-UWP projects with Visual Studio 2015 you will need to modify the file called `Build.Windows.ProjectConfiguration.props` to change the value of the `PlatformToolset` property. Note however that Visual Studio 2017 is required for building the UWP projects.
202202
203-
> :point_right: **Note**: Using older versions of the MSVC compiler is generally not recommended due to the improved support for the C++11 standard in newer versions of the compiler.
203+
> :point_right: **Note**: Using older versions of the MSVC compiler is generally not recommended due to the improved support for the C++17 standard in newer versions of the compiler.
204204
205205
### Re-targeting the Windows 10 SDK for the UWP projects
206206

icu4c/build_qnx/build-hooks

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function hook_preconfigure {
1515

1616
CFLAGS="$CFLAGS -fPIC"
1717
CPPFLAGS="$CPPFLAGS -fPIC"
18-
CXXFLAGS="$CXXFLAGS -std=gnu++11"
18+
CXXFLAGS="$CXXFLAGS -std=gnu++17"
1919
else
2020
# prefix is the base path where architecture independent files are installed in the target filesystem
2121
configure_opts="${configure_opts} --prefix=/"

icu4c/source/Doxyfile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2084,7 +2084,7 @@ PREDEFINED = U_EXPORT2= \
20842084
U_DEFINE_LOCAL_OPEN_POINTER()= \
20852085
U_IN_DOXYGEN=1 \
20862086
U_CHAR16_IS_TYPEDEF=0 \
2087-
U_CPLUSPLUS_VERSION=11 \
2087+
U_CPLUSPLUS_VERSION=17 \
20882088
U_WCHAR_IS_UTF16
20892089

20902090
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this

icu4c/source/common/unicode/platform.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,8 @@
507507
/* Otherwise use the predefined value. */
508508
#elif !defined(__cplusplus)
509509
# define U_CPLUSPLUS_VERSION 0
510+
#elif __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
511+
# define U_CPLUSPLUS_VERSION 17
510512
#elif __cplusplus >= 201402L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)
511513
# define U_CPLUSPLUS_VERSION 14
512514
#elif __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L)

icu4c/source/config/mh-solaris

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
## Copyright (c) 1999-2010, International Business Machines Corporation and
66
## others. All Rights Reserved.
77

8-
## Flags for ICU 59+
9-
CXXFLAGS += -std=c++11
8+
## Flags for ICU 75+
9+
CXXFLAGS += -std=c++17
1010
CFLAGS += -std=c11
1111

1212
## Flags for position independent code

icu4c/source/configure.ac

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ AC_SUBST(ENABLE_RELEASE)
148148

149149
# Checks for compilers
150150
AC_PROG_CC([clang gcc cc c99 c89 xlc_r xlc cl.exe icc])
151-
# Make sure that we try clang++ first, which provides C++11 support.
152-
# The g++ compiler is less likely to support C++11.
151+
# Make sure that we try clang++ first, which provides C++17 support.
152+
# The g++ compiler is less likely to support C++17.
153153
AC_PROG_CXX([clang++ g++ c++ gpp xlC_r xlC aCC CC cxx cc++ cl.exe icc FCC KCC RCC])
154154

155155
# pkg-config is needed for harfbuzz support
@@ -513,17 +513,17 @@ else
513513
fi
514514

515515
if [[ "$GXX" = yes ]]; then
516-
# if CXXFLAGS does not have a "-std=" setting, set it now to -std=c++11,
516+
# if CXXFLAGS does not have a "-std=" setting, set it now to -std=c++17,
517517
# and check that the compiler still works.
518518
if ! echo "$CXXFLAGS" | grep '\-std=' >/dev/null 2>&1; then
519519
OLD_CXXFLAGS="${CXXFLAGS}"
520-
CXXFLAGS="$CXXFLAGS -std=c++11"
521-
AC_MSG_CHECKING([[if we have a C++11 compiler]])
522-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[cxx11_okay=yes],[cxx11_okay=no])
523-
AC_MSG_RESULT($cxx11_okay)
524-
if [[ $cxx11_okay = yes ]]; then
525-
AC_MSG_NOTICE([Adding CXXFLAGS option -std=c++11])
526-
UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} -std=c++11"
520+
CXXFLAGS="$CXXFLAGS -std=c++17"
521+
AC_MSG_CHECKING([[if we have a C++17 compiler]])
522+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[cxx17_okay=yes],[cxx17_okay=no])
523+
AC_MSG_RESULT($cxx17_okay)
524+
if [[ $cxx17_okay = yes ]]; then
525+
AC_MSG_NOTICE([Adding CXXFLAGS option -std=c++17])
526+
UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} -std=c++17"
527527
else
528528
CXXFLAGS="$OLD_CXXFLAGS"
529529
fi

icu4c/source/test/depstest/dependencies.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ group: cplusplus
125125
# even when no code actually uses it.
126126
# ICU must not _use_ the global operator delete.
127127
"operator delete(void*)"
128+
"operator delete(void*, unsigned long)"
128129
# ICU also must not use the global operator new.
129130
# "operator new[](unsigned long)"
130131

icu4c/source/test/hdrtst/testinternalheaders.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ for file in `ls common/*.h`; do
1717
echo $file
1818
echo '#include "'$file'"' > ht_temp.cpp ;
1919
echo 'void noop() {}' >> ht_temp.cpp ;
20-
$CXX -c -std=c++11 -I common -DU_COMMON_IMPLEMENTATION -O0 ht_temp.cpp ;
20+
$CXX -c -std=c++17 -I common -DU_COMMON_IMPLEMENTATION -O0 ht_temp.cpp ;
2121
if [ $? != 0 ] ; then
2222
ERROR_EXIT=1
2323
fi
@@ -27,7 +27,7 @@ for file in `ls i18n/*.h`; do
2727
echo $file
2828
echo '#include "'$file'"' > ht_temp.cpp ;
2929
echo 'void noop() {}' >> ht_temp.cpp ;
30-
$CXX -c -std=c++11 -I common -I i18n -DU_I18N_IMPLEMENTATION -O0 ht_temp.cpp ;
30+
$CXX -c -std=c++17 -I common -I i18n -DU_I18N_IMPLEMENTATION -O0 ht_temp.cpp ;
3131
if [ $? != 0 ] ; then
3232
ERROR_EXIT=1
3333
fi
@@ -37,7 +37,7 @@ for file in `ls io/*.h`; do
3737
echo $file
3838
echo '#include "'$file'"' > ht_temp.cpp ;
3939
echo 'void noop() {}' >> ht_temp.cpp ;
40-
$CXX -c -std=c++11 -I common -I i18n -I io -DU_IO_IMPLEMENTATION -O0 ht_temp.cpp ;
40+
$CXX -c -std=c++17 -I common -I i18n -I io -DU_IO_IMPLEMENTATION -O0 ht_temp.cpp ;
4141
if [ $? != 0 ] ; then
4242
ERROR_EXIT=1
4343
fi
@@ -61,7 +61,7 @@ for file in `ls tools/toolutil/*.h`; do
6161
echo $file
6262
echo '#include "'$file'"' > ht_temp.cpp ;
6363
echo 'void noop() {}' >> ht_temp.cpp ;
64-
$CXX -c -std=c++11 -I common -I i18n -I io -I tools/toolutil -O0 ht_temp.cpp ;
64+
$CXX -c -std=c++17 -I common -I i18n -I io -I tools/toolutil -O0 ht_temp.cpp ;
6565
if [ $? != 0 ] ; then
6666
ERROR_EXIT=1
6767
fi
@@ -78,7 +78,7 @@ for tool in escapesrc genccode gencmn gencolusb gennorm2 genren gentest icupkg i
7878
echo $file
7979
echo '#include "'$file'"' > ht_temp.cpp ;
8080
echo 'void noop() {}' >> ht_temp.cpp ;
81-
$CXX -c -std=c++11 -I common -I i18n -I io -I tools/toolutil -I tools/$tool -O0 ht_temp.cpp ;
81+
$CXX -c -std=c++17 -I common -I i18n -I io -I tools/toolutil -I tools/$tool -O0 ht_temp.cpp ;
8282
if [ $? != 0 ] ; then
8383
ERROR_EXIT=1
8484
fi
@@ -91,7 +91,7 @@ for file in `ls tools/ctestfw/unicode/*.h`; do
9191
echo $file
9292
echo '#include "'$file'"' > ht_temp.cpp ;
9393
echo 'void noop() {}' >> ht_temp.cpp ;
94-
$CXX -c -std=c++11 -I common -I i18n -I io -I tools/toolutil -I tools/ctestfw -O0 ht_temp.cpp ;
94+
$CXX -c -std=c++17 -I common -I i18n -I io -I tools/toolutil -I tools/ctestfw -O0 ht_temp.cpp ;
9595
if [ $? != 0 ] ; then
9696
ERROR_EXIT=1
9797
fi
@@ -113,7 +113,7 @@ for test in intltest iotest testmap thaitest fuzzer; do
113113
echo $file
114114
echo '#include "'$file'"' > ht_temp.cpp ;
115115
echo 'void noop() {}' >> ht_temp.cpp ;
116-
$CXX -c -std=c++11 -I common -I i18n -I io -I tools/toolutil -I tools/ctestfw -I test/$test -O0 ht_temp.cpp ;
116+
$CXX -c -std=c++17 -I common -I i18n -I io -I tools/toolutil -I tools/ctestfw -I test/$test -O0 ht_temp.cpp ;
117117
if [ $? != 0 ] ; then
118118
ERROR_EXIT=1
119119
fi

tools/unicode/c/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# created by: Markus W. Scherer
88
cmake_minimum_required(VERSION 2.6)
99
project(ICU_UNI_TOOLS)
10-
set(CMAKE_CXX_FLAGS "-std=c++11 -fsanitize=bounds")
10+
set(CMAKE_CXX_FLAGS "-std=c++17 -fsanitize=bounds")
1111
set(CMAKE_LD_FLAGS "-fsanitize=bounds")
1212
# This requires an icudefs.txt file with contents like the following:
1313
# Location (--prefix) of where ICU was installed.

0 commit comments

Comments
 (0)