From a7d264944d0c902163f5910b90a4c053d27c1a54 Mon Sep 17 00:00:00 2001 From: Peter Edberg Date: Sat, 5 Mar 2016 00:06:07 +0000 Subject: [PATCH] ICU-12187 BRS task - Update conditionals for non-stable APIs (common); fix clang warnings X-SVN-Rev: 38495 --- icu4c/source/common/unicode/brkiter.h | 9 ++++-- .../source/common/unicode/bytestriebuilder.h | 4 +-- icu4c/source/common/unicode/localpointer.h | 4 +-- icu4c/source/common/unicode/simpleformatter.h | 4 +++ icu4c/source/common/unicode/uchar.h | 8 +++-- .../source/common/unicode/ucharstriebuilder.h | 2 -- icu4c/source/common/unicode/unistr.h | 14 ++++----- icu4c/source/common/unicode/unorm.h | 30 +++++++++---------- icu4c/source/i18n/dtptngen.cpp | 2 +- icu4c/source/test/intltest/locnmtst.cpp | 4 +-- 10 files changed, 43 insertions(+), 38 deletions(-) diff --git a/icu4c/source/common/unicode/brkiter.h b/icu4c/source/common/unicode/brkiter.h index 4aa5e552796..26ad182eaff 100644 --- a/icu4c/source/common/unicode/brkiter.h +++ b/icu4c/source/common/unicode/brkiter.h @@ -1,6 +1,6 @@ /* ******************************************************************************** -* Copyright (C) 1997-2014, International Business Machines +* Copyright (C) 1997-2016, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************** * @@ -291,7 +291,7 @@ public: virtual int32_t next(int32_t n) = 0; /** - * For RuleBasedBreakIterators, return the status tag from the + * For RuleBasedBreakIterators, return the status tag from the * break rule that determined the most recently * returned break position. *

@@ -307,7 +307,7 @@ public: virtual int32_t getRuleStatus() const; /** - * For RuleBasedBreakIterators, get the status (tag) values from the break rule(s) + * For RuleBasedBreakIterators, get the status (tag) values from the break rule(s) * that determined the most recently returned break position. *

* For break iterator types that do not support rule status, @@ -623,8 +623,11 @@ protected: BreakIterator(); /** @internal */ BreakIterator (const BreakIterator &other) : UObject(other) {} +#ifndef U_HIDE_INTERNAL_API /** @internal */ BreakIterator (const Locale& valid, const Locale& actual); +#endif /* U_HIDE_INTERNAL_API */ + private: /** @internal */ diff --git a/icu4c/source/common/unicode/bytestriebuilder.h b/icu4c/source/common/unicode/bytestriebuilder.h index 19795f106d7..e7fbd6b2371 100644 --- a/icu4c/source/common/unicode/bytestriebuilder.h +++ b/icu4c/source/common/unicode/bytestriebuilder.h @@ -141,7 +141,7 @@ private: virtual int32_t getMinLinearMatch() const { return BytesTrie::kMinLinearMatch; } virtual int32_t getMaxLinearMatchLength() const { return BytesTrie::kMaxLinearMatchLength; } -#ifndef U_HIDE_INTERNAL_API + // don't use #ifndef U_HIDE_INTERNAL_API with private class members /** * @internal */ @@ -154,9 +154,9 @@ private: const char *s; }; + // don't use #ifndef U_HIDE_INTERNAL_API with private class members or virtual methods. virtual Node *createLinearMatchNode(int32_t i, int32_t byteIndex, int32_t length, Node *nextNode) const; -#endif /* U_HIDE_INTERNAL_API */ UBool ensureCapacity(int32_t length); virtual int32_t write(int32_t byte); diff --git a/icu4c/source/common/unicode/localpointer.h b/icu4c/source/common/unicode/localpointer.h index ba884e5ef28..35e37765c23 100644 --- a/icu4c/source/common/unicode/localpointer.h +++ b/icu4c/source/common/unicode/localpointer.h @@ -268,6 +268,7 @@ public: LocalPointerBase::ptr=other.ptr; other.ptr=temp; } +#endif /* U_HIDE_DRAFT_API */ /** * Non-member LocalPointer swap function. * @param p1 will get p2's pointer @@ -277,7 +278,6 @@ public: friend inline void swap(LocalPointer &p1, LocalPointer &p2) U_NOEXCEPT { p1.swap(p2); } -#endif /* U_HIDE_DRAFT_API */ /** * Deletes the object it owns, * and adopts (takes ownership of) the one passed in. @@ -420,6 +420,7 @@ public: LocalPointerBase::ptr=other.ptr; other.ptr=temp; } +#endif /* U_HIDE_DRAFT_API */ /** * Non-member LocalArray swap function. * @param p1 will get p2's pointer @@ -429,7 +430,6 @@ public: friend inline void swap(LocalArray &p1, LocalArray &p2) U_NOEXCEPT { p1.swap(p2); } -#endif /* U_HIDE_DRAFT_API */ /** * Deletes the array it owns, * and adopts (takes ownership of) the one passed in. diff --git a/icu4c/source/common/unicode/simpleformatter.h b/icu4c/source/common/unicode/simpleformatter.h index c599dfc4b9b..7530cf796fc 100644 --- a/icu4c/source/common/unicode/simpleformatter.h +++ b/icu4c/source/common/unicode/simpleformatter.h @@ -17,6 +17,8 @@ #include "unicode/utypes.h" #include "unicode/unistr.h" +#ifndef U_HIDE_DRAFT_API + U_NAMESPACE_BEGIN /** @@ -288,4 +290,6 @@ private: U_NAMESPACE_END +#endif /* U_HIDE_DRAFT_API */ + #endif // __SIMPLEFORMATTER_H__ diff --git a/icu4c/source/common/unicode/uchar.h b/icu4c/source/common/unicode/uchar.h index 1836f92713a..61835840a33 100644 --- a/icu4c/source/common/unicode/uchar.h +++ b/icu4c/source/common/unicode/uchar.h @@ -397,6 +397,7 @@ typedef enum UProperty { UCHAR_CHANGES_WHEN_CASEMAPPED=55, /** Binary property Changes_When_NFKC_Casefolded. @stable ICU 4.4 */ UCHAR_CHANGES_WHEN_NFKC_CASEFOLDED=56, +#ifndef U_HIDE_DRAFT_API /** * Binary property Emoji. * See http://www.unicode.org/reports/tr51/#Emoji_Properties @@ -425,6 +426,7 @@ typedef enum UProperty { * @draft ICU 57 */ UCHAR_EMOJI_MODIFIER_BASE=60, +#endif /* U_HIDE_DRAFT_API */ /** One more than the last constant for binary Unicode properties. @stable ICU 2.1 */ UCHAR_BINARY_LIMIT=61, @@ -1211,7 +1213,7 @@ enum UBlockCode { * Unicode 4.0.1 renames the "Cyrillic Supplementary" block to "Cyrillic Supplement". * @stable ICU 2.2 */ - UBLOCK_CYRILLIC_SUPPLEMENTARY = UBLOCK_CYRILLIC_SUPPLEMENT, + UBLOCK_CYRILLIC_SUPPLEMENTARY = UBLOCK_CYRILLIC_SUPPLEMENT, /** @stable ICU 2.2 */ UBLOCK_TAGALOG = 98, /*[1700]*/ /** @stable ICU 2.2 */ @@ -1617,7 +1619,7 @@ typedef enum UEastAsianWidth { typedef enum UCharNameChoice { /** Unicode character name (Name property). @stable ICU 2.0 */ U_UNICODE_CHAR_NAME, -#ifndef U_HIDE_DEPRECATED_API +#ifndef U_HIDE_DEPRECATED_API /** * The Unicode_1_Name property value which is of little practical value. * Beginning with ICU 49, ICU APIs return an empty string for this name choice. @@ -2867,7 +2869,7 @@ u_charName(UChar32 code, UCharNameChoice nameChoice, char *buffer, int32_t bufferLength, UErrorCode *pErrorCode); -#ifndef U_HIDE_DEPRECATED_API +#ifndef U_HIDE_DEPRECATED_API /** * Returns an empty string. * Used to return the ISO 10646 comment for a character. diff --git a/icu4c/source/common/unicode/ucharstriebuilder.h b/icu4c/source/common/unicode/ucharstriebuilder.h index a9742758a37..f7a8039b776 100644 --- a/icu4c/source/common/unicode/ucharstriebuilder.h +++ b/icu4c/source/common/unicode/ucharstriebuilder.h @@ -148,7 +148,6 @@ private: virtual int32_t getMinLinearMatch() const { return UCharsTrie::kMinLinearMatch; } virtual int32_t getMaxLinearMatchLength() const { return UCharsTrie::kMaxLinearMatchLength; } -#ifndef U_HIDE_INTERNAL_API class UCTLinearMatchNode : public LinearMatchNode { public: UCTLinearMatchNode(const UChar *units, int32_t len, Node *nextNode); @@ -160,7 +159,6 @@ private: virtual Node *createLinearMatchNode(int32_t i, int32_t unitIndex, int32_t length, Node *nextNode) const; -#endif /* U_HIDE_INTERNAL_API */ UBool ensureCapacity(int32_t length); virtual int32_t write(int32_t unit); diff --git a/icu4c/source/common/unicode/unistr.h b/icu4c/source/common/unicode/unistr.h index 63f19335004..bf00974fddb 100644 --- a/icu4c/source/common/unicode/unistr.h +++ b/icu4c/source/common/unicode/unistr.h @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 1998-2015, International Business Machines +* Copyright (C) 1998-2016, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * @@ -22,8 +22,8 @@ #define UNISTR_H /** - * \file - * \brief C++ API: Unicode String + * \file + * \brief C++ API: Unicode String */ #include "unicode/utypes.h" @@ -172,7 +172,7 @@ class UnicodeStringAppendable; // unicode/appendable.h # endif #endif -/* Cannot make the following #ifndef U_HIDE_INTERNAL_API, +/* Cannot make the following #ifndef U_HIDE_DRAFT_API, it is used to construct other non-internal constants */ /** * \def UNISTR_OBJECT_SIZE @@ -234,7 +234,7 @@ class UnicodeStringAppendable; // unicode/appendable.h *

In ICU, a Unicode string consists of 16-bit Unicode code units. * A Unicode character may be stored with either one code unit * (the most common case) or with a matched pair of special code units - * ("surrogates"). The data type for code units is UChar. + * ("surrogates"). The data type for code units is UChar. * For single-character handling, a Unicode character code point is a value * in the range 0..0x10ffff. ICU uses the UChar32 type for code points.

* @@ -1529,7 +1529,7 @@ public: UnicodeString& target) const; /** - * Copy the characters in the range + * Copy the characters in the range * [start, start + startLength) into an array of characters. * All characters must be invariant (see utypes.h). * Use US_INV as the last, signature-distinguishing parameter. @@ -1934,6 +1934,7 @@ public: * @draft ICU 56 */ void swap(UnicodeString &other) U_NOEXCEPT; +#endif /* U_HIDE_DRAFT_API */ /** * Non-member UnicodeString swap function. @@ -1945,7 +1946,6 @@ public: swap(UnicodeString &s1, UnicodeString &s2) U_NOEXCEPT { s1.swap(s2); } -#endif /* U_HIDE_DRAFT_API */ /** * Assignment operator. Replace the characters in this UnicodeString diff --git a/icu4c/source/common/unicode/unorm.h b/icu4c/source/common/unicode/unorm.h index 4852538b3aa..ab3e34e84b3 100644 --- a/icu4c/source/common/unicode/unorm.h +++ b/icu4c/source/common/unicode/unorm.h @@ -1,6 +1,6 @@ /* ******************************************************************************* -* Copyright (c) 1996-2015, International Business Machines Corporation +* Copyright (c) 1996-2016, International Business Machines Corporation * and others. All Rights Reserved. ******************************************************************************* * File unorm.h @@ -26,7 +26,7 @@ /** * \file - * \brief C API: Unicode Normalization + * \brief C API: Unicode Normalization * * Old Unicode normalization API. * @@ -60,7 +60,7 @@ * * To a user of your program, however, both of these sequences should be * treated as the same "user-level" character "A with acute accent". When you are searching or - * comparing text, you must ensure that these two sequences are treated + * comparing text, you must ensure that these two sequences are treated * equivalently. In addition, you must handle characters with more than one * accent. Sometimes the order of a character's combining accents is * significant, while in other cases accent sequences in different orders are @@ -88,8 +88,8 @@ * will often want to use these mappings. * * unorm_normalize helps solve these problems by transforming text into the - * canonical composed and decomposed forms as shown in the first example above. - * In addition, you can have it perform compatibility decompositions so that + * canonical composed and decomposed forms as shown in the first example above. + * In addition, you can have it perform compatibility decompositions so that * you can treat compatibility characters the same as their equivalents. * Finally, unorm_normalize rearranges accents into the proper canonical * order, so that you do not have to worry about accent rearrangement on your @@ -129,14 +129,13 @@ * For more usage examples, see the Unicode Standard Annex. */ -#ifndef U_HIDE_DEPRECATED_API /** * Constants for normalization modes. * @deprecated ICU 56 Use unorm2.h instead. */ typedef enum { /** No decomposition/composition. @deprecated ICU 56 Use unorm2.h instead. */ - UNORM_NONE = 1, + UNORM_NONE = 1, /** Canonical decomposition. @deprecated ICU 56 Use unorm2.h instead. */ UNORM_NFD = 2, /** Compatibility decomposition. @deprecated ICU 56 Use unorm2.h instead. */ @@ -144,7 +143,7 @@ typedef enum { /** Canonical decomposition followed by canonical composition. @deprecated ICU 56 Use unorm2.h instead. */ UNORM_NFC = 4, /** Default normalization. @deprecated ICU 56 Use unorm2.h instead. */ - UNORM_DEFAULT = UNORM_NFC, + UNORM_DEFAULT = UNORM_NFC, /** Compatibility decomposition followed by canonical composition. @deprecated ICU 56 Use unorm2.h instead. */ UNORM_NFKC =5, /** "Fast C or D" form. @deprecated ICU 56 Use unorm2.h instead. */ @@ -153,7 +152,6 @@ typedef enum { /** One more than the highest normalization mode constant. @deprecated ICU 56 Use unorm2.h instead. */ UNORM_MODE_COUNT } UNormalizationMode; -#endif /* U_HIDE_DEPRECATED_API */ /** * Constants for options flags for normalization. @@ -197,7 +195,7 @@ enum { * * @param source The string to normalize. * @param sourceLength The length of source, or -1 if NUL-terminated. - * @param mode The normalization mode; one of UNORM_NONE, + * @param mode The normalization mode; one of UNORM_NONE, * UNORM_NFD, UNORM_NFC, UNORM_NFKC, UNORM_NFKD, UNORM_DEFAULT. * @param options The normalization options, ORed together (0 for no options). * @param result A pointer to a buffer to receive the result string. @@ -208,21 +206,21 @@ enum { * the output was truncated, and the error code is set to U_BUFFER_OVERFLOW_ERROR. * @deprecated ICU 56 Use unorm2.h instead. */ -U_STABLE int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 unorm_normalize(const UChar *source, int32_t sourceLength, UNormalizationMode mode, int32_t options, UChar *result, int32_t resultLength, UErrorCode *status); /** - * Performing quick check on a string, to quickly determine if the string is + * Performing quick check on a string, to quickly determine if the string is * in a particular normalization format. * Three types of result can be returned UNORM_YES, UNORM_NO or * UNORM_MAYBE. Result UNORM_YES indicates that the argument * string is in the desired normalized format, UNORM_NO determines that - * argument string is not in the desired normalized format. A - * UNORM_MAYBE result indicates that a more thorough check is required, - * the user may have to put the string in its normalized form and compare the + * argument string is not in the desired normalized format. A + * UNORM_MAYBE result indicates that a more thorough check is required, + * the user may have to put the string in its normalized form and compare the * results. * * @param source string for determining if it is in a normalized format @@ -256,7 +254,7 @@ unorm_quickCheck(const UChar *source, int32_t sourcelength, * @deprecated ICU 56 Use unorm2.h instead. */ U_STABLE UNormalizationCheckResult U_EXPORT2 -unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength, +unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength, UNormalizationMode mode, int32_t options, UErrorCode *pErrorCode); diff --git a/icu4c/source/i18n/dtptngen.cpp b/icu4c/source/i18n/dtptngen.cpp index 5a282a5377b..2a6b35b5118 100644 --- a/icu4c/source/i18n/dtptngen.cpp +++ b/icu4c/source/i18n/dtptngen.cpp @@ -1009,7 +1009,7 @@ DateTimePatternGenerator::getBestPattern(const UnicodeString& patternForm, UDate patternFormCopy.setCharAt(patPos, fDefaultHourFormatChar); } else if (patChr == CAP_C) { AllowedHourFormat preferred; - if (fAllowedHourFormats != NULL && fAllowedHourFormats[0] != ALLOWED_HOUR_FORMAT_UNKNOWN) { + if (fAllowedHourFormats[0] != ALLOWED_HOUR_FORMAT_UNKNOWN) { preferred = (AllowedHourFormat)fAllowedHourFormats[0]; } else { status = U_INVALID_FORMAT_ERROR; diff --git a/icu4c/source/test/intltest/locnmtst.cpp b/icu4c/source/test/intltest/locnmtst.cpp index 334fea255ca..ddb1d82b2c0 100644 --- a/icu4c/source/test/intltest/locnmtst.cpp +++ b/icu4c/source/test/intltest/locnmtst.cpp @@ -194,9 +194,9 @@ void LocaleDisplayNamesTest::TestUldnWithGarbage() { const int32_t kMaxResultSize = 150; // long enough UChar result[150]; ULocaleDisplayNames *ldn = uldn_open(Locale::getUS().getName(), ULDN_DIALECT_NAMES, &status); - (void)uldn_localeDisplayName(ldn, "english (United States) [w", result, kMaxResultSize, &status); + int32_t len = uldn_localeDisplayName(ldn, "english (United States) [w", result, kMaxResultSize, &status); uldn_close(ldn); - test_assert(U_FAILURE(status)); + test_assert(U_FAILURE(status) && len == 0); } void LocaleDisplayNamesTest::TestUldnWithKeywordsAndEverything() { -- 2.40.0