Fixed the __has_attribute() check for old versions of Clang.

pull/13171/head
Joshua Haberman 4 years ago
parent 01e7436ed3
commit 7887dc0c76
  1. 10
      upb/port_def.inc

@ -167,12 +167,20 @@
/* Configure whether fasttable is switched on or not. *************************/ /* Configure whether fasttable is switched on or not. *************************/
#if defined(__clang__) && __has_attribute(musttail) #ifdef __has_attribute
#define UPB_HAS_ATTRIBUTE(x) __has_attribute(x)
#else
#define UPB_HAS_ATTRIBUTE(x) 0
#endif
#if UPB_HAS_ATTRIBUTE(musttail)
#define UPB_MUSTTAIL __attribute__((musttail)) #define UPB_MUSTTAIL __attribute__((musttail))
#else #else
#define UPB_MUSTTAIL #define UPB_MUSTTAIL
#endif #endif
#undef UPB_HAS_ATTRIBUTE
/* This check is not fully robust: it does not require that we have "musttail" /* This check is not fully robust: it does not require that we have "musttail"
* support available. We need tail calls to avoid consuming arbitrary amounts * support available. We need tail calls to avoid consuming arbitrary amounts
* of stack space. * of stack space.

Loading…
Cancel
Save