cgen: don't subtract null ptr in __offsetof, fix for v -cstrict -cc clang-14 cmd/tools/vpm.v and other programs using import net.http (fix #19222) (#19520)

This commit is contained in:
Turiiya 2023-10-07 11:54:45 +02:00 committed by GitHub
parent aba38d167b
commit 1e89b0b0dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -360,7 +360,7 @@ const c_common_macros = '
// for __offset_of // for __offset_of
#ifndef __offsetof #ifndef __offsetof
#define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0)) #define __offsetof(PTYPE,FIELDNAME) ((size_t)(&((PTYPE *)0)->FIELDNAME))
#endif #endif
#define OPTION_CAST(x) (x) #define OPTION_CAST(x) (x)