028-select-cond-from-macro.M1pp (631B)
1 # %select cond produced by a macro call. 2 # - The cond argument is itself a %macro that expands to an integer 3 # expression. parse_args walks the call's tokens raw, but the cond 4 # is then evaluated as an expression which expands zero-arg macros 5 # via the same atom path used by %(...) arithmetic. 6 # - Both truthy and falsy macro-produced conds are exercised. 7 8 %macro ONE() 9 1 10 %endm 11 12 %macro ZERO() 13 0 14 %endm 15 16 %macro EQ_EXPR() 17 (= 4 4) 18 %endm 19 20 %macro NE_EXPR() 21 (!= 4 4) 22 %endm 23 24 %select(%ONE, picked_one, skipped) 25 %select(%ZERO, skipped, picked_zero) 26 %select(%EQ_EXPR, picked_eq, skipped) 27 %select(%NE_EXPR, skipped, picked_ne) 28 END