eleviant wrote: > Looks like winnt.h already says, since a long time ago: > > ``` > #ifdef __has_builtin > #if __has_builtin(__builtin_offsetof) > #define FIELD_OFFSET(type, field) ((LONG)__builtin_offsetof(type, field)) > [...] > ``` > > Is the problem that someone's copied this define into another file? If so, > can that other file just be updated correspondingly, with the same change?
This is what I see in `wdm.h` ``` #ifndef FIELD_OFFSET #define FIELD_OFFSET(type, field) ((ULONG)&(((type *)0)->field)) #endif ``` There are plenty of other cases too: ``` #ifdef _WIN64 #define offsetof(s,m) (size_t)( (ptrdiff_t)&(((s *)0)->m) ) #else #define offsetof(s,m) (size_t)&(((s *)0)->m) #endif ``` ``` #define NdrFieldOffset(s,f) (LONG_PTR)(& (((s *)0)->f)) ``` ``` #ifndef CCSIZEOF_STRUCT #define CCSIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member)) #endif ``` https://github.com/llvm/llvm-project/pull/197005 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
