develooper Front page | perl.perl5.porters | Postings from April 2018

Re: [perl #132955] USE_CPLUSPLUS build broken in 5.27 blead and all5.26 stables

Thread Previous | Thread Next
From:
Leon Timmermans
Date:
April 27, 2018 13:58
Subject:
Re: [perl #132955] USE_CPLUSPLUS build broken in 5.27 blead and all5.26 stables
Message ID:
CAHhgV8iTUB9vHdAryjiWWM=oOMoCfKHJVKCSp_hD+QtjbvV2Yw@mail.gmail.com
On Tue, Apr 24, 2018 at 6:23 PM, Steve Hay <steve.m.hay@googlemail.com> wrote:
> On 24 April 2018 at 15:49, Dave Mitchell <davem@iabyn.com> wrote:
>> On Tue, Apr 24, 2018 at 02:56:00PM +0200, Leon Timmermans wrote:
>>
>>> I would guess that making them EXTCONST again, but putting them inside
>>> a START_EXTERN_C/END_EXTERN_C block would fix this.
>>
>> That seems to work under linux.
>> This branch I've just pushed, smoke-me/davem/nan_cpp,
>> builds ok with gcc, g++ and clang on Linux.
>>
>> Does someone want to try it on Windows?
>>
>
> That fixes the problem for me.
>
> But I spoke to soon in claiming that the build otherwise worked with
> VS2017. There is still one more problem:
>
> Socket.xs(804): error C2132: syntax error: unexpected identifier
> Socket.xs(808): error C2132: syntax error: unexpected identifier
>
> I don't understand this one either. Line 804 is:
>
> if (sockaddr_len < STRUCT_OFFSET(struct sockaddr, sa_data))
>
> which pre-processes to:
>
> if (sockaddr_len < __builtin_offsetof(struct sockaddr,sa_data))
>
> Similar pre-processing happens in many other files and they compile
> without trouble, e.g. in B.xs we have:
>
> { STR_WITH_LEN("next"),    OPp,    STRUCT_OFFSET(struct op, op_next),     },
>
> which becomes:
>
> { ("" "next" ""), (sizeof("next")-1),    0x3,
> __builtin_offsetof(struct op,op_next),     },
>
> and causes no problem.
>
> I can't see why Socket is any different. However, It does contain this:
>
> /* STRUCT_OFFSET should have come from from perl.h, but if not,
>  * roll our own (not using offsetof() since that is C99). */
> #ifndef STRUCT_OFFSET
> #  define STRUCT_OFFSET(s,m)  (Size_t)(&(((s *)0)->m))
> #endif
>
> and if I insert "#undef STRUCT_OFFSET" before that (to get rid of the
> definition from perl.h and use the above instead) then it fixes it.
> That can't be the right solution, though.
>
> *That* really is the last problem. With that hack in place the build
> now succeeds.

Which version of VC++ is that? The visual studio forum seems to
suggest there have been some issues in VS2017 but that they're
resolved in the later releases. Does upgrading to the latest help?

Leon

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About