diff options
Diffstat (limited to 'external/icu/icu4c-64-54558d1dd01b29c763ca12b6327108fe3ac66637.patch.2')
-rw-r--r-- | external/icu/icu4c-64-54558d1dd01b29c763ca12b6327108fe3ac66637.patch.2 | 268 |
1 files changed, 268 insertions, 0 deletions
diff --git a/external/icu/icu4c-64-54558d1dd01b29c763ca12b6327108fe3ac66637.patch.2 b/external/icu/icu4c-64-54558d1dd01b29c763ca12b6327108fe3ac66637.patch.2 new file mode 100644 index 000000000000..5b9a830f6112 --- /dev/null +++ b/external/icu/icu4c-64-54558d1dd01b29c763ca12b6327108fe3ac66637.patch.2 @@ -0,0 +1,268 @@ +From 54558d1dd01b29c763ca12b6327108fe3ac66637 Mon Sep 17 00:00:00 2001 +From: Alon Bar-Lev <alon.barlev@gmail.com> +Date: Sat, 30 Mar 2019 09:59:46 +0300 +Subject: [PATCH] ICU-20530 Re-support include under extern "C" + +Up until icu-6.3 icu supported include under extern "C" under the explicit +requirements, see comment of U_NAMESPACE_BEGIN at uversion.h: + + * \def U_NAMESPACE_BEGIN + * This is used to begin a declaration of a public ICU C++ API. + * When not compiling for C++, it does nothing. + * When compiling for C++, it begins an extern "C++" linkage block (to protect + * against cases in which an external client includes ICU header files inside + * an extern "C" linkage block). + * + * It also begins a versioned-ICU-namespace block. + * @stable ICU 2.4 + +Recent changes were made to include C++ headers within global scope which +broke this behavior. + +To keep requested behavior add two additional macros U_CXX_BEGIN, U_CXX_END to +avoid breakage of doxygen while enforcing C++ API visibility. + +Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com> +--- + icu4c/source/common/unicode/char16ptr.h | 5 +++- + icu4c/source/common/unicode/localpointer.h | 2 ++ + icu4c/source/common/unicode/std_string.h | 3 +++ + icu4c/source/common/unicode/umachine.h | 25 +++++++++++++++++++ + icu4c/source/common/unicode/unistr.h | 5 +++- + icu4c/source/common/unicode/uversion.h | 15 ++++------- + .../i18n/unicode/numberrangeformatter.h | 5 +++- + icu4c/source/io/unicode/ustream.h | 2 ++ + icu4c/source/test/hdrtst/Makefile.in | 16 ++++++++++-- + 9 files changed, 63 insertions(+), 15 deletions(-) + +diff --git a/icu4c/source/common/unicode/char16ptr.h b/icu4c/source/common/unicode/char16ptr.h +index a7c5f1a0c5e..f774d7d8b21 100644 +--- a/icu4c/source/common/unicode/char16ptr.h ++++ b/icu4c/source/common/unicode/char16ptr.h +@@ -7,9 +7,12 @@ + #ifndef __CHAR16PTR_H__ + #define __CHAR16PTR_H__ + +-#include <cstddef> + #include "unicode/utypes.h" + ++U_CXX_BEGIN ++#include <cstddef> ++U_CXX_END ++ + /** + * \file + * \brief C++ API: char16_t pointer wrappers with +diff --git a/icu4c/source/common/unicode/localpointer.h b/icu4c/source/common/unicode/localpointer.h +index e011688b1a5..fd26dc40e9d 100644 +--- a/icu4c/source/common/unicode/localpointer.h ++++ b/icu4c/source/common/unicode/localpointer.h +@@ -42,7 +42,9 @@ + + #if U_SHOW_CPLUSPLUS_API + ++U_CXX_BEGIN + #include <memory> ++U_CXX_END + + U_NAMESPACE_BEGIN + +diff --git a/icu4c/source/common/unicode/std_string.h b/icu4c/source/common/unicode/std_string.h +index 729c5639950..d293e714fe0 100644 +--- a/icu4c/source/common/unicode/std_string.h ++++ b/icu4c/source/common/unicode/std_string.h +@@ -32,6 +32,9 @@ + #if defined(__GLIBCXX__) + namespace std { class type_info; } + #endif ++ ++U_CXX_BEGIN + #include <string> ++U_CXX_END + + #endif // __STD_STRING_H__ +diff --git a/icu4c/source/common/unicode/umachine.h b/icu4c/source/common/unicode/umachine.h +index 0205da62eb4..6137c125df4 100644 +--- a/icu4c/source/common/unicode/umachine.h ++++ b/icu4c/source/common/unicode/umachine.h +@@ -75,14 +75,39 @@ + * @stable ICU 2.4 + */ + ++/** ++ * \def U_CXX_BEGIN ++ * This is used to begin a C++ block. ++ * When not compiling for C++, it does nothing. ++ * When compiling for C++, it begins an extern "C++" linkage block (to protect ++ * against cases in which an external client includes ICU header files inside ++ * an extern "C" linkage block). ++ * ++ * @draft ICU 65 ++ */ ++ ++/** ++ * \def U_CXX_END ++ * This is used to end a declaration of a C++ API. ++ * When not compiling for C++, it does nothing. ++ * When compiling for C++, it ends the extern "C++" block begun by ++ * U_CXX_BEGIN. ++ * ++ * @draft ICU 65 ++ */ ++ + #ifdef __cplusplus + # define U_CFUNC extern "C" + # define U_CDECL_BEGIN extern "C" { + # define U_CDECL_END } ++# define U_CXX_BEGIN extern "C++" { ++# define U_CXX_END } + #else + # define U_CFUNC extern + # define U_CDECL_BEGIN + # define U_CDECL_END ++# define U_CXX_BEGIN ++# define U_CXX_END + #endif + + #ifndef U_ATTRIBUTE_DEPRECATED +diff --git a/icu4c/source/common/unicode/unistr.h b/icu4c/source/common/unicode/unistr.h +index d79168b9195..c323e33c07c 100644 +--- a/icu4c/source/common/unicode/unistr.h ++++ b/icu4c/source/common/unicode/unistr.h +@@ -28,7 +28,6 @@ + * \brief C++ API: Unicode String + */ + +-#include <cstddef> + #include "unicode/utypes.h" + #include "unicode/char16ptr.h" + #include "unicode/rep.h" +@@ -36,6 +35,10 @@ + #include "unicode/stringpiece.h" + #include "unicode/bytestream.h" + ++U_CXX_BEGIN ++#include <cstddef> ++U_CXX_END ++ + struct UConverter; // unicode/ucnv.h + + #ifndef USTRING_H +diff --git a/icu4c/source/common/unicode/uversion.h b/icu4c/source/common/unicode/uversion.h +index 4aaa8b4d606..9e6bd13734f 100644 +--- a/icu4c/source/common/unicode/uversion.h ++++ b/icu4c/source/common/unicode/uversion.h +@@ -64,13 +64,10 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]; + + /** + * \def U_NAMESPACE_BEGIN +- * This is used to begin a declaration of a public ICU C++ API. ++ * This is used to begin a declaration of a public ICU C++ API within ++ * versioned-ICU-namespace block. + * When not compiling for C++, it does nothing. +- * When compiling for C++, it begins an extern "C++" linkage block (to protect +- * against cases in which an external client includes ICU header files inside +- * an extern "C" linkage block). + * +- * It also begins a versioned-ICU-namespace block. + * @stable ICU 2.4 + */ + +@@ -78,10 +75,8 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]; + * \def U_NAMESPACE_END + * This is used to end a declaration of a public ICU C++ API. + * When not compiling for C++, it does nothing. +- * When compiling for C++, it ends the extern "C++" block begun by +- * U_NAMESPACE_BEGIN. ++ * It ends the versioned-ICU-namespace block begun by U_NAMESPACE_BEGIN. + * +- * It also ends the versioned-ICU-namespace block begun by U_NAMESPACE_BEGIN. + * @stable ICU 2.4 + */ + +@@ -116,8 +111,8 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]; + namespace icu = U_ICU_NAMESPACE; + # endif + +-# define U_NAMESPACE_BEGIN extern "C++" { namespace U_ICU_NAMESPACE { +-# define U_NAMESPACE_END } } ++# define U_NAMESPACE_BEGIN U_CXX_BEGIN namespace U_ICU_NAMESPACE { ++# define U_NAMESPACE_END } U_CXX_END + # define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE; + # define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE:: + +diff --git a/icu4c/source/i18n/unicode/numberrangeformatter.h b/icu4c/source/i18n/unicode/numberrangeformatter.h +index 4a386b80394..0c6eb62ae1f 100644 +--- a/icu4c/source/i18n/unicode/numberrangeformatter.h ++++ b/icu4c/source/i18n/unicode/numberrangeformatter.h +@@ -5,13 +5,16 @@ + #ifndef __NUMBERRANGEFORMATTER_H__ + #define __NUMBERRANGEFORMATTER_H__ + +-#include <atomic> + #include "unicode/appendable.h" + #include "unicode/fieldpos.h" + #include "unicode/formattedvalue.h" + #include "unicode/fpositer.h" + #include "unicode/numberformatter.h" + ++U_CXX_BEGIN ++#include <atomic> ++U_CXX_END ++ + #ifndef U_HIDE_DRAFT_API + + /** +diff --git a/icu4c/source/io/unicode/ustream.h b/icu4c/source/io/unicode/ustream.h +index c10ce6a2de5..e1ec87c75d3 100644 +--- a/icu4c/source/io/unicode/ustream.h ++++ b/icu4c/source/io/unicode/ustream.h +@@ -34,7 +34,9 @@ + namespace std { class type_info; } // WORKAROUND: http://llvm.org/bugs/show_bug.cgi?id=13364 + #endif + ++U_CXX_BEGIN + #include <iostream> ++U_CXX_END + + U_NAMESPACE_BEGIN + +diff --git a/icu4c/source/test/hdrtst/Makefile.in b/icu4c/source/test/hdrtst/Makefile.in +index 55e833943d5..a485f7a80d6 100644 +--- a/icu4c/source/test/hdrtst/Makefile.in ++++ b/icu4c/source/test/hdrtst/Makefile.in +@@ -53,7 +53,7 @@ E_DEP="[6/$(E_NUM)] Hide Deprecated: " + E_INT="[7/$(E_NUM)] Hide Internal: " + E_OBS="[8/$(E_NUM)] Hide Obsolete: " + +-check: dtest ctest cpptest doclean drafttest deprtest internaltest obsoletetest ++check: dtest ctest cpptest cpptest_extern_c doclean drafttest deprtest internaltest obsoletetest + ifeq ($(MAKECMDGOALS),check) + $(MAKE) clean + else +@@ -74,6 +74,18 @@ cpptest: + done ;\ + exit $$FAIL + ++cpptest_extern_c: ++ @FAIL=0;for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \ ++ incfile=`basename $$file .h` ; \ ++ echo "$@ unicode/$$incfile.h" ; \ ++ echo 'extern "C" {' > ht_$$incfile.cpp ; \ ++ echo '#include "'unicode/$$incfile'.h"' >> ht_$$incfile.cpp ; \ ++ echo '}' >> ht_$$incfile.cpp ; \ ++ echo 'void junk(){}' >> ht_$$incfile.cpp ; \ ++ $(COMPILE.cc) -c $(cppflags) ht_$$incfile.cpp || FAIL=1 ; \ ++ done ;\ ++ exit $$FAIL ++ + # layout is removed + + dtest: +@@ -170,5 +182,5 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +-.PHONY: doclean check all cpptest dtest ctest clean distclean ++.PHONY: doclean check all cpptest cpptest_extern_c dtest ctest clean distclean + |