Skip to content

Commit

Permalink
cleanup: avoid "unused function" errors in OSS land
Browse files Browse the repository at this point in the history
The `CodepointSkipBackwards()` function is only used if `__SSE4_1__` is defined. In OSS land some builds do not define this macro, and enable both `-Werror` and `-Wunused-functions`.  Seems reasonable to exclude the function in this case.

PiperOrigin-RevId: 535715678
  • Loading branch information
protobuf-github-bot authored and Copybara-Service committed May 26, 2023
1 parent f4948c4 commit d863bc3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions utf8_validity.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ size_t ValidUTF8Span(const char* data, const char* end) {
return err_pos + (1 - ReturnPosition);
}

#ifdef __SSE4_1__
/* Returns the number of bytes needed to skip backwards to get to the first
byte of codepoint.
*/
Expand All @@ -148,6 +149,7 @@ inline int CodepointSkipBackwards(int32_t codepoint_word) {
}
return 0;
}
#endif // __SSE4_1__

/* Skipping over ASCII as much as possible, per 8 bytes. It is intentional
as most strings to check for validity consist only of 1 byte codepoints.
Expand Down

0 comments on commit d863bc3

Please sign in to comment.