| Store | Cart

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

From: Zefram <zef...@fysh.org>
Sat, 24 Feb 2018 23:54:36 +0000
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.

-zefram

Recent Messages in this Thread
Zefram (via RT) Feb 17, 2018 06:51 pm
Tony Cook via RT Feb 21, 2018 04:04 am
Zefram Feb 24, 2018 11:54 pm
Tony Cook via RT Feb 27, 2018 12:11 am
Zefram Mar 31, 2018 12:46 am
Messages in this thread