Skip to content

Commit f3a5b2b

Browse files
committed
Revert "Attempt to remove deprecated sv_locking/unlocking"
This reverts commit 3afafdb. It turns out that Perl_sv_nounlocking() is the mechanism that is used to make sure mathoms.c gets loaded, as the comments in the reverted commit say, but which I had not noticed. Without this function being in mathoms.c, some build configurations will not load mathoms, leaving other functions in mathoms.c undefined, as happened with the two issues this fixes. This commit could be reinstated if another method is created to force mathoms to be loaded; This fixes #23473 This fixes #23474
1 parent b40ae72 commit f3a5b2b

File tree

6 files changed

+68
-3
lines changed

6 files changed

+68
-3
lines changed

embed.fnc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3274,7 +3274,10 @@ ARdp |SV * |sv_mortalcopy_flags \
32743274
|U32 flags
32753275
ARdp |SV * |sv_newmortal
32763276
Cdp |SV * |sv_newref |NULLOK SV * const sv
3277+
ADbdp |void |sv_nolocking |NULLOK SV *sv
3278+
32773279
Adp |void |sv_nosharing |NULLOK SV *sv
3280+
ADbdp |void |sv_nounlocking |NULLOK SV *sv
32783281
: Used in pp.c, pp_hot.c, sv.c
32793282
dpx |SV * |sv_2num |NN SV * const sv
32803283
Adm |bool |sv_numeq |NULLOK SV *sv1 \

embed.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,8 @@
923923
# endif
924924
# endif
925925
# if !defined(NO_MATHOMS)
926+
# define sv_nolocking(a) Perl_sv_nolocking(aTHX_ a)
927+
# define sv_nounlocking(a) Perl_sv_nounlocking(aTHX_ a)
926928
# define utf8_to_uvchr(a,b) Perl_utf8_to_uvchr(aTHX_ a,b)
927929
# define utf8_to_uvuni(a,b) Perl_utf8_to_uvuni(aTHX_ a,b)
928930
# define utf8n_to_uvuni(a,b,c,d) Perl_utf8n_to_uvuni(aTHX_ a,b,c,d)

intrpvar.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,13 @@ PERLVARI(I, lockhook, share_proc_t, Perl_sv_nosharing)
936936
GCC_DIAG_IGNORE(-Wdeprecated-declarations)
937937
MSVC_DIAG_IGNORE(4996)
938938

939-
PERLVARI(I, unlockhook, share_proc_t, Perl_sv_nosharing)
939+
#ifdef NO_MATHOMS
940+
# define PERL_UNLOCK_HOOK Perl_sv_nosharing
941+
#else
942+
/* This reference ensures that the mathoms are linked with perl */
943+
# define PERL_UNLOCK_HOOK Perl_sv_nounlocking
944+
#endif
945+
PERLVARI(I, unlockhook, share_proc_t, PERL_UNLOCK_HOOK)
940946

941947
MSVC_DIAG_RESTORE
942948
GCC_DIAG_RESTORE

mathoms.c

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,51 @@ Perl_do_aexec(pTHX_ SV *really, SV **mark, SV **sp)
437437
}
438438
#endif
439439

440+
/*
441+
=for apidoc_section $SV
442+
=for apidoc sv_nolocking
443+
444+
Dummy routine which "locks" an SV when there is no locking module present.
445+
Exists to avoid test for a C<NULL> function pointer and because it could
446+
potentially warn under some level of strict-ness.
447+
448+
"Superseded" by C<sv_nosharing()>.
449+
450+
=cut
451+
*/
452+
453+
void
454+
Perl_sv_nolocking(pTHX_ SV *sv)
455+
{
456+
PERL_UNUSED_CONTEXT;
457+
PERL_UNUSED_ARG(sv);
458+
}
459+
460+
461+
/*
462+
=for apidoc_section $SV
463+
=for apidoc sv_nounlocking
464+
465+
Dummy routine which "unlocks" an SV when there is no locking module present.
466+
Exists to avoid test for a C<NULL> function pointer and because it could
467+
potentially warn under some level of strict-ness.
468+
469+
"Superseded" by C<sv_nosharing()>.
470+
471+
=cut
472+
473+
PERL_UNLOCK_HOOK in intrpvar.h is the macro that refers to this, and guarantees
474+
that mathoms gets loaded.
475+
476+
*/
477+
478+
void
479+
Perl_sv_nounlocking(pTHX_ SV *sv)
480+
{
481+
PERL_UNUSED_CONTEXT;
482+
PERL_UNUSED_ARG(sv);
483+
}
484+
440485
void
441486
Perl_sv_usepvn_mg(pTHX_ SV *sv, char *ptr, STRLEN len)
442487
{

pod/perldelta.pod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,7 @@ well.
349349

350350
=item *
351351

352-
Removed the deprecated (since 5.32) functions C<sv_locking()> and
353-
C<sv_unlocking>.
352+
XXX
354353

355354
=back
356355

proto.h

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)