]> granicus.if.org Git - icu/commitdiff
ICU-22068 Cleanup inconsistent annotations between declarations and definitions
authorCyndy Ishida <cyndy_ishida@apple.com>
Tue, 21 Jun 2022 19:56:49 +0000 (12:56 -0700)
committerPeter Edberg <42151464+pedberg-icu@users.noreply.github.com>
Thu, 8 Sep 2022 15:34:56 +0000 (08:34 -0700)
This cleans up inconsistent annotations between declared APIs in headers
vs defined implementations in cpp's. This better ensures the API's
referenceable in headers represent what is exposed and defined in the
ultimate binary library's symbol table.

20 files changed:
icu4c/source/common/filteredbrk.cpp
icu4c/source/common/unicode/utf_old.h
icu4c/source/common/unifiedcache.cpp
icu4c/source/common/utf_impl.cpp
icu4c/source/i18n/collation.cpp
icu4c/source/i18n/collationbuilder.cpp
icu4c/source/i18n/collationdatabuilder.cpp
icu4c/source/i18n/collationtailoring.h
icu4c/source/i18n/datefmt.cpp
icu4c/source/i18n/decContext.h
icu4c/source/i18n/measfmt.cpp
icu4c/source/i18n/reldatefmt.cpp
icu4c/source/i18n/scriptset.h
icu4c/source/i18n/sharedcalendar.h
icu4c/source/i18n/shareddateformatsymbols.h
icu4c/source/i18n/sharednumberformat.h
icu4c/source/i18n/sharedpluralrules.h
icu4c/source/stubdata/BUILD.bazel
icu4c/source/stubdata/stubdata.cpp
icu4c/source/stubdata/stubdata.h [new file with mode: 0644]

index edab8e44986f5498df95fde70f2d90bb2ffe69eb..baa1d4e42d2e2aa4df46bcd292905ef418c05aae 100644 (file)
@@ -58,7 +58,7 @@ static int32_t U_CALLCONV compareUnicodeString(UElement t1, UElement t2) {
 /**
  * A UVector which implements a set of strings.
  */
-class U_COMMON_API UStringSet : public UVector {
+class UStringSet : public UVector {
  public:
   UStringSet(UErrorCode &status) : UVector(uprv_deleteUObject,
                                            uhash_compareUnicodeString,
@@ -482,7 +482,7 @@ SimpleFilteredSentenceBreakIterator::last(void) {
 /**
  * Concrete implementation of builder class.
  */
-class U_COMMON_API SimpleFilteredBreakIteratorBuilder : public FilteredBreakIteratorBuilder {
+class SimpleFilteredBreakIteratorBuilder : public FilteredBreakIteratorBuilder {
 public:
   virtual ~SimpleFilteredBreakIteratorBuilder();
   SimpleFilteredBreakIteratorBuilder(const Locale &fromLocale, UErrorCode &status);
index 160f5ad0a9f24858f392feefe6770608a013211f..6b868c72809b18038d9a7f5fb5bdcb1d4a8c032b 100644 (file)
@@ -293,10 +293,10 @@ typedef int32_t UTextOffset;
 #ifdef U_UTF8_IMPL
 // No forward declaration if compiling utf_impl.cpp, which defines utf8_countTrailBytes.
 #elif defined(U_STATIC_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION)
-U_CFUNC const uint8_t utf8_countTrailBytes[];
+U_CAPI const uint8_t utf8_countTrailBytes[];
 #else
-U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[];    /* U_IMPORT2? */ /*U_IMPORT*/
-#endif
+U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[];
+#endif 
 
 /**
  * Count the trail bytes for a UTF-8 lead byte.
index 3e94bca31dcb0836229316375aa3f4c55dfa235b..cfb000b2c8e683af5392976aaafa5d8ff4323a2b 100644 (file)
@@ -45,20 +45,20 @@ U_CDECL_END
 
 U_NAMESPACE_BEGIN
 
-U_CAPI int32_t U_EXPORT2
+int32_t U_EXPORT2
 ucache_hashKeys(const UHashTok key) {
     const CacheKeyBase *ckey = (const CacheKeyBase *) key.pointer;
     return ckey->hashCode();
 }
 
-U_CAPI UBool U_EXPORT2
+UBool U_EXPORT2
 ucache_compareKeys(const UHashTok key1, const UHashTok key2) {
     const CacheKeyBase *p1 = (const CacheKeyBase *) key1.pointer;
     const CacheKeyBase *p2 = (const CacheKeyBase *) key2.pointer;
     return *p1 == *p2;
 }
 
-U_CAPI void U_EXPORT2
+void U_EXPORT2
 ucache_deleteKey(void *obj) {
     CacheKeyBase *p = (CacheKeyBase *) obj;
     delete p;
index 3d11d9ee9e6125e9de5127a2bba24b2dc5c12081..a1f9c6529a7a6235f4410cbac3dbc7e352b76981 100644 (file)
@@ -55,7 +55,7 @@
  * -finish:
  * (BSR: Bit Scan Reverse, scans for a 1-bit, starting from the MSB)
  */
-extern "C" U_EXPORT const uint8_t
+U_CAPI const uint8_t
 utf8_countTrailBytes[256]={
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
index 14cb86576b8243c0f6d8338e21ab3d218f1e8e70..705ee12e23cc3bc501309fa5e82e2fba6c195d24 100644 (file)
 
 U_NAMESPACE_BEGIN
 
-// Some compilers don't care if constants are defined in the .cpp file.
-// MS Visual C++ does not like it, but gcc requires it. clang does not care.
-#ifndef _MSC_VER
-const uint8_t Collation::LEVEL_SEPARATOR_BYTE;
-const uint8_t Collation::MERGE_SEPARATOR_BYTE;
-const uint32_t Collation::ONLY_TERTIARY_MASK;
-const uint32_t Collation::CASE_AND_TERTIARY_MASK;
-#endif
-
 uint32_t
 Collation::incTwoBytePrimaryByOffset(uint32_t basePrimary, UBool isCompressible, int32_t offset) {
     // Extract the second byte, minus the minimum byte value,
index d7ea4c1cba99ff0c7a9dac8e718a3a3994e62223..fbf09a313d60db9672f41c71e33ab9c556d0d93d 100644 (file)
@@ -191,13 +191,6 @@ RuleBasedCollator::internalBuildTailoring(const UnicodeString &rules,
 
 // CollationBuilder implementation ----------------------------------------- ***
 
-// Some compilers don't care if constants are defined in the .cpp file.
-// MS Visual C++ does not like it, but gcc requires it. clang does not care.
-#ifndef _MSC_VER
-const int32_t CollationBuilder::HAS_BEFORE2;
-const int32_t CollationBuilder::HAS_BEFORE3;
-#endif
-
 CollationBuilder::CollationBuilder(const CollationTailoring *b, UBool icu4xMode, UErrorCode &errorCode)
         : nfd(*Normalizer2::getNFDInstance(errorCode)),
           fcd(*Normalizer2Factory::getFCDInstance(errorCode)),
index c9a4a32e838db9329be118dadbefd81144cf6dd4..e7c3da1ea5ebe3940a693272ba2d9d15815239cf 100644 (file)
@@ -109,7 +109,7 @@ struct ConditionalCE32 : public UMemory {
 
 U_CDECL_BEGIN
 
-U_CAPI void U_CALLCONV
+void U_CALLCONV
 uprv_deleteConditionalCE32(void *obj) {
     delete static_cast<ConditionalCE32 *>(obj);
 }
index 3de9682f950002141c4d178150b8607379e518ad..a6143c1c269dfb6d15c0819171f379f46fe0e870 100644 (file)
@@ -24,6 +24,8 @@
 #include "collationsettings.h"
 #include "uhash.h"
 #include "umutex.h"
+#include "unifiedcache.h"
 
 struct UDataMemory;
 struct UResourceBundle;
@@ -105,6 +107,10 @@ struct U_I18N_API CollationCacheEntry : public SharedObject {
     const CollationTailoring *tailoring;
 };
 
+template<> U_I18N_API
+const CollationCacheEntry *
+LocaleCacheKey<CollationCacheEntry>::createObject(const void *creationContext,
+                                                  UErrorCode &errorCode) const;
 U_NAMESPACE_END
 
 #endif  // !UCONFIG_NO_COLLATION
index 16ac233c94c70724d148a801924775d8a74b3780..2638cbf14dec12535dd7107c22fd3f266eafaace 100644 (file)
@@ -46,7 +46,7 @@
 
 U_NAMESPACE_BEGIN
 
-class U_I18N_API DateFmtBestPattern : public SharedObject {
+class DateFmtBestPattern : public SharedObject {
 public:
     UnicodeString fPattern;
 
@@ -58,14 +58,14 @@ public:
 DateFmtBestPattern::~DateFmtBestPattern() {
 }
 
-template<> U_I18N_API
+template<> 
 const DateFmtBestPattern *LocaleCacheKey<DateFmtBestPattern>::createObject(
         const void * /*creationContext*/, UErrorCode &status) const {
     status = U_UNSUPPORTED_ERROR;
     return NULL;
 }
 
-class U_I18N_API DateFmtBestPatternKey : public LocaleCacheKey<DateFmtBestPattern> { 
+class DateFmtBestPatternKey : public LocaleCacheKey<DateFmtBestPattern> { 
 private:
     UnicodeString fSkeleton;
 protected:
index 59ab65e59271ac769d50864a10cb66cfd9d8607e..91c6739739dcdc1b95693e7fe2ed7e4b454edfb6 100644 (file)
   U_CAPI decContext  * U_EXPORT2 uprv_decContextSetStatusFromStringQuiet(decContext *, const char *);
   U_CAPI decContext  * U_EXPORT2 uprv_decContextSetStatusQuiet(decContext *, uint32_t);
   U_CAPI const char  * U_EXPORT2 uprv_decContextStatusToString(const decContext *);
-  U_CAPI int32_t       U_EXPORT2 uprv_decContextTestEndian(uint8_t);
   U_CAPI uint32_t      U_EXPORT2 uprv_decContextTestSavedStatus(uint32_t, uint32_t);
   U_CAPI uint32_t      U_EXPORT2 uprv_decContextTestStatus(decContext *, uint32_t);
   U_CAPI decContext  * U_EXPORT2 uprv_decContextZeroStatus(decContext *);
index 1bfdc2b3f869288da4e69b0bce7f36dae7ef9e3f..d2b4e7018dce2a2bb3d74b8ec53fb9bab9f0ee4c 100644 (file)
@@ -239,7 +239,7 @@ static NumericDateFormatters *loadNumericDateFormatters(
     return result;
 }
 
-template<> U_I18N_API
+template<> 
 const MeasureFormatCacheData *LocaleCacheKey<MeasureFormatCacheData>::createObject(
         const void * /*unused*/, UErrorCode &status) const {
     const char *localeId = fLoc.getName();
index 6dfbffebb0c28322e90238bbf7ba98b08aecd4ce..e811eac2c8d7e6b551cfe5db3310e828fb98adcd 100644 (file)
@@ -701,7 +701,7 @@ static UBool getDateTimePattern(
     return getStringByIndex(topLevel.getAlias(), dateTimeFormatOffset, result, status);
 }
 
-template<> U_I18N_API
+template<> 
 const RelativeDateTimeCacheData *LocaleCacheKey<RelativeDateTimeCacheData>::createObject(const void * /*unused*/, UErrorCode &status) const {
     const char *localeId = fLoc.getName();
     LocalUResourceBundlePointer topLevel(ures_open(nullptr, localeId, &status));
index 51980ab7b3ef6e893bc09daa18835dc1f7f5a5be..df5cfdc748689036b34769c6e260db5a94a8ea47 100644 (file)
@@ -83,4 +83,7 @@ uhash_hashScriptSet(const UElement key);
 U_CAPI void U_EXPORT2
 uhash_deleteScriptSet(void *obj);
 
-#endif // __SCRIPTSET_H__
+U_CAPI UBool U_EXPORT2
+uhash_equalsScriptSet(const UElement key1, const UElement key2);
+
+#endif // __SCRIPTSET_H_
index 7daebaa4086117a98db45c73a38e0641644b3d2a..60d1d5d4879123fc3af61257b978664c8cb305a5 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "unicode/utypes.h"
 #include "sharedobject.h"
+#include "unifiedcache.h"
 
 U_NAMESPACE_BEGIN
 
@@ -31,6 +32,11 @@ private:
     SharedCalendar &operator=(const SharedCalendar &) = delete;
 };
 
+template<> U_I18N_API
+const SharedCalendar *LocaleCacheKey<SharedCalendar>::createObject(
+        const void * /*unusedCreationContext*/, UErrorCode &status) const;
+
+
 U_NAMESPACE_END
 
 #endif
index 92298a83e329a7fc049427a4319881639d3a1907..b51fad98b0bfa6b88004e09eb8024d3157785b34 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "sharedobject.h"
 #include "unicode/dtfmtsym.h"
+#include "unifiedcache.h"
 
 U_NAMESPACE_BEGIN
 
@@ -34,6 +35,11 @@ private:
     SharedDateFormatSymbols &operator=(const SharedDateFormatSymbols &) = delete;
 };
 
+template<> U_I18N_API
+const SharedDateFormatSymbols *
+        LocaleCacheKey<SharedDateFormatSymbols>::createObject(
+            const void * /*unusedContext*/, UErrorCode &status) const;
+
 U_NAMESPACE_END
 
 #endif /* !UCONFIG_NO_FORMATTING */
index 7ea756a779daf99cf9eb3b6b92a3e7c82c6d2ce2..bd914c0340786160c8840d1d15ee800929f5ac08 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "unicode/utypes.h"
 #include "sharedobject.h"
+#include "unifiedcache.h"
 
 U_NAMESPACE_BEGIN
 
@@ -31,6 +32,10 @@ private:
     SharedNumberFormat &operator=(const SharedNumberFormat &) = delete;
 };
 
+template<> U_I18N_API
+const SharedNumberFormat *LocaleCacheKey<SharedNumberFormat>::createObject(
+        const void * /*unused*/, UErrorCode &status) const;
+
 U_NAMESPACE_END
 
 #endif
index f543797a802bac1dec2a861c1388e2e504fe0bde..11c82c5619a96aa21f31fde4683499c42b6a2d03 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "unicode/utypes.h"
 #include "sharedobject.h"
+#include "unifiedcache.h"
 
 U_NAMESPACE_BEGIN
 
@@ -30,6 +31,10 @@ private:
     SharedPluralRules &operator=(const SharedPluralRules &) =delete;
 };
 
+template<> U_I18N_API
+const SharedPluralRules *LocaleCacheKey<SharedPluralRules>::createObject(
+        const void * /*unused*/, UErrorCode &status) const;
+
 U_NAMESPACE_END
 
 #endif
index abb73519ec4b081ef2142300b14608bb72729427..20344ef499198300feeb8fc6683c6b837cef03cb 100644 (file)
@@ -16,6 +16,7 @@ package(
 cc_library(
     name = "stubdata",
     srcs = ["stubdata.cpp"],
+    hdrs = ["stubdata.h"],
     deps = ["//icu4c/source/common:headers"],
     local_defines = [
         "U_COMMON_IMPLEMENTATION",
index 0fcab4faa82c0bda6a32bfaf51b99c9fbebab0a0..3f336612426c206d63d1971a25836152d5c30425 100644 (file)
 *   for running the data building tools.
 *
 */
-#include "unicode/utypes.h"
-#include "unicode/udata.h"
-#include "unicode/uversion.h"
 
-
-typedef struct {
-    uint16_t headerSize;
-    uint8_t magic1, magic2;
-    UDataInfo info;
-    char padding[8];
-    uint32_t count, reserved;
-    /*
-    const struct {
-    const char *const name; 
-    const void *const data;
-    } toc[1];
-    */
-   int   fakeNameAndData[4];       /* TODO:  Change this header type from */
-                                   /*        pointerTOC to OffsetTOC.     */
-} ICU_Data_Header;
+#include "stubdata.h"
 
 extern "C" U_EXPORT const ICU_Data_Header U_ICUDATA_ENTRY_POINT = {
     32,          /* headerSize */
diff --git a/icu4c/source/stubdata/stubdata.h b/icu4c/source/stubdata/stubdata.h
new file mode 100644 (file)
index 0000000..9879f40
--- /dev/null
@@ -0,0 +1,52 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/******************************************************************************
+*
+*   Copyright (C) 2001, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*   file name:  stubdata.h
+*
+*   This header file is intended to be internal and only included in the 
+*   accompanying implementation file. This file declares a single entry
+*   point for visibility of tools like TAPI.
+*
+*   Define initialized data that will build into a valid, but empty
+*   ICU data library.  Used to bootstrap the ICU build, which has these
+*   dependencies:
+*       ICU Common library depends on ICU data
+*       ICU data requires data building tools.
+*       ICU data building tools require the ICU common library.
+*
+*   The stub data library (for which this file is the source) is sufficient
+*   for running the data building tools.
+*
+*/
+
+#ifndef __STUBDATA_H__
+#define __STUBDATA_H__
+
+#include "unicode/utypes.h"
+#include "unicode/udata.h"
+#include "unicode/uversion.h"
+
+typedef struct {
+    uint16_t headerSize;
+    uint8_t magic1, magic2;
+    UDataInfo info;
+    char padding[8];
+    uint32_t count, reserved;
+    /*
+    const struct {
+    const char *const name;
+    const void *const data;
+    } toc[1];
+    */
+   int   fakeNameAndData[4];       /* TODO:  Change this header type from */
+                                   /*        pointerTOC to OffsetTOC.     */
+} ICU_Data_Header;
+
+extern "C" U_EXPORT const ICU_Data_Header U_ICUDATA_ENTRY_POINT;
+
+#endif /* __STUBDATA_H__ */