Skip to content

Commit deec498

Browse files
Vadmemecopybara-github
authored andcommitted
Improve support for Clang inside of UPB (#17433)
After using UPB I noticed that field accessors were not getting inlined properly using Clang. The source appears to be the UPB_FORCEINLINE macro falling back to just being `static` when underneath clang despite clang having full support of the required attributes. Closes #17433 COPYBARA_INTEGRATE_REVIEW=#17433 from Vadmeme:main 57204e7 PiperOrigin-RevId: 699195477
1 parent 8476dba commit deec498

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

upb/port/def.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Error, UINTPTR_MAX is undefined
132132
#endif
133133

134134
// Macros for function attributes on compilers that support them.
135-
#ifdef __GNUC__
135+
#if defined(__GNUC__) || defined(__clang__)
136136
#define UPB_FORCEINLINE __inline__ __attribute__((always_inline)) static
137137
#define UPB_NOINLINE __attribute__((noinline))
138138
#define UPB_NORETURN __attribute__((__noreturn__))

0 commit comments

Comments
 (0)