From ca0572d7d359fdfdcdfa2ef0624fe9b9da3af2d6 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Wed, 2 Mar 2022 11:08:58 -0700 Subject: Add 'ASSERT_IS_LITERAL' macro This is intended to make it obvious what this relatively obscure C construct is doing. --- scope.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scope.h') 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 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 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; \ } \ -- cgit v1.2.1