On Sat, Apr 28, 2018 at 12:09 PM, Dave Mitchell <davem@iabyn.com> wrote: > On Fri, Apr 27, 2018 at 06:28:42PM +0100, Steve Hay via perl5-porters wrote: >> So now I see there is an obvious solution that I could employ (add >> /Zc:offsetof- to the compiler flags for this & later compilers), but >> I'm still puzzled exactly what the problem is and why it only affects >> Socket when there are so many other uses of STRUCT_OFFSET around the >> code. > > Socket is the only non-core module (i.e. outside of ext/) which uses > STRUCT_OFFSET. On unixy builds, cpan/ modules get passed a different > set of compiler options than core code (generally less strict compiler > warnings flags). Perhaps there's something similar for Windows builds? > > Commit v5.27.5-31-g346712be0b modified core to assume stddef.h and > its features are always available. In particular it made this change to > perl.h: > > > -#if defined(STANDARD_C) && defined(I_STDDEF) && !defined(PERL_GCC_PEDANTIC) > -# include <stddef.h> > -# define STRUCT_OFFSET(s,m) offsetof(s,m) > -#else > -# define STRUCT_OFFSET(s,m) (Size_t)(&(((s *)0)->m)) > -#endif > +#include <stddef.h> > +#define STRUCT_OFFSET(s,m) offsetof(s,m) > > Perhaps that chunk should be reverted for now? Reverting it literally requires reverting more of Aaron's C89 work (I_STDDEF is eliminated and STANDARD_C mostly too). Just using the old definition here for VC++ may be the best solution for now. LeonThread Previous | Thread Next