summaryrefslogtreecommitdiff
path: root/scope.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2022-03-02 11:08:58 -0700
committerYves Orton <demerphq@gmail.com>2022-03-03 02:42:27 +0100
commitca0572d7d359fdfdcdfa2ef0624fe9b9da3af2d6 (patch)
treecd938dc4e8292e1aa2e973137e1ca257e7d49af9 /scope.h
parent198c4f174582886fed1dd36610fff68fbe836c8e (diff)
downloadperl-ca0572d7d359fdfdcdfa2ef0624fe9b9da3af2d6.tar.gz
Add 'ASSERT_IS_LITERAL' macro
This is intended to make it obvious what this relatively obscure C construct is doing.
Diffstat (limited to 'scope.h')
-rw-r--r--scope.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/scope.h b/scope.h
index 234c8e15b5..57c3c214af 100644
--- a/scope.h
+++ b/scope.h
@@ -201,7 +201,7 @@ scope has the given name. C<name> must be a literal string.
STMT_START { \
push_scope(); \
if (PL_scopestack_name) \
- PL_scopestack_name[PL_scopestack_ix-1] = name; \
+ PL_scopestack_name[PL_scopestack_ix-1] = ASSERT_IS_LITERAL(name);\
DEBUG_SCOPE("ENTER \"" name "\"") \
} STMT_END
#define LEAVE_with_name(name) \
@@ -210,7 +210,7 @@ scope has the given name. C<name> must be a literal string.
if (PL_scopestack_name) { \
CLANG_DIAG_IGNORE_STMT(-Wstring-compare); \
assert(((char*)PL_scopestack_name[PL_scopestack_ix-1] \
- == (char*)name) \
+ == (char*)ASSERT_IS_LITERAL(name)) \
|| strEQ(PL_scopestack_name[PL_scopestack_ix-1], name)); \
CLANG_DIAG_RESTORE_STMT; \
} \