New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ppport.h breaks croak_xs_usage() on old Perls #16424
Comments
From zefram@fysh.orgCreated by zefram@fysh.orgThe current version of ppport.h will define croak_xs_usage() if it An individual XS module can avoid this problem by defining the flag macro Individual XS modules should not have to define this flag macro if they Perl Info
|
From @tonycozOn Sat, 17 Feb 2018 10:51:15 -0800, zefram@fysh.org wrote:
Do the attached fix this for you? Tony |
From @tonycoz0001-perl-132876-only-define-croak_xs_usage-s-assert-macr.patchFrom 727015c782d1c37af4fc8d21dfd1a00e21b83fbc Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Wed, 21 Feb 2018 11:24:00 +1100
Subject: (perl #132876) only define croak_xs_usage()'s assert macro if cxu
requested
This avoids an interaction with the code ExtUtils::ParseXS generates to
define a fallback croak_xs_usage().
That code checks whether the assert macro is defined rather than checking
if croak_xs_usage() is defined, and since ppport.h was always defining
the assert macro, the EU::PXS code would fail to define its own
croak_xs_usage() fallback.
---
dist/Devel-PPPort/parts/inc/mess | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dist/Devel-PPPort/parts/inc/mess b/dist/Devel-PPPort/parts/inc/mess
index eb2de7b15e..e4723df9ba 100644
--- a/dist/Devel-PPPort/parts/inc/mess
+++ b/dist/Devel-PPPort/parts/inc/mess
@@ -199,12 +199,13 @@ mess_sv(pTHX_ SV *basemsg, bool consume)
#endif
#endif
+#ifndef croak_xs_usage
+#if { NEED croak_xs_usage }
+
#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
#endif
-#ifndef croak_xs_usage
-#if { NEED croak_xs_usage }
void
croak_xs_usage(const CV *const cv, const char *const params)
{
--
2.11.0
|
From @tonycoz0002-perl-132876-define-API-macros-on-if-the-NEED_-macro-.patchFrom 5e5e223929f29119500eee8eb7a35472294882c0 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Wed, 21 Feb 2018 14:50:13 +1100
Subject: (perl #132876) define API macros on if the NEED_ macro is defined
Rather then always defining an API macro such as "croak_xs_usage",
only define it if the NEED_ macro is defined.
This means that code that checks if the API macro is defined won't
get a false positive and try to use an API that's neither available nor
emulated.
If the including code attempts to define its own fallback, as EU::PXS
code does, it also prevents a macro redefinition, most likely with a
different token sequence which the C standard forbids.
This change has the (I think unlikely) risk that a user of ppport.h
might include ppport.h for the macro definition and then define their
own DPPP_some_api() function. I attempted to check via grep.cpan.me,
but it wasn't working at the time.
---
dist/Devel-PPPort/PPPort_pm.PL | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dist/Devel-PPPort/PPPort_pm.PL b/dist/Devel-PPPort/PPPort_pm.PL
index 15cfe63405..d0b2ca5e9f 100644
--- a/dist/Devel-PPPort/PPPort_pm.PL
+++ b/dist/Devel-PPPort/PPPort_pm.PL
@@ -293,9 +293,9 @@ sub expand_pp_expr
. "extern $proto;\n"
. "#endif\n"
. "\n"
- . "$embed\n"
+ . "#if defined(NEED_$func) || defined(NEED_${func}_GLOBAL)\n"
. "\n"
- . "#if defined(NEED_$func) || defined(NEED_${func}_GLOBAL)";
+ . "$embed\n";
}
die "cannot expand preprocessor expression '$expr'\n";
--
2.11.0
|
The RT System itself - Status changed from 'new' to 'open' |
From zefram@fysh.orgTony Cook via RT wrote:
No, that's not a correct fix. By avoiding defining Cwd.c:678:0: warning: "croak_xs_usage" redefined gcc only warns, but non-identical macro redefinition is not legal C, I take no position on whether ppport.h should be defining croak_xs_usage() -zefram |
From @tonycozOn Sat, 24 Feb 2018 15:54:52 -0800, zefram@fysh.org wrote:
The notes on my second patch say: If the including code attempts to define its own fallback, as EU::PXS code does, it also prevents a macro redefinition, most likely with a different token sequence which the C standard forbids. Did you apply both patches? Tony |
From zefram@fysh.orgTony Cook via RT wrote:
Sorry, I missed that there were two patches, and only applied the -zefram |
Migrated from rt.perl.org#132876 (status was 'open')
Searchable as RT132876$
The text was updated successfully, but these errors were encountered: