dsp.h: add WEBP_UBSAN_IGNORE_UNDEF

only defined when WEBP_FORCE_ALIGNED isn't. use it to quiet alignment
warnings VP8LoadNewBytes().

Change-Id: I710a74bb9375285974e97022540551a3f4eda414
This commit is contained in:
James Zern
2016-05-09 22:55:21 -07:00
parent 4154a8395d
commit 369e264e2e
2 changed files with 15 additions and 1 deletions

View File

@ -101,6 +101,19 @@ extern "C" {
#endif
#endif
// This macro prevents the undefined behavior sanitizer from reporting
// failures. This is only meant to silence unaligned loads on platforms that
// are known to support them.
#define WEBP_UBSAN_IGNORE_UNDEF
#if !defined(WEBP_FORCE_ALIGNED) && defined(__clang__) && \
defined(__has_attribute)
#if __has_attribute(no_sanitize)
#undef WEBP_UBSAN_IGNORE_UNDEF
#define WEBP_UBSAN_IGNORE_UNDEF \
__attribute__((no_sanitize("undefined")))
#endif
#endif
typedef enum {
kSSE2,
kSSE3,