develooper Front page | perl.perl5.porters | Postings from March 2013

Re: [perl #117305] ISO C forbids braced-groups within expressions(cv.h, inline.h in 5.17.9)

Thread Next
From:
Dave Mitchell
Date:
March 24, 2013 01:21
Subject:
Re: [perl #117305] ISO C forbids braced-groups within expressions(cv.h, inline.h in 5.17.9)
Message ID:
20130324012100.GM2413@iabyn.com
On Sat, Mar 23, 2013 at 01:58:30AM +0100, Mark Martinec wrote:
> - created a tiny program 0.c, all it does is includes the EXTERN.h and perl.h:
>     #include "EXTERN.h"
>     #include "perl.h"
>     int main(int argc, char **argv) {}
> 
> So here is what happens:
> 
>   $ cd ~/perl-5.16.2/
>   $ cc -I. -std=c99 -pedantic ~/0.c

Thanks. With that code, I was able to bisect the change to this commit:

commit b290562ef436d5316a2f75513def7f4f18c4ef34
    Author:     Father Chrysostomos <sprout@cpan.org>
    AuthorDate: Sat Jul 7 17:35:10 2012 -0700

	Allow CVs to point to HEKs rather than GVs
	
	This will allow named lexical subs to exist independent of GVs.
    ...
    -#define CvGV(sv)	(0+((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_gv)
    +#define CvGV(sv)	S_CvGV((CV *)(sv))
    ...
    +PERL_STATIC_INLINE GV *
    +S_CvGV(CV *sv)
    +{
    +    return CvNAMED(sv)
    +	? 0
    +	: ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_gv_u.xcv_gv;
    +}


> So it seems to me that your statement:
>   | In which case, I don't think perl has ever added PERL_GCC_PEDANTIC
>   | to the command line or any include file.
> is the key here, but it just so happens that one can get away
> despite this with 5.16.* .

I think (but I'm willing to be convinced otherwise), based on the above
(fairly innocuous) commit, that the situation is that if a module wants to
build itself with -pendantic, then it needs to set PERL_GCC_PEDANTIC too;
the fact that it wasn't needed in the past was just luck; the commit above
introduced some inline function definitions that made the use of
brace-groups "active" even for code that didn't directly or indirectly use
macros such as CvGV.

-- 
In my day, we used to edit the inodes by hand.  With magnets.

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