]> granicus.if.org Git - icu/commitdiff
ICU-12643 ICU4C, require C++11 to build.
authorAndy Heninger <andy.heninger@gmail.com>
Fri, 16 Dec 2016 00:03:11 +0000 (00:03 +0000)
committerAndy Heninger <andy.heninger@gmail.com>
Fri, 16 Dec 2016 00:03:11 +0000 (00:03 +0000)
X-SVN-Rev: 39543

icu4c/source/common/unicode/unistr.h
icu4c/source/configure
icu4c/source/configure.ac
icu4c/source/runConfigureICU

index 6f62244a1e2824c9d312c52f4187c94ad8c7a838..c0981e28f465b1f9c936561bec6d42bcb3134cca 100644 (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++.
index 29732a1448a35ce87cf0e862be12b6c61dcf16ed..b28f32867210b0a1f831db3592ceae40bfd9cb10 100755 (executable)
@@ -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
index eb62936565b3faaf9279c611b99cdc2d08be6626..f1494d572f6ecf060bc2d5262620aa13045846ea 100644 (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
index 73f2c9a9642a6df80415607ec784fc11a506f863..abe8832b662c3e4b6eef6b55384a47a65aacd6e4 100755 (executable)
@@ -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)