From 7484dee7074216540b0c9452f818b7d1b600d486 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Thu, 31 Dec 2020 00:12:21 +0100 Subject: [PATCH] Fix a corner case for M_EMPTY_P where it performs too much evaluation steps --- m-core.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/m-core.h b/m-core.h index 746f14bc..2fd6408e 100644 --- a/m-core.h +++ b/m-core.h @@ -1024,7 +1024,7 @@ M_BEGIN_PROTECTED_CODE /* Return 1 if there is a comma inside the argument list, 0 otherwise. */ -#define M_COMMA_P(...) M_RET_ARG76(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, useless) +#define M_COMMA_P(...) M_RETI_ARG76(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, useless) /* Return the string representation of the evaluated x. NOTE: Need to be used with M_APPLY to defer the evaluation */ @@ -1032,7 +1032,7 @@ M_BEGIN_PROTECTED_CODE /* Return 1 if the argument is empty (aka ''), 0 otherwise. Handle: EMPTY_P(), EMPTY_P(x), EMPTY_P(()) and EMPTY_P(,) and EMPTY_P(f) with #define f() 2,3 */ -#define M_EMPTYI_DETECT(...) 0, 1, +#define M_EMPTYI_DETECT(...) , #define M_EMPTYI_P_C1(...) M_COMMA_P(M_EMPTYI_DETECT __VA_ARGS__ () ) #define M_EMPTYI_P_C2(...) M_COMMA_P(M_EMPTYI_DETECT __VA_ARGS__) #define M_EMPTYI_P_C3(...) M_COMMA_P(__VA_ARGS__ () )