You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When configured with -DEBUGGING -Dusethreads -Dusemymalloc, malloc.c
didn't compile anymore (see below for the full error message). This was
probably broken by commits 8e3a36a and 13e5ba4. What they missed
was that all uses of warn/croak in this file were supposed to have no
context parameter (aTHX/pTHX) and the only reason croak2 was introduced
was that C89 didn't have variable-argument macros, so croak() was
hardcoded with one argument and croak2() with two arguments.
Instead, we can simply replace all uses of croak/croak2 with
Perl_croak_nocontext. On threaded builds, this is a function with no
extra pTHX_ parameter; on non-threaded builds, this just turns into
regular croak. Now we don't need to manually check for MULTIPLICITY
ourselves.
Back in the day (perl 5.005), malloc.c was supposed to be usable outside
of perl, so it had checks for PERL_CORE being defined. These were
removed in b9e5552, but some vestiges remained: PERL_CORE was still
mentioned as a configuration option in a comment and Perl_mfree (but
none of the other functions) tagged its warning messages with the
configuration options in play ("PERL_CORE", "RMAGIC", or "RMAGIC,
PERL_CORE", added in commit 52c6645). With the removal of
non-PERL_CORE support, these don't make much sense anymore, so I removed
them.
This change in turn enables further improvements: Common code in the
RCHECK and non-RCHECK branches can be extracted, making the "#ifdef
RCHECK" conditional sections smaller and eliminating the "#else"
sections entirely.
------------------------------------------------------------------------
In file included from malloc.c:240:
malloc.c: In function ‘Perl_malloc’:
perl.h:225:17: error: ‘my_perl’ undeclared (first use in this function)
225 | # define aTHX my_perl
| ^~~~~~~
perl.h:230:25: note: in expansion of macro ‘aTHX’
230 | # define aTHX_ aTHX,
| ^~~~
embed.h:966:60: note: in expansion of macro ‘aTHX_’
966 | # define croak(...) Perl_croak(aTHX_ __VA_ARGS__)
| ^~~~~
malloc.c:1254:13: note: in expansion of macro ‘croak’
1254 | croak("panic: malloc");
| ^~~~~
perl.h:225:17: note: each undeclared identifier is reported only once for each function it appears in
225 | # define aTHX my_perl
| ^~~~~~~
perl.h:230:25: note: in expansion of macro ‘aTHX’
230 | # define aTHX_ aTHX,
| ^~~~
embed.h:966:60: note: in expansion of macro ‘aTHX_’
966 | # define croak(...) Perl_croak(aTHX_ __VA_ARGS__)
| ^~~~~
malloc.c:1254:13: note: in expansion of macro ‘croak’
1254 | croak("panic: malloc");
| ^~~~~
malloc.c: In function ‘Perl_mfree’:
perl.h:225:17: error: ‘my_perl’ undeclared (first use in this function)
225 | # define aTHX my_perl
| ^~~~~~~
perl.h:230:25: note: in expansion of macro ‘aTHX’
230 | # define aTHX_ aTHX,
| ^~~~
embed.h:966:60: note: in expansion of macro ‘aTHX_’
966 | # define croak(...) Perl_croak(aTHX_ __VA_ARGS__)
| ^~~~~
malloc.c:1820:13: note: in expansion of macro ‘croak’
1820 | croak("wrong alignment in free()");
| ^~~~~
malloc.c: In function ‘Perl_realloc’:
perl.h:225:17: error: ‘my_perl’ undeclared (first use in this function)
225 | # define aTHX my_perl
| ^~~~~~~
perl.h:230:25: note: in expansion of macro ‘aTHX’
230 | # define aTHX_ aTHX,
| ^~~~
embed.h:966:60: note: in expansion of macro ‘aTHX_’
966 | # define croak(...) Perl_croak(aTHX_ __VA_ARGS__)
| ^~~~~
malloc.c:1925:13: note: in expansion of macro ‘croak’
1925 | croak("panic: realloc");
| ^~~~~
make: *** [makefile:265: malloc.o] Error 1
0 commit comments