14 /* Make sure argument expansion replaces the right tokens. */
15 #define KEY(pass, fail) fail
36 /* Function-like macros which cannot be expanded (due to argument count mismatch
37 * or other parse errors) emit only the macro name and nothing else. In the case
38 * of unterminated macro lists, nothing after the macro name is emitted. */
39 #define pass(a, b) a b fail
44 #define pass(a, b) fail
45 pass(fail, fail, fail)
48 #define KEY(a, b) fail
53 #define pass(a, b) fail
63 #define KEY(a, b) a ## b
67 #define KEY(a, b) pa ## ss
71 #define KEY(a) a ## ss
75 #define KEY(a) pa ## a
89 /* Concatenation is only parsed if the macro has arguments. */
117 #define KEY(a,b) fail
165 #define KEY(a, b) (a < b)
178 /* Identifiers are not expanded in the LHS of #define statements. */
189 KEY("fail,fail",pass)
221 KEY((pass,pass),(fail,fail))
225 KEY((,,fail,,fail,,),(,,pass,,pass,,))
229 KEY([,,fail,,fail,,],[,,pass,,pass,,])
233 KEY({,,fail,,fail,,},{,,pass,,pass,,})
236 #define KEY(a, b) pass
240 #define KEY(a, b) pass
244 /* Unbalanced parentheses result in an unterminated macro. */
245 #define pass(a, b) fail
253 /* Macro arguments suffer their own macro expansion only after the macro has
254 * been completely parsed. */
261 /* The same applies to #if. */
280 /* Directives inside of macro arguments are always evaluated. */
281 #define FUNC(a) value
288 #define FUNC1(a) a ## ss
289 #define FUNC2(a, b) a < b
302 #define __LINE__ pass
310 #define KEY2(x) x ## ss
311 #define KEY(a) KEY2(a)
317 #define KEY KEY2(fa il)
322 #define Key1::Key2 pass
330 #define Key1::Key2(x) pass
334 #define Key1::Key2::Key3 pass
338 #define Key1:pass value
342 #define Key1::::pass value
351 #define key::bar fail
356 #define bar::key fail
360 #define fail::1KEY pass
368 #define fail(key1::key2) key1::key2
372 #define key1:: key2 pass
376 #define key1 ::key2 pass
380 #define KEY(a, b) a b