Skip to content

Commit

Permalink
[x86/os-unix-sysdep] Use either the __has_builtin or __has_feature ma…
Browse files Browse the repository at this point in the history
…cro, depending on what the compiler has defined.
  • Loading branch information
neboat committed May 22, 2018
1 parent 9af889f commit e67520b
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions runtime/config/x86/os-unix-sysdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,25 @@ COMMON_SYSDEP int __cilkrts_xchg(volatile int *ptr, int x)
* This declaration should generate an error when the Intel compiler adds
* supprt for the intrinsic.
*/
#if defined(__INTEL_COMPILER) || \
(defined(__clang__) && !__has_builtin(__builtin_cpu_supports))
#if defined(__INTEL_COMPILER)
static inline int __builtin_cpu_supports(const char *feature)
{
return 1;
}
#elif defined(__has_builtin)
# if !__has_builtin(__builtin_cpu_supports)
static inline int __builtin_cpu_supports(const char *feature)
{
return 1;
}
# endif
#elif defined(__has_feature)
# if !__has_feature(__builtin_cpu_supports)
static inline int __builtin_cpu_supports(const char *feature)
{
return 1;
}
# endif
#endif

/*
Expand Down

0 comments on commit e67520b

Please sign in to comment.