Workaround CLANG preprocessor failure on Windows platform

This commit is contained in:
Patrick Pelissier committed 2021-01-10 20:03:28 +01:00
1 parent aefba70c1e
commit 944d29e8bc
2 files changed
+9

No files matched your search

+6
View File
@@ -1032,7 +1032,13 @@ M_BEGIN_PROTECTED_CODE
/* Return 1 if there is a comma inside the argument list,
0 otherwise. */
#if defined(__clang__) && defined(_MSC_VER)
// CLANG on windows has a non compliant preprocessor. Workaround it (with issue)
#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_WORKAROUND 1
#else
#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)
#endif
/* Return the string representation of the evaluated x.
NOTE: Need to be used with M_APPLY to defer the evaluation */
+3
View File
@@ -158,9 +158,12 @@ static void test_empty(void)
#define F3()
#define F4() 1,2
assert (M_EMPTY_P(F0) == false);
#ifndef M_COMMA_P_WORKAROUND
// Disable tests on platform with a non working preprocessor
assert (M_EMPTY_P(F1) == false);
assert (M_EMPTY_P(F2) == false);
assert (M_EMPTY_P(F3) == false);
#endif
assert (M_EMPTY_P(F4) == false);
#define G0 int
#define G1 (void)