mirror of
https://github.com/webmproject/libwebp.git
synced 2025-08-29 07:12:05 +02:00
Add WEBP_SELF_ASSIGN macro
WEBP_SELF_ASSIGN exists to clearly designate when a self-assignment is intentional for the purposes of -fbounds-safety support. It also exists to silence any compiler warnings that may exist when building without -fboudnds-safety. Sample showing behavior across the three major toolchains (clang, gcc, msvc): https://godbolt.org/z/6r99dncW7 Change-Id: Ibbad5c0c3348dd6e2c4a70297b3e9cb6cf0d2817
This commit is contained in:
@@ -110,4 +110,9 @@
|
||||
#define WEBP_UNSAFE_FORGE_BIDI_INDEXABLE(typ, ptr, size) ((typ)(ptr))
|
||||
|
||||
#endif // WEBP_SUPPORT_FBOUNDS_SAFETY
|
||||
|
||||
// This macro exists to indicate intentionality with self-assignments and
|
||||
// silence -Wself-assign compiler warnings.
|
||||
#define WEBP_SELF_ASSIGN(x) x = x
|
||||
|
||||
#endif // WEBP_UTILS_BOUNDS_SAFETY_H_
|
||||
|
Reference in New Issue
Block a user