summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSnappy Team <no-reply@google.com>2022-01-24 09:05:38 +0000
committerVictor Costan <pwnall@chromium.org>2022-02-20 18:19:45 +0000
commit8dd58a519f79f0742d4c68fbccb2aed2ddb651e8 (patch)
treeebcc09f3acdc9a8be3661abf1c25b8800289f7d5
parent8b07ff196aa007e9b073aa4f062dbb23443594ec (diff)
downloadsnappy-git-8dd58a519f79f0742d4c68fbccb2aed2ddb651e8.tar.gz
Fix compilation for older GCC and Clang versions.
Not everything defining __GNUC__ supports flag outputs from asm statements; in particular, some Clang versions on macOS does not. The correct test per the GCC documentation is __GCC_ASM_FLAG_OUTPUTS__, so use that instead. PiperOrigin-RevId: 423749308
-rw-r--r--snappy.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/snappy.cc b/snappy.cc
index ee9a2c4..30505ad 100644
--- a/snappy.cc
+++ b/snappy.cc
@@ -1041,7 +1041,7 @@ size_t AdvanceToNextTagX86Optimized(const uint8_t** ip_p, size_t* tag) {
size_t literal_len = *tag >> 2;
size_t tag_type = *tag;
bool is_literal;
-#if defined(__GNUC__) && defined(__x86_64__)
+#if defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(__x86_64__)
// TODO clang misses the fact that the (c & 3) already correctly
// sets the zero flag.
asm("and $3, %k[tag_type]\n\t"