-
Notifications
You must be signed in to change notification settings - Fork 603
Open
Description
We need to be a lot more careful in macros to avoid using variable names likely to appear in the interpolated arguments. See https://perlmonks.org/?node_id=11144355 for an example, which I reckon was unreasonably hard to debug:
EXTEND(SP, ix == 3 ? 2*n : n);
I've no idea what the compiler is actually trying to do with this in:
# define EXTEND_HWM_SET(p, n) \
STMT_START { \
SSize_t ix = (p) - PL_stack_base + (n); \
if (ix > PL_curstackinfo->si_stack_hwm) \
PL_curstackinfo->si_stack_hwm = ix; \
} STMT_END
# define EXTEND(p,n) STMT_START { \
EXTEND_HWM_SET(p, n); \
if (UNLIKELY(_EXTEND_NEEDS_GROW(p,n))) { \
sp = stack_grow(sp,p,_EXTEND_SAFE_N(n)); \
PERL_UNUSED_VAR(sp); \
} } STMT_END
but I suspect we're in nasal demon territory.