ICU-12643 ICU4C, require C++11 to build.

X-SVN-Rev: 39543
This commit is contained in:
Andy Heninger 2016-12-16 00:03:11 +00:00
parent 68401040eb
commit 7d2fe3819c
4 changed files with 16 additions and 25 deletions

View File

@ -99,10 +99,12 @@ class UnicodeStringAppendable; // unicode/appendable.h
/**
* Unicode String literals in C++.
* Dependent on the platform properties, different UnicodeString
* constructors should be used to create a UnicodeString object from
* a string literal.
* The macros are defined for maximum performance.
*
* Note: these macros are not recommended for new code.
* Prior to the availability of C++11 and u"unicode string literals",
* these macros were provided for portability and efficiency when
* initializing UnicodeStrings from literals.
*
* They work only for strings that contain "invariant characters", i.e.,
* only latin letters, digits, and some punctuation.
* See utypes.h for details.
@ -110,19 +112,9 @@ class UnicodeStringAppendable; // unicode/appendable.h
* The string parameter must be a C string literal.
* The length of the string, not including the terminating
* <code>NUL</code>, must be specified as a constant.
* The U_STRING_DECL macro should be invoked exactly once for one
* such string variable before it is used.
* @stable ICU 2.0
*/
#if defined(U_DECLARE_UTF16)
# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const UChar *)U_DECLARE_UTF16(cs), _length)
#elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16)))
# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const UChar *)L ## cs, _length)
#elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY
# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const UChar *)cs, _length)
#else
# define UNICODE_STRING(cs, _length) icu::UnicodeString(cs, _length, US_INV)
#endif
#define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const UChar *)u ## cs, _length)
/**
* Unicode String literals in C++.

View File

@ -5917,11 +5917,11 @@ $as_echo "no" >&6; }
fi
if [ "$GXX" = yes ]; then
# if CXXFLAGS does not have a "-std=" setting, set it now to -std=c++0x,
# if CXXFLAGS does not have a "-std=" setting, set it now to -std=c++11,
# and check that the compiler still works.
if ! echo "$CXXFLAGS" | grep '\-std=' >/dev/null 2>&1; then
OLD_CXXFLAGS="${CXXFLAGS}"
CXXFLAGS="$CXXFLAGS --std=c++0x"
CXXFLAGS="$CXXFLAGS -std=c++11"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have a C++11 compiler" >&5
$as_echo_n "checking if we have a C++11 compiler... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@ -5944,9 +5944,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cxx11_okay" >&5
$as_echo "$cxx11_okay" >&6; }
if [ $cxx11_okay = yes ]; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Adding CXXFLAGS option --std=c++0x" >&5
$as_echo "$as_me: Adding CXXFLAGS option --std=c++0x" >&6;}
UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} --std=c++0x"
{ $as_echo "$as_me:${as_lineno-$LINENO}: Adding CXXFLAGS option -std=c++11" >&5
$as_echo "$as_me: Adding CXXFLAGS option -std=c++11" >&6;}
UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} -std=c++11"
else
CXXFLAGS="$OLD_CXXFLAGS"
fi

View File

@ -492,17 +492,17 @@ else
fi
if [[ "$GXX" = yes ]]; then
# if CXXFLAGS does not have a "-std=" setting, set it now to -std=c++0x,
# if CXXFLAGS does not have a "-std=" setting, set it now to -std=c++11,
# and check that the compiler still works.
if ! echo "$CXXFLAGS" | grep '\-std=' >/dev/null 2>&1; then
OLD_CXXFLAGS="${CXXFLAGS}"
CXXFLAGS="$CXXFLAGS --std=c++0x"
CXXFLAGS="$CXXFLAGS -std=c++11"
AC_MSG_CHECKING([[if we have a C++11 compiler]])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[cxx11_okay=yes],[cxx11_okay=no])
AC_MSG_RESULT($cxx11_okay)
if [[ $cxx11_okay = yes ]]; then
AC_MSG_NOTICE([Adding CXXFLAGS option --std=c++0x])
UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} --std=c++0x"
AC_MSG_NOTICE([Adding CXXFLAGS option -std=c++11])
UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} -std=c++11"
else
CXXFLAGS="$OLD_CXXFLAGS"
fi

View File

@ -315,7 +315,6 @@ case $platform in
THE_COMP="the GNU C++"
RELEASE_CFLAGS='-O3'
RELEASE_CXXFLAGS='-O3'
CXXFLAGS="--std=c++03"
export CXXFLAGS
;;
MSYS/MSVC)