Skip to content

Commit 8dd58a5

Browse files
Snappy Teampwnall
authored andcommitted
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
1 parent 8b07ff1 commit 8dd58a5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

snappy.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ size_t AdvanceToNextTagX86Optimized(const uint8_t** ip_p, size_t* tag) {
10411041
size_t literal_len = *tag >> 2;
10421042
size_t tag_type = *tag;
10431043
bool is_literal;
1044-
#if defined(__GNUC__) && defined(__x86_64__)
1044+
#if defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(__x86_64__)
10451045
// TODO clang misses the fact that the (c & 3) already correctly
10461046
// sets the zero flag.
10471047
asm("and $3, %k[tag_type]\n\t"

0 commit comments

Comments
 (0)