diff --git a/autodoc.pl b/autodoc.pl index e36df49b68..0853d2aa53 100644 --- a/autodoc.pl +++ b/autodoc.pl @@ -86,7 +86,6 @@ my $item_flags_re = qr/[dD fF mM nN oO pT uU Wx;]/xx; # This is a copy of the list in regen/embed.pl. my @have_compatibility_macros = qw( - croak deb die form diff --git a/embed.fnc b/embed.fnc index f1a1094103..32cf046308 100644 --- a/embed.fnc +++ b/embed.fnc @@ -922,7 +922,7 @@ px |void |create_eval_scope \ |NN SV **sp \ |U32 flags : croak()'s first parm can be NULL. Otherwise, mod_perl breaks. -Adfpr |void |croak |NULLOK const char *pat \ +AMdfpr |void |croak |NULLOK const char *pat \ |... Tfpr |void |croak_caller |NULLOK const char *pat \ |... diff --git a/embed.h b/embed.h index bef2e7b7fa..72aef7aa81 100644 --- a/embed.h +++ b/embed.h @@ -29,7 +29,6 @@ #if !defined(MULTIPLICITY) /* undefined symbols, point them back at the usual ones */ -# define Perl_croak_nocontext Perl_croak # define Perl_deb_nocontext Perl_deb # define Perl_die_nocontext Perl_die # define Perl_form_nocontext Perl_form @@ -78,7 +77,6 @@ # if defined(MULTIPLICITY) && !defined(PERL_NO_SHORT_NAMES) && \ !defined(PERL_WANT_VARARGS) -# define croak Perl_croak_nocontext # define deb Perl_deb_nocontext # define die Perl_die_nocontext # define form Perl_form_nocontext @@ -914,7 +912,6 @@ # endif /* defined(MULTIPLICITY) */ # if !defined(MULTIPLICITY) || defined(PERL_CORE) || \ defined(PERL_WANT_VARARGS) -# define croak(...) Perl_croak(aTHX_ __VA_ARGS__) # define deb(...) Perl_deb(aTHX_ __VA_ARGS__) # define die(...) Perl_die(aTHX_ __VA_ARGS__) # define form(...) Perl_form(aTHX_ __VA_ARGS__) diff --git a/regen/embed.pl b/regen/embed.pl index 706a181609..5fbce07114 100755 --- a/regen/embed.pl +++ b/regen/embed.pl @@ -41,7 +41,6 @@ BEGIN { # N.B. If you change this list, update the copy in autodoc.pl. This is likely # to never happen, so not worth coding automatic synchronization. my @have_compatibility_macros = qw( - croak deb die form diff --git a/util.c b/util.c index 6712433f35..982a318011 100644 --- a/util.c +++ b/util.c @@ -1912,10 +1912,9 @@ error message from arguments. If you want to throw a non-string object, or build an error message in an SV yourself, it is preferable to use the C> function, which does not involve clobbering C. -The two forms differ only in that C does not take a thread -context (C) parameter. It is usually preferred as it takes up fewer -bytes of code than plain C, and time is rarely a critical resource -when you are about to throw an exception. +The reasons for the existence of C are no longer applicable. +croak() can now be used in all circumstances. C might be +useful when compiling with C. =cut */ diff --git a/util.h b/util.h index 4be411fbe3..c935d967e8 100644 --- a/util.h +++ b/util.h @@ -11,6 +11,15 @@ #ifndef PERL_UTIL_H_ #define PERL_UTIL_H_ +/* Calling Perl_croak_nocontext instead of plain Perl_croak is one less + * argument to pass under threads, so each instance takes up fewer bytes (but + * the nocontext function has to derive the thread context itself, taking more + * time). We trade time for less space here, because time is rarely a + * critical resource when you are about to throw an exception. */ +#define croak(...) Perl_croak_nocontext(__VA_ARGS__) +#ifndef MULTIPLICITY +# define Perl_croak_nocontext Perl_croak +#endif #ifdef VMS # define PERL_FILE_IS_ABSOLUTE(f) \