From 7d2fe3819cfd7e08addcff856eb25761d7029d8f Mon Sep 17 00:00:00 2001
From: Andy Heninger <andy.heninger@gmail.com>
Date: Fri, 16 Dec 2016 00:03:11 +0000
Subject: [PATCH] ICU-12643 ICU4C, require C++11 to build.

X-SVN-Rev: 39543
---
 icu4c/source/common/unicode/unistr.h | 22 +++++++---------------
 icu4c/source/configure               | 10 +++++-----
 icu4c/source/configure.ac            |  8 ++++----
 icu4c/source/runConfigureICU         |  1 -
 4 files changed, 16 insertions(+), 25 deletions(-)

diff --git a/icu4c/source/common/unicode/unistr.h b/icu4c/source/common/unicode/unistr.h
index 6f62244a1e2..c0981e28f46 100644
--- a/icu4c/source/common/unicode/unistr.h
+++ b/icu4c/source/common/unicode/unistr.h
@@ -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++.
diff --git a/icu4c/source/configure b/icu4c/source/configure
index 29732a1448a..b28f3286721 100755
--- a/icu4c/source/configure
+++ b/icu4c/source/configure
@@ -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
diff --git a/icu4c/source/configure.ac b/icu4c/source/configure.ac
index eb62936565b..f1494d572f6 100644
--- a/icu4c/source/configure.ac
+++ b/icu4c/source/configure.ac
@@ -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
diff --git a/icu4c/source/runConfigureICU b/icu4c/source/runConfigureICU
index 73f2c9a9642..abe8832b662 100755
--- a/icu4c/source/runConfigureICU
+++ b/icu4c/source/runConfigureICU
@@ -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)
-- 
2.40.0