Commit dd3de6f0 by Jose Dapena Paz Committed by Commit Bot

Do not assume __has_builtin is available

Compilation with GCC breaks as there is a build check using it. To avoid the problem, we declare the macro HAS_BUILTIN that maps to __has_builtin if it is defined, or 0 otherwise. Bug: chromium:819294 Change-Id: I105d566f08baa495fccd553d7b06eb8ce36621ef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1713604 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent cd369bb8
...@@ -1254,14 +1254,20 @@ inline constexpr unsigned int UnsignedCeilDivide(unsigned int value, unsigned in ...@@ -1254,14 +1254,20 @@ inline constexpr unsigned int UnsignedCeilDivide(unsigned int value, unsigned in
return (divided + ((value % divisor == 0) ? 0 : 1)); return (divided + ((value % divisor == 0) ? 0 : 1));
} }
#if defined(__has_builtin)
# define ANGLE_HAS_BUILTIN(x) __has_builtin(x)
#else
# define ANGLE_HAS_BUILTIN(x) 0
#endif
#if defined(_MSC_VER) #if defined(_MSC_VER)
# define ANGLE_ROTL(x, y) _rotl(x, y) # define ANGLE_ROTL(x, y) _rotl(x, y)
# define ANGLE_ROTL64(x, y) _rotl64(x, y) # define ANGLE_ROTL64(x, y) _rotl64(x, y)
# define ANGLE_ROTR16(x, y) _rotr16(x, y) # define ANGLE_ROTR16(x, y) _rotr16(x, y)
#elif defined(__clang__) && __has_builtin(__builtin_rotateleft32) && \ #elif defined(__clang__) && ANGLE_HAS_BUILTIN(__builtin_rotateleft32) && \
__has_builtin(__builtin_rotateleft64) && __has_builtin(__builtin_rotateright16) ANGLE_HAS_BUILTIN(__builtin_rotateleft64) && ANGLE_HAS_BUILTIN(__builtin_rotateright16)
# define ANGLE_ROTL(x, y) __builtin_rotateleft32(x, y) # define ANGLE_ROTL(x, y) __builtin_rotateleft32(x, y)
# define ANGLE_ROTL64(x, y) __builtin_rotateleft64(x, y) # define ANGLE_ROTL64(x, y) __builtin_rotateleft64(x, y)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment