diff options
author | Tony Cook <tony@develop-help.com> | 2018-02-21 14:50:13 +1100 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2018-04-02 15:20:36 +1000 |
commit | 28e487a0fbfad9b8a3c1e0e4189a256d055f3386 (patch) | |
tree | a40de8185573f21369deee2c6caf92fe9159acf1 /dist | |
parent | 368e5f5eb1d12d4391b0c5dfc8ebd00ee6a457a3 (diff) | |
download | perl-28e487a0fbfad9b8a3c1e0e4189a256d055f3386.tar.gz |
(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.
Diffstat (limited to 'dist')
-rw-r--r-- | dist/Devel-PPPort/PPPort_pm.PL | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/dist/Devel-PPPort/PPPort_pm.PL b/dist/Devel-PPPort/PPPort_pm.PL index 954c7c06bf..1a514f729d 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"; |