Skip to content

Commit f87cc89

Browse files
committed
Gereralize VA macro expansion mechanism
Avoids code duplication and makes in usable elsewhere.
1 parent 4bd6be8 commit f87cc89

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

Zend/zend_ast.h

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -204,27 +204,12 @@ ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_from_long(zend_long lval)
204204
ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_constant(zend_string *name, zend_ast_attr attr);
205205

206206
#if ZEND_AST_SPEC
207-
# ifdef ZEND_WIN32
208-
# define ZEND_AST_EXPAND_VA(a) a
209-
# endif
210-
211-
# ifdef ZEND_WIN32
212-
# define ZEND_AST_SPEC_CALL(name, ...) \
213-
ZEND_AST_EXPAND_VA(ZEND_AST_SPEC_CALL_(name, __VA_ARGS__, _4, _3, _2, _1, _0)(__VA_ARGS__))
214-
# else
215-
# define ZEND_AST_SPEC_CALL(name, ...) \
216-
ZEND_AST_SPEC_CALL_(name, __VA_ARGS__, _4, _3, _2, _1, _0)(__VA_ARGS__)
217-
# endif
207+
# define ZEND_AST_SPEC_CALL(name, ...) \
208+
ZEND_EXPAND_VA(ZEND_AST_SPEC_CALL_(name, __VA_ARGS__, _4, _3, _2, _1, _0)(__VA_ARGS__))
218209
# define ZEND_AST_SPEC_CALL_(name, _, _4, _3, _2, _1, suffix, ...) \
219210
name ## suffix
220-
221-
# ifdef ZEND_WIN32
222-
# define ZEND_AST_SPEC_CALL_EX(name, ...) \
223-
ZEND_AST_EXPAND_VA(ZEND_AST_SPEC_CALL_EX_(name, __VA_ARGS__, _4, _3, _2, _1, _0)(__VA_ARGS__))
224-
# else
225-
# define ZEND_AST_SPEC_CALL_EX(name, ...) \
226-
ZEND_AST_SPEC_CALL_EX_(name, __VA_ARGS__, _4, _3, _2, _1, _0)(__VA_ARGS__)
227-
# endif
211+
# define ZEND_AST_SPEC_CALL_EX(name, ...) \
212+
ZEND_EXPAND_VA(ZEND_AST_SPEC_CALL_EX_(name, __VA_ARGS__, _4, _3, _2, _1, _0)(__VA_ARGS__))
228213
# define ZEND_AST_SPEC_CALL_EX_(name, _, _5, _4, _3, _2, _1, suffix, ...) \
229214
name ## suffix
230215

Zend/zend_portability.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,13 @@ static zend_always_inline double _zend_get_nan(void) /* {{{ */
638638
#define ZEND_SLIDE_TO_ALIGNED(alignment, ptr) (((zend_uintptr_t)(ptr) + ((alignment)-1)) & ~((alignment)-1))
639639
#define ZEND_SLIDE_TO_ALIGNED16(ptr) ZEND_SLIDE_TO_ALIGNED(Z_UL(16), ptr)
640640

641+
#ifdef ZEND_WIN32
642+
# define _ZEND_EXPAND_VA(a) a
643+
# define ZEND_EXPAND_VA(code) _ZEND_EXPAND_VA(code)
644+
#else
645+
# define ZEND_EXPAND_VA(code) code
646+
#endif
647+
641648
#endif /* ZEND_PORTABILITY_H */
642649

643650
/*

0 commit comments

Comments
 (0)