1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:34:59 +00:00

AK: Use __builtin_offsetof() + -Wno-invalid-offsetof to silence ASAN

ASAN was crying way too much when running the LibJS JIT since the old
OFFSET_OF implementation was too wild for its liking.

By turning off the invalid-offsetof warnings, we can use the offsetof
builtin instead. However, I'm leaving this as a wrapper macro, since
we may still want to do something different for other compilers.
This commit is contained in:
Andreas Kling 2023-11-24 09:24:23 +01:00
parent 1541942e10
commit a6106ca221
2 changed files with 3 additions and 1 deletions

View file

@ -16,7 +16,7 @@
#include <AK/Assertions.h>
#define OFFSET_OF(class, member) (reinterpret_cast<ptrdiff_t>(&reinterpret_cast<class*>(0x1000)->member) - 0x1000)
#define OFFSET_OF(class, member) __builtin_offsetof(class, member)
namespace AK {