]> granicus.if.org Git - icu/commitdiff
ICU-13104 remove U_HAVE_RVALUE_REFERENCES definition & conditions.
authorAndy Heninger <andy.heninger@gmail.com>
Wed, 26 Apr 2017 20:23:44 +0000 (20:23 +0000)
committerAndy Heninger <andy.heninger@gmail.com>
Wed, 26 Apr 2017 20:23:44 +0000 (20:23 +0000)
X-SVN-Rev: 40077

icu4c/source/Doxyfile.in
icu4c/source/common/cmemory.h
icu4c/source/common/unicode/localpointer.h
icu4c/source/common/unicode/platform.h
icu4c/source/common/unicode/unistr.h
icu4c/source/common/unistr.cpp
icu4c/source/test/intltest/itutil.cpp
icu4c/source/test/intltest/ustrtest.cpp

index df543e80f5fed6ec39326ff7ffe488d82c9e7e64..b32e2ab73da429ce9423a3156a0dbc7f1bb9a98f 100644 (file)
@@ -194,7 +194,7 @@ EXPAND_ONLY_PREDEF     = YES
 SEARCH_INCLUDES        = YES
 INCLUDE_PATH           = 
 INCLUDE_FILE_PATTERNS  = 
-PREDEFINED             = U_EXPORT2= U_STABLE= U_DRAFT= U_INTERNAL= U_SYSTEM= U_DEPRECATED= U_OBSOLETE= U_CALLCONV= U_CDECL_BEGIN= U_CDECL_END=  U_NO_THROW=\  "U_NAMESPACE_BEGIN=namespace icu{" "U_NAMESPACE_END=}" U_SHOW_CPLUSPLUS_API=1 U_DEFINE_LOCAL_OPEN_POINTER()= U_IN_DOXYGEN=1 U_OVERRIDE=override U_FINAL=final UCONFIG_ENABLE_PLUGINS=1 U_CHAR16_IS_TYPEDEF=0 U_CPLUSPLUS_VERSION=11 U_HAVE_RVALUE_REFERENCES=1 U_WCHAR_IS_UTF16
+PREDEFINED             = U_EXPORT2= U_STABLE= U_DRAFT= U_INTERNAL= U_SYSTEM= U_DEPRECATED= U_OBSOLETE= U_CALLCONV= U_CDECL_BEGIN= U_CDECL_END=  U_NO_THROW=\  "U_NAMESPACE_BEGIN=namespace icu{" "U_NAMESPACE_END=}" U_SHOW_CPLUSPLUS_API=1 U_DEFINE_LOCAL_OPEN_POINTER()= U_IN_DOXYGEN=1 U_OVERRIDE=override U_FINAL=final UCONFIG_ENABLE_PLUGINS=1 U_CHAR16_IS_TYPEDEF=0 U_CPLUSPLUS_VERSION=11 U_WCHAR_IS_UTF16
 EXPAND_AS_DEFINED      = 
 SKIP_FUNCTION_MACROS   = YES
 #---------------------------------------------------------------------------
index 665a82276927a481324e5e568397af52c8ffcc4e..a3cedd8f91b45b9b076a4c0c5c414234d4adccd5 100644 (file)
@@ -162,7 +162,6 @@ public:
      * @param p simple pointer to an array of T items that is adopted
      */
     explicit LocalMemory(T *p=NULL) : LocalPointerBase<T>(p) {}
-#if U_HAVE_RVALUE_REFERENCES
     /**
      * Move constructor, leaves src with isNull().
      * @param src source smart pointer
@@ -170,14 +169,12 @@ public:
     LocalMemory(LocalMemory<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
         src.ptr=NULL;
     }
-#endif
     /**
      * Destructor deletes the memory it owns.
      */
     ~LocalMemory() {
         uprv_free(LocalPointerBase<T>::ptr);
     }
-#if U_HAVE_RVALUE_REFERENCES
     /**
      * Move assignment operator, leaves src with isNull().
      * The behavior is undefined if *this and src are the same object.
@@ -187,7 +184,6 @@ public:
     LocalMemory<T> &operator=(LocalMemory<T> &&src) U_NOEXCEPT {
         return moveFrom(src);
     }
-#endif
     /**
      * Move assignment, leaves src with isNull().
      * The behavior is undefined if *this and src are the same object.
index 3ab820188f7f2387d3e05c09062f9dc469e34f1e..e17ee3d886ef34df04f891ceb8e0b7cfb88c05a9 100644 (file)
@@ -213,7 +213,6 @@ public:
             errorCode=U_MEMORY_ALLOCATION_ERROR;
         }
     }
-#if U_HAVE_RVALUE_REFERENCES
     /**
      * Move constructor, leaves src with isNull().
      * @param src source smart pointer
@@ -222,7 +221,6 @@ public:
     LocalPointer(LocalPointer<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
         src.ptr=NULL;
     }
-#endif
     /**
      * Destructor deletes the object it owns.
      * @stable ICU 4.4
@@ -230,7 +228,6 @@ public:
     ~LocalPointer() {
         delete LocalPointerBase<T>::ptr;
     }
-#if U_HAVE_RVALUE_REFERENCES
     /**
      * Move assignment operator, leaves src with isNull().
      * The behavior is undefined if *this and src are the same object.
@@ -241,7 +238,6 @@ public:
     LocalPointer<T> &operator=(LocalPointer<T> &&src) U_NOEXCEPT {
         return moveFrom(src);
     }
-#endif
     // do not use #ifndef U_HIDE_DRAFT_API for moveFrom, needed by non-draft API
     /**
      * Move assignment, leaves src with isNull().
@@ -362,7 +358,6 @@ public:
             errorCode=U_MEMORY_ALLOCATION_ERROR;
         }
     }
-#if U_HAVE_RVALUE_REFERENCES
     /**
      * Move constructor, leaves src with isNull().
      * @param src source smart pointer
@@ -371,7 +366,6 @@ public:
     LocalArray(LocalArray<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
         src.ptr=NULL;
     }
-#endif
     /**
      * Destructor deletes the array it owns.
      * @stable ICU 4.4
@@ -379,7 +373,6 @@ public:
     ~LocalArray() {
         delete[] LocalPointerBase<T>::ptr;
     }
-#if U_HAVE_RVALUE_REFERENCES
     /**
      * Move assignment operator, leaves src with isNull().
      * The behavior is undefined if *this and src are the same object.
@@ -390,7 +383,6 @@ public:
     LocalArray<T> &operator=(LocalArray<T> &&src) U_NOEXCEPT {
         return moveFrom(src);
     }
-#endif
     // do not use #ifndef U_HIDE_DRAFT_API for moveFrom, needed by non-draft API
     /**
      * Move assignment, leaves src with isNull().
@@ -492,7 +484,6 @@ public:
  * @see LocalPointer
  * @stable ICU 4.4
  */
-#if U_HAVE_RVALUE_REFERENCES
 #define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction) \
     class LocalPointerClassName : public LocalPointerBase<Type> { \
     public: \
@@ -526,34 +517,6 @@ public:
             ptr=p; \
         } \
     }
-#else
-#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction) \
-    class LocalPointerClassName : public LocalPointerBase<Type> { \
-    public: \
-        using LocalPointerBase<Type>::operator*; \
-        using LocalPointerBase<Type>::operator->; \
-        explicit LocalPointerClassName(Type *p=NULL) : LocalPointerBase<Type>(p) {} \
-        ~LocalPointerClassName() { closeFunction(ptr); } \
-        LocalPointerClassName &moveFrom(LocalPointerClassName &src) U_NOEXCEPT { \
-            if (ptr != NULL) { closeFunction(ptr); } \
-            LocalPointerBase<Type>::ptr=src.ptr; \
-            src.ptr=NULL; \
-            return *this; \
-        } \
-        void swap(LocalPointerClassName &other) U_NOEXCEPT { \
-            Type *temp=LocalPointerBase<Type>::ptr; \
-            LocalPointerBase<Type>::ptr=other.ptr; \
-            other.ptr=temp; \
-        } \
-        friend inline void swap(LocalPointerClassName &p1, LocalPointerClassName &p2) U_NOEXCEPT { \
-            p1.swap(p2); \
-        } \
-        void adoptInstead(Type *p) { \
-            if (ptr != NULL) { closeFunction(ptr); } \
-            ptr=p; \
-        } \
-    }
-#endif
 
 U_NAMESPACE_END
 
index 057182d31da22cf0494c0f679670d15bb932febc..5cb56c52fba3c03314854974bff1c13e6702eba4 100644 (file)
@@ -505,22 +505,6 @@ namespace std {
 };
 #endif
 
-/**
- * \def U_HAVE_RVALUE_REFERENCES
- * Set to 1 if the compiler supports rvalue references.
- * C++11 feature, necessary for move constructor & move assignment.
- * @internal
- */
-#ifdef U_HAVE_RVALUE_REFERENCES
-    /* Use the predefined value. */
-#elif U_CPLUSPLUS_VERSION >= 11 || __has_feature(cxx_rvalue_references) \
-        || defined(__GXX_EXPERIMENTAL_CXX0X__) \
-        || (defined(_MSC_VER) && _MSC_VER >= 1600)  /* Visual Studio 2010 */
-#   define U_HAVE_RVALUE_REFERENCES 1
-#else
-#   define U_HAVE_RVALUE_REFERENCES 0
-#endif
-
 /**
  * \def U_NOEXCEPT
  * "noexcept" if supported, otherwise empty.
index e0ab0b9eb7c633d76194c52f56bb467c5e8387c6..c4bf0d44f96ffa08f8bb0a6f5d6afc19d41cd286 100644 (file)
@@ -1901,7 +1901,6 @@ public:
    */
   UnicodeString &fastCopyFrom(const UnicodeString &src);
 
-#if U_HAVE_RVALUE_REFERENCES
   /**
    * Move assignment operator, might leave src in bogus state.
    * This string will have the same contents and state that the source string had.
@@ -1913,7 +1912,7 @@ public:
   UnicodeString &operator=(UnicodeString &&src) U_NOEXCEPT {
     return moveFrom(src);
   }
-#endif
+
   // do not use #ifndef U_HIDE_DRAFT_API for moveFrom, needed by non-draft API
   /**
    * Move assignment, might leave src in bogus state.
@@ -3360,7 +3359,6 @@ public:
    */
   UnicodeString(const UnicodeString& that);
 
-#if U_HAVE_RVALUE_REFERENCES
   /**
    * Move constructor, might leave src in bogus state.
    * This string will have the same contents and state that the source string had.
@@ -3368,7 +3366,6 @@ public:
    * @stable ICU 56
    */
   UnicodeString(UnicodeString &&src) U_NOEXCEPT;
-#endif
 
   /**
    * 'Substring' constructor from tail of source string.
index 1bfb71aa107b43812e1d6ffa28ce151209d05f95..5d7cab2e155ccc21aed8592bdfc61f687b5d0e69 100644 (file)
@@ -308,12 +308,10 @@ UnicodeString::UnicodeString(const UnicodeString& that) {
   copyFrom(that);
 }
 
-#if U_HAVE_RVALUE_REFERENCES
 UnicodeString::UnicodeString(UnicodeString &&src) U_NOEXCEPT {
   fUnion.fFields.fLengthAndFlags = kShortString;
   moveFrom(src);
 }
-#endif
 
 UnicodeString::UnicodeString(const UnicodeString& that,
                              int32_t srcStart) {
index d8e7b06e67a532642be129f7f37d482e6daaf3b7..5508175ece85b54c2a78ca8aa86c67c6f5dc07af 100644 (file)
@@ -375,7 +375,6 @@ void LocalPointerTest::TestLocalPointerMoveSwap() {
     if(s3.getAlias() != p1 || s1.isValid()) {
         errln("LocalPointer.moveFrom() did not move");
     }
-#if U_HAVE_RVALUE_REFERENCES
     infoln("TestLocalPointerMoveSwap() with rvalue references");
     s1 = static_cast<LocalPointer<UnicodeString> &&>(s3);
     if(s1.getAlias() != p1 || s3.isValid()) {
@@ -385,9 +384,6 @@ void LocalPointerTest::TestLocalPointerMoveSwap() {
     if(s4.getAlias() != p2 || s2.isValid()) {
         errln("LocalPointer move constructor did not move");
     }
-#else
-    infoln("TestLocalPointerMoveSwap() without rvalue references");
-#endif
 
     // Move self assignment leaves the object valid but in an undefined state.
     // Do it to make sure there is no crash,
@@ -472,7 +468,6 @@ void LocalPointerTest::TestLocalArrayMoveSwap() {
     if(a3.getAlias() != p1 || a1.isValid()) {
         errln("LocalArray.moveFrom() did not move");
     }
-#if U_HAVE_RVALUE_REFERENCES
     infoln("TestLocalArrayMoveSwap() with rvalue references");
     a1 = static_cast<LocalArray<UnicodeString> &&>(a3);
     if(a1.getAlias() != p1 || a3.isValid()) {
@@ -482,9 +477,6 @@ void LocalPointerTest::TestLocalArrayMoveSwap() {
     if(a4.getAlias() != p2 || a2.isValid()) {
         errln("LocalArray move constructor did not move");
     }
-#else
-    infoln("TestLocalArrayMoveSwap() without rvalue references");
-#endif
 
     // Move self assignment leaves the object valid but in an undefined state.
     // Do it to make sure there is no crash,
@@ -644,7 +636,6 @@ void LocalPointerTest::TestLocalXyzPointerMoveSwap() {
     if(f3.getAlias() != p1 || f1.isValid()) {
         errln("LocalUNormalizer2Pointer.moveFrom() did not move");
     }
-#if U_HAVE_RVALUE_REFERENCES
     infoln("TestLocalXyzPointerMoveSwap() with rvalue references");
     f1 = static_cast<LocalUNormalizer2Pointer &&>(f3);
     if(f1.getAlias() != p1 || f3.isValid()) {
@@ -654,9 +645,6 @@ void LocalPointerTest::TestLocalXyzPointerMoveSwap() {
     if(f4.getAlias() != p2 || f2.isValid()) {
         errln("LocalUNormalizer2Pointer move constructor did not move");
     }
-#else
-    infoln("TestLocalXyzPointerMoveSwap() without rvalue references");
-#endif
     // Move self assignment leaves the object valid but in an undefined state.
     // Do it to make sure there is no crash,
     // but do not check for any particular resulting value.
index d3734fbf2bef4c4b9fa877221549531c4cd586f5..a222e2a2905d5c0c6267e9844309f62bcd466938 100644 (file)
@@ -2160,7 +2160,6 @@ UnicodeStringTest::TestMoveSwap() {
     if(s6.getBuffer() != abc || s6.length() != 3) {
         errln("UnicodeString.moveFrom(alias) did not move");
     }
-#if U_HAVE_RVALUE_REFERENCES
     infoln("TestMoveSwap() with rvalue references");
     s1 = static_cast<UnicodeString &&>(s6);
     if(s1.getBuffer() != abc || s1.length() != 3) {
@@ -2170,10 +2169,6 @@ UnicodeStringTest::TestMoveSwap() {
     if(s7.getBuffer() != p || s7.length() != 100 || !s4.isBogus()) {
         errln("UnicodeString move constructor did not move");
     }
-#else
-    infoln("TestMoveSwap() without rvalue references");
-    UnicodeString s7;
-#endif
 
     // Move self assignment leaves the object valid but in an undefined state.
     // Do it to make sure there is no crash,