8306901: Macro offset_of confuses Eclipse CDT

Reviewed-by: stuefe, kbarrett
This commit is contained in:
Richard Reingruber 2023-04-28 06:06:56 +00:00
parent d3abfec8b7
commit eb3af8abe9

View File

@ -140,12 +140,12 @@ inline int g_isfinite(jdouble f) { return isfinite(f); }
// use offsetof() instead, with the invalid-offsetof warning
// temporarily disabled.
#define offset_of(klass,field) \
[]() { \
([]() { \
char space[sizeof (klass)] ATTRIBUTE_ALIGNED(16); \
klass* dummyObj = (klass*)space; \
char* c = (char*)(void*)&dummyObj->field; \
return (size_t)(c - space); \
}()
}())
#if defined(_LP64) && defined(__APPLE__)