Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit b94c72c

Browse files
author
Reini Urban
committed
SvREADONLY_off: cast arg to (SV*)
to silence AV* comparison warnings. Note that SvREADONLY_off evaluates the argument multiple times, so it can only be used with a variable, not with the result of a call.
1 parent c150451 commit b94c72c

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

sv.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,15 +1189,16 @@ C<sv_force_normal> does nothing.
11891189
#else
11901190
# define SvREADONLY_on(sv) (SvFLAGS(sv) |= SVf_READONLY)
11911191
# ifdef USE_CPERL
1192-
# define SvREADONLY_off(sv) \
1193-
if (sv == &PL_sv_placeholder \
1194-
|| sv == &PL_sv_undef \
1195-
|| sv == &PL_sv_yes \
1196-
|| sv == &PL_sv_no \
1197-
|| sv == (SV*)&PL_padname_const \
1198-
|| sv == (SV*)&PL_defstash) \
1199-
croak_no_modify(); \
1200-
else \
1192+
# /* double evaluation! */
1193+
# define SvREADONLY_off(sv) \
1194+
if ((SV*)(sv) == &PL_sv_placeholder \
1195+
|| (SV*)(sv) == &PL_sv_undef \
1196+
|| (SV*)(sv) == &PL_sv_yes \
1197+
|| (SV*)(sv) == &PL_sv_no \
1198+
|| (SV*)(sv) == (SV*)&PL_padname_const \
1199+
|| (SV*)(sv) == (SV*)&PL_defstash) \
1200+
croak_no_modify(); \
1201+
else \
12011202
(SvFLAGS(sv) &= ~SVf_READONLY)
12021203
# else
12031204
# define SvREADONLY_off(sv) (SvFLAGS(sv) &= ~SVf_READONLY)

0 commit comments

Comments
 (0)