diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h index 04751ae8273..855cf158587 100644 --- a/include/grpc/support/port_platform.h +++ b/include/grpc/support/port_platform.h @@ -747,6 +747,7 @@ extern void gpr_unreachable_code(const char* reason, const char* file, #endif /* GPR_ATTRIBUTE_NOINLINE */ #ifndef GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION +#ifdef __cplusplus #if GPR_HAS_CPP_ATTRIBUTE(clang::always_inline) #define GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION [[clang::always_inline]] #elif GPR_HAS_ATTRIBUTE(always_inline) @@ -755,6 +756,10 @@ extern void gpr_unreachable_code(const char* reason, const char* file, // TODO(ctiller): add __forceinline for MSVC #define GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION #endif +#else +// Disable for C code +#define GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION +#endif #endif /* GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION */ #ifndef GPR_NO_UNIQUE_ADDRESS