In perl.git, the branch blead has been updated <https://perl5.git.perl.org/perl.git/commitdiff/4bd4e9335ffc257cbe2bf1a42789f693f5797337?hp=9fba38f0c306686a0a62e378ff28e2cd58fb0fbb>
- Log ----------------------------------------------------------------- commit 4bd4e9335ffc257cbe2bf1a42789f693f5797337 Author: Steve Hay <steve.m....@googlemail.com> Date: Sat Apr 28 13:56:05 2018 +0100 Finally fix C++ build with VS2017 Dodge the "offsetof has a builtin meaning; use /Zc:offsetof- to revert to old, non-conforming definition" error when compiling Socket.xs by reverting to an old definition of STRUCT_OFFSET for that compiler. ----------------------------------------------------------------------- Summary of changes: perl.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/perl.h b/perl.h index f41d5c9bd6..30f9973764 100644 --- a/perl.h +++ b/perl.h @@ -1040,8 +1040,15 @@ EXTERN_C int usleep(unsigned int); # define PERL_STRLEN_EXPAND_SHIFT 2 #endif -#include <stddef.h> -#define STRUCT_OFFSET(s,m) offsetof(s,m) +/* This use of offsetof() requires /Zc:offsetof- for VS2017 (and presumably + * onwards) when building Socket.xs, but we can just use a different definition + * for STRUCT_OFFSET instead. */ +#if defined(WIN32) && defined(_MSC_VER) && _MSC_VER >= 1910 +# define STRUCT_OFFSET(s,m) (Size_t)(&(((s *)0)->m)) +#else +# include <stddef.h> +# define STRUCT_OFFSET(s,m) offsetof(s,m) +#endif /* ptrdiff_t is C11, so undef it under pedantic builds */ #ifdef PERL_GCC_PEDANTIC -- Perl5 Master Repository