Posix.xs and 'comments'?

GA,
Recent mail established I'm not a Perl expert, and I may now establish 
I'm not a XS expert either; Is this comment in Posix.xs valid?

> # If we define TCSANOW here then both a found and not found constant sub
> # are created causing a Constant subroutine TCSANOW redefined warning

It seems 'odd' to have a # If for a start, and /* */ is used elsewhere 
in the file...It's about line 1900 in the .xs.
N(ovice)orm
0
normw
4/1/2018 1:01:01 AM
perl.perl5.porters 47364 articles. 0 followers. Follow

4 Replies
80 Views

Similar Articles

[PageSpeed] 29

GE.
This is the snippet from my Perl build log that suggested a problem:
> cmd->make  -C ../ext/POSIX all
> Error: Cannot parse function definition from ' are created causing a Constant subroutine TCSANOW redefined warning.' in POSIX.xs, line 1931
> Error: Unterminated '#if/#ifdef/#ifndef' in POSIX.xs, line 3821
Norm

On 1/04/2018 2:21 PM, NormW wrote:
> GA,
> Recent mail established I'm not a Perl expert, and I may now establish
> I'm not a XS expert either; Is this comment in Posix.xs valid?
>
>> # If we define TCSANOW here then both a found and not found constant sub
>> # are created causing a Constant subroutine TCSANOW redefined warning
>
> It seems 'odd' to have a # If for a start, and /* */ is used elsewhere
> in the file...It's about line 1900 in the .xs.
> N(ovice)orm
0
normw
4/1/2018 1:01:01 AM

-----Original Message----- 
From: NormW
Sent: Sunday, April 01, 2018 8:21 PM
To: perl5-porters@perl.org
Subject: Re: Posix.xs and 'comments'?

> GE.
> This is the snippet from my Perl build log that suggested a problem:
>> cmd->make  -C ../ext/POSIX all
>> Error: Cannot parse function definition from ' are created causing a 
>> Constant subroutine TCSANOW redefined warning.' in POSIX.xs, line 1931
>> Error: Unterminated '#if/#ifdef/#ifndef' in POSIX.xs, line 3821

According to the XS documentation:

Comments can be added to XSUBs by placing a "#" as the first non-whitespace 
of a line. Care should be taken to avoid making the comment look like a C 
preprocessor directive, lest it be interpreted as such. The simplest way to 
prevent this is to put whitespace in front of the "#".

It looks to me that the recommendation of placing whitespace in front of "#" 
is being ignored here - though that's not causing any problems for me.
However, it's pretty clear that it's causing a problem for you, and should 
therefore be fixed.

Cheers,
Rob
0
sisyphus1
4/1/2018 12:58:34 PM
GE and thankyou for the time expended.
I just updated to 5.26.2-rc1 but FTM settled to change the comments to 
the /**/ variety. That stifles the .xs problems and after working on 
NetWare issues managed to get POSIX to build. Thx. I was of the idea the 
#if/#endif group HAD to be lowercase, so reacting to '# If' was also a 
surprise. Norm
On 3/04/2018 6:26 PM, Dave Mitchell wrote:
> On Sun, Apr 01, 2018 at 10:58:34PM +1000, sisyphus1@optusnet.com.au wrote:
>>> This is the snippet from my Perl build log that suggested a problem:
>>>> cmd->make  -C ../ext/POSIX all
>>>> Error: Cannot parse function definition from ' are created causing a
>>>> Constant subroutine TCSANOW redefined warning.' in POSIX.xs, line
>>>> 1931
>>>> Error: Unterminated '#if/#ifdef/#ifndef' in POSIX.xs, line 3821
>>
>> According to the XS documentation:
>>
>> Comments can be added to XSUBs by placing a "#" as the first non-whitespace
>> of a line. Care should be taken to avoid making the comment look like a C
>> preprocessor directive, lest it be interpreted as such. The simplest way to
>> prevent this is to put whitespace in front of the "#".
>>
>> It looks to me that the recommendation of placing whitespace in front of "#"
>> is being ignored here - though that's not causing any problems for me.
>> However, it's pretty clear that it's causing a problem for you, and should
>> therefore be fixed.
>
>
> Now fixed by v5.27.10-102-gf90ac1a0bc
>
0
normw
4/3/2018 1:01:01 AM
On Sun, Apr 01, 2018 at 10:58:34PM +1000, sisyphus1@optusnet.com.au wrote:
> > This is the snippet from my Perl build log that suggested a problem:
> > > cmd->make  -C ../ext/POSIX all
> > > Error: Cannot parse function definition from ' are created causing a
> > > Constant subroutine TCSANOW redefined warning.' in POSIX.xs, line
> > > 1931
> > > Error: Unterminated '#if/#ifdef/#ifndef' in POSIX.xs, line 3821
> 
> According to the XS documentation:
> 
> Comments can be added to XSUBs by placing a "#" as the first non-whitespace
> of a line. Care should be taken to avoid making the comment look like a C
> preprocessor directive, lest it be interpreted as such. The simplest way to
> prevent this is to put whitespace in front of the "#".
> 
> It looks to me that the recommendation of placing whitespace in front of "#"
> is being ignored here - though that's not causing any problems for me.
> However, it's pretty clear that it's causing a problem for you, and should
> therefore be fixed.


Now fixed by v5.27.10-102-gf90ac1a0bc

-- 
Monto Blanco... scorchio!
0
davem
4/3/2018 8:26:09 AM
Reply: