@@ -494,7 +494,7 @@ Error, UINTPTR_MAX is undefined
494494
495495/* aarch64 supports big and little endian modes; fasttable performs multibyte
496496 * tag loads assumes the tag of a varint is in the low bits. */
497- #if (defined(__x86_64__) || defined(__AARCH64EL__)) && \
497+ #if !defined(_WIN32) && (defined(__x86_64__) || defined(__AARCH64EL__)) && \
498498 UPB_HAS_ATTRIBUTE(preserve_none) && UPB_HAS_ATTRIBUTE(musttail)
499499#define UPB_FASTTABLE_SUPPORTED 1
500500#else
@@ -513,7 +513,11 @@ Error, UINTPTR_MAX is undefined
513513 * This is useful for releasing code that might be used on multiple platforms,
514514 * for example the PHP or Ruby C extensions. */
515515#elif defined(UPB_TRY_ENABLE_FASTTABLE)
516- #define UPB_FASTTABLE UPB_FASTTABLE_SUPPORTED
516+ #if UPB_FASTTABLE_SUPPORTED
517+ #define UPB_FASTTABLE 1
518+ #else
519+ #define UPB_FASTTABLE 0
520+ #endif
517521#else
518522#define UPB_FASTTABLE 0
519523#endif
@@ -567,6 +571,12 @@ Error, UINTPTR_MAX is undefined
567571#define UPB_RETAIN
568572#endif
569573
574+ #if defined(__GNUC__) || defined(__clang__)
575+ #define UPB_HIDDEN __attribute__((visibility("hidden")))
576+ #else
577+ #define UPB_HIDDEN
578+ #endif
579+
570580// Linker arrays combine elements from multiple translation units into a single
571581// array that can be iterated over at runtime.
572582//
@@ -620,7 +630,7 @@ Error, UINTPTR_MAX is undefined
620630
621631#elif defined(__MACH__)
622632
623- /* As described in: https://stackoverflow.com/a/22366882 */
633+ /* As described in: https://stackoverflow.com/a/22366882 */
624634#define UPB_LINKARR_APPEND(name) \
625635 __attribute__(( \
626636 section("__DATA,__la_" #name))) UPB_LINKARR_ATTR UPB_NO_SANITIZE_ADDRESS
@@ -639,10 +649,10 @@ Error, UINTPTR_MAX is undefined
639649
640650#elif defined(_MSC_VER)
641651
642- /* See:
643- * https://devblogs.microsoft.com/oldnewthing/20181107-00/?p=100155
644- * https://devblogs.microsoft.com/oldnewthing/20181108-00/?p=100165
645- * https://devblogs.microsoft.com/oldnewthing/20181109-00/?p=100175 */
652+ /* See:
653+ * https://devblogs.microsoft.com/oldnewthing/20181107-00/?p=100155
654+ * https://devblogs.microsoft.com/oldnewthing/20181108-00/?p=100165
655+ * https://devblogs.microsoft.com/oldnewthing/20181109-00/?p=100175 */
646656#define UPB_STRINGIFY_INTERNAL(x) #x
647657#define UPB_STRINGIFY(x) UPB_STRINGIFY_INTERNAL(x)
648658#define UPB_CONCAT(a, b, c) a##b##c
@@ -651,7 +661,7 @@ Error, UINTPTR_MAX is undefined
651661#define UPB_LINKARR_APPEND(name) \
652662 __pragma(section(UPB_LINKARR_NAME(name, $j), read)) \
653663 __declspec(allocate(UPB_LINKARR_NAME(name, $j)))
654- // clang-format off
664+ // clang-format off
655665#define UPB_LINKARR_DECLARE(name, type) \
656666 __pragma(message(UPB_LINKARR_NAME(name, $j))) \
657667 __pragma(section(UPB_LINKARR_NAME(name, $a), read)) \
@@ -662,13 +672,13 @@ Error, UINTPTR_MAX is undefined
662672 type __stop_linkarr_##name; \
663673 UPB_LINKARR_APPEND(name) \
664674 __declspec(selectany) type UPB_linkarr_internal_empty_##name[1] = {0}
665- // clang-format on
675+ // clang-format on
666676#define UPB_LINKARR_START(name) (&__start_linkarr_##name)
667677#define UPB_LINKARR_STOP(name) (&__stop_linkarr_##name)
668678
669679#else
670680
671- // Linker arrays are not supported on this platform. Make macros no-ops.
681+ // Linker arrays are not supported on this platform. Make macros no-ops.
672682#define UPB_LINKARR_APPEND(name)
673683#define UPB_LINKARR_DECLARE(name, type) \
674684 UPB_STATIC_ASSERT(sizeof("__la_" #name) <= 17, \
@@ -19612,3 +19622,5 @@ UPB_PRIVATE(upb_WireWriter_VarintUnusedSizeFromLeadingZeros64)(uint64_t clz) {
1961219622#undef _UPB_STRINGIFY
1961319623#undef _UPB_STRINGIFY2
1961419624#undef UPB_CONSTRUCTOR
19625+ #undef UPB_RETAIN
19626+ #undef UPB_HIDDEN
0 commit comments