Skip to content

Commit

Permalink
Silence some warnings in GCC.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 707649778
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Dec 18, 2024
1 parent 3fa1748 commit 8543534
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions upb/message/internal/accessors.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ UPB_INLINE void UPB_PRIVATE(_upb_Message_SetPresence)(
}
}

UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_DataCopy)(
UPB_INLINE_IF_NOT_GCC void UPB_PRIVATE(_upb_MiniTableField_DataCopy)(
const upb_MiniTableField* f, void* to, const void* from) {
switch (UPB_PRIVATE(_upb_MiniTableField_GetRep)(f)) {
case kUpb_FieldRep_1Byte:
Expand All @@ -183,7 +183,7 @@ UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_DataCopy)(
UPB_UNREACHABLE();
}

UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_DataEquals)(
UPB_INLINE_IF_NOT_GCC bool UPB_PRIVATE(_upb_MiniTableField_DataEquals)(
const upb_MiniTableField* f, const void* a, const void* b) {
switch (UPB_PRIVATE(_upb_MiniTableField_GetRep)(f)) {
case kUpb_FieldRep_1Byte:
Expand Down
7 changes: 7 additions & 0 deletions upb/port/def.inc
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ Error, UINTPTR_MAX is undefined
#define UPB_INLINE static
#endif

// UPB_INLINE_IF_NOT_GCC: because gcc can be very noisy at times.
#if defined(__GNUC__) && !defined(__clang__)
#define UPB_INLINE_IF_NOT_GCC static
#else
#define UPB_INLINE_IF_NOT_GCC UPB_INLINE
#endif

#ifdef UPB_BUILD_API
#define UPB_API UPB_EXPORT
#define UPB_API_INLINE UPB_EXPORT
Expand Down
1 change: 1 addition & 0 deletions upb/port/undef.inc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#undef UPB_API
#undef UPBC_API
#undef UPB_API_INLINE
#undef UPB_API_INLINE_IF_NOT_GCC
#undef UPB_ALIGN_UP
#undef UPB_ALIGN_DOWN
#undef UPB_ALIGN_MALLOC
Expand Down

0 comments on commit 8543534

Please sign in to comment.