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

Re: [perl #132876] ppport.h breaks croak_xs_usage() on old Perls

Thread Previous | Thread Next
February 24, 2018 23:54
Re: [perl #132876] ppport.h breaks croak_xs_usage() on old Perls
Message ID:
Tony Cook via RT wrote:
>Do the attached fix this for you?

No, that's not a correct fix.  By avoiding defining
PERL_ARGS_ASSERT_CROAK_XS_USAGE it avoids suppressing the XS boilerplate
definition of croak_xs_usage(), but ppport.h still defines its own
croak_xs_usage().  The two definitions then conflict:

Cwd.c:678:0: warning: "croak_xs_usage" redefined
 #define croak_xs_usage        S_croak_xs_usage
In file included from Cwd.xs:14:0:
ppport.h:5342:0: note: this is the location of the previous definition
 #define croak_xs_usage DPPP_(my_croak_xs_usage)

gcc only warns, but non-identical macro redefinition is not legal C,
so a compiler would be entitled to error.  To avoid this, ppport.h
must refrain from #defining croak_xs_usage() if it's not doing
the whole job: croak_xs_usage() definition that actually works, and
PERL_ARGS_ASSERT_CROAK_XS_USAGE also #defined.  This would be good advice
for ppport.h in general: #defining to external symbols may be a useful
option, but it's a terrible default, because by default it's broken.

I take no position on whether ppport.h should be defining croak_xs_usage()
by default.  It's just got to be either the complete definition or none
at all.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About