]> granicus.if.org Git - icu/commitdiff
ICU-10086 prevent warning or error from g++ -pedantic for extra semicolon after non...
authorMarkus Scherer <markus.icu@gmail.com>
Thu, 28 May 2015 18:57:35 +0000 (18:57 +0000)
committerMarkus Scherer <markus.icu@gmail.com>
Thu, 28 May 2015 18:57:35 +0000 (18:57 +0000)
X-SVN-Rev: 37470

icu4c/source/common/unicode/localpointer.h

index 87df956ca0b7bbd6bd9949488ea050549318119c..a46a0d25d5f5565ecf0e227310c6dda11df0e270 100644 (file)
@@ -538,7 +538,8 @@ inline void swap(LocalArray<T> &p1, LocalArray<T> &p2) U_NOEXCEPT {
     }; \
     inline void swap(LocalPointerClassName &p1, LocalPointerClassName &p2) U_NOEXCEPT { \
         p1.swap(p2); \
-    }
+    } \
+    class LocalPointerClassName
 #else
 #define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction) \
     class LocalPointerClassName : public LocalPointerBase<Type> { \
@@ -563,8 +564,12 @@ inline void swap(LocalArray<T> &p1, LocalArray<T> &p2) U_NOEXCEPT {
     }; \
     inline void swap(LocalPointerClassName &p1, LocalPointerClassName &p2) U_NOEXCEPT { \
         p1.swap(p2); \
-    }
+    } \
+    class LocalPointerClassName
 #endif
+// The trailing class forward declaration at the end of U_DEFINE_LOCAL_OPEN_POINTER
+// prevents a warning or error from -pedantic compilation
+// due to an extra ';' after the non-member swap function definition.
 
 U_NAMESPACE_END