Skip to content

Commit fed12fa

Browse files
committed
Avoid premature macro resolution / Fix OSX build
AST_STR(true) and AST_STR(false) were resolved to AST_STR(1) and AST_STR(0), so go back to using a str_ prefix everywhere.
1 parent 04c1023 commit fed12fa

File tree

4 files changed

+167
-167
lines changed

4 files changed

+167
-167
lines changed

ast.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -179,16 +179,16 @@ static void ast_create_virtual_node(
179179
object_init_ex(zv, ast_node_ce);
180180

181181
ZVAL_LONG(&tmp_zv, kind);
182-
ast_update_property(zv, AST_STR(kind), &tmp_zv, AST_CACHE_SLOT_KIND);
182+
ast_update_property(zv, AST_STR(str_kind), &tmp_zv, AST_CACHE_SLOT_KIND);
183183

184184
ZVAL_LONG(&tmp_zv, ast->attr);
185-
ast_update_property(zv, AST_STR(flags), &tmp_zv, AST_CACHE_SLOT_FLAGS);
185+
ast_update_property(zv, AST_STR(str_flags), &tmp_zv, AST_CACHE_SLOT_FLAGS);
186186

187187
ZVAL_LONG(&tmp_zv, zend_ast_get_lineno(ast));
188-
ast_update_property(zv, AST_STR(lineno), &tmp_zv, AST_CACHE_SLOT_LINENO);
188+
ast_update_property(zv, AST_STR(str_lineno), &tmp_zv, AST_CACHE_SLOT_LINENO);
189189

190190
array_init(&tmp_zv);
191-
ast_update_property(zv, AST_STR(children), &tmp_zv, AST_CACHE_SLOT_CHILDREN);
191+
ast_update_property(zv, AST_STR(str_children), &tmp_zv, AST_CACHE_SLOT_CHILDREN);
192192

193193
ZVAL_COPY(&tmp_zv2, zend_ast_get_zval(ast));
194194
if (version >= 30) {
@@ -292,36 +292,36 @@ static void ast_to_zval(zval *zv, zend_ast *ast, zend_long version) {
292292
object_init_ex(zv, is_decl ? ast_decl_ce : ast_node_ce);
293293

294294
ZVAL_LONG(&tmp_zv, ast->kind);
295-
ast_update_property(zv, AST_STR(kind), &tmp_zv, AST_CACHE_SLOT_KIND);
295+
ast_update_property(zv, AST_STR(str_kind), &tmp_zv, AST_CACHE_SLOT_KIND);
296296

297297
ZVAL_LONG(&tmp_zv, zend_ast_get_lineno(ast));
298-
ast_update_property(zv, AST_STR(lineno), &tmp_zv, AST_CACHE_SLOT_LINENO);
298+
ast_update_property(zv, AST_STR(str_lineno), &tmp_zv, AST_CACHE_SLOT_LINENO);
299299

300300
if (is_decl) {
301301
zend_ast_decl *decl = (zend_ast_decl *) ast;
302302

303303
ZVAL_LONG(&tmp_zv, decl->flags);
304-
ast_update_property(zv, AST_STR(flags), &tmp_zv, NULL);
304+
ast_update_property(zv, AST_STR(str_flags), &tmp_zv, NULL);
305305

306306
ZVAL_LONG(&tmp_zv, decl->end_lineno);
307-
ast_update_property(zv, AST_STR(endLineno), &tmp_zv, NULL);
307+
ast_update_property(zv, AST_STR(str_endLineno), &tmp_zv, NULL);
308308

309309
if (decl->name) {
310310
ZVAL_STR_COPY(&tmp_zv, decl->name);
311311
} else {
312312
ZVAL_NULL(&tmp_zv);
313313
}
314-
ast_update_property(zv, AST_STR(name), &tmp_zv, NULL);
314+
ast_update_property(zv, AST_STR(str_name), &tmp_zv, NULL);
315315

316316
if (decl->doc_comment) {
317317
ZVAL_STR_COPY(&tmp_zv, decl->doc_comment);
318318
} else {
319319
ZVAL_NULL(&tmp_zv);
320320
}
321-
ast_update_property(zv, AST_STR(docComment), &tmp_zv, NULL);
321+
ast_update_property(zv, AST_STR(str_docComment), &tmp_zv, NULL);
322322
} else {
323323
ZVAL_LONG(&tmp_zv, ast->attr);
324-
ast_update_property(zv, AST_STR(flags), &tmp_zv, AST_CACHE_SLOT_FLAGS);
324+
ast_update_property(zv, AST_STR(str_flags), &tmp_zv, AST_CACHE_SLOT_FLAGS);
325325
}
326326

327327
if (version < 15 && ast->kind == ZEND_AST_PROP_DECL) {
@@ -332,19 +332,19 @@ static void ast_to_zval(zval *zv, zend_ast *ast, zend_long version) {
332332
zend_ast *prop = props->child[i];
333333
if (prop->child[2]) {
334334
ZVAL_STR_COPY(&tmp_zv, zend_ast_get_str(prop->child[2]));
335-
ast_update_property(zv, AST_STR(docComment), &tmp_zv, NULL);
335+
ast_update_property(zv, AST_STR(str_docComment), &tmp_zv, NULL);
336336
break;
337337
}
338338
}
339339
}
340340

341341
if (version >= 15 && ast->kind == ZEND_AST_PROP_ELEM && ast->child[2]) {
342342
ZVAL_STR_COPY(&tmp_zv, zend_ast_get_str(ast->child[2]));
343-
ast_update_property(zv, AST_STR(docComment), &tmp_zv, NULL);
343+
ast_update_property(zv, AST_STR(str_docComment), &tmp_zv, NULL);
344344
}
345345

346346
array_init(&tmp_zv);
347-
ast_update_property(zv, AST_STR(children), &tmp_zv, AST_CACHE_SLOT_CHILDREN);
347+
ast_update_property(zv, AST_STR(str_children), &tmp_zv, AST_CACHE_SLOT_CHILDREN);
348348

349349
ast_fill_children_ht(Z_ARRVAL(tmp_zv), ast, version);
350350
}
@@ -529,7 +529,7 @@ PHP_MINIT_FUNCTION(ast) {
529529
zend_class_entry tmp_ce;
530530

531531
#define X(str) \
532-
AST_STR(str) = zend_new_interned_string( \
532+
AST_STR(str_ ## str) = zend_new_interned_string( \
533533
zend_string_init(#str, sizeof(#str) - 1, 1));
534534
AST_STR_DEFS
535535
#undef X
@@ -637,10 +637,10 @@ PHP_MINIT_FUNCTION(ast) {
637637
zval zv;
638638
ZVAL_NULL(&zv);
639639

640-
ast_declare_property(ast_node_ce, AST_STR(kind), &zv);
641-
ast_declare_property(ast_node_ce, AST_STR(flags), &zv);
642-
ast_declare_property(ast_node_ce, AST_STR(lineno), &zv);
643-
ast_declare_property(ast_node_ce, AST_STR(children), &zv);
640+
ast_declare_property(ast_node_ce, AST_STR(str_kind), &zv);
641+
ast_declare_property(ast_node_ce, AST_STR(str_flags), &zv);
642+
ast_declare_property(ast_node_ce, AST_STR(str_lineno), &zv);
643+
ast_declare_property(ast_node_ce, AST_STR(str_children), &zv);
644644
}
645645

646646
INIT_CLASS_ENTRY(tmp_ce, "ast\\Node\\Decl", NULL);
@@ -650,16 +650,16 @@ PHP_MINIT_FUNCTION(ast) {
650650
zval zv;
651651
ZVAL_NULL(&zv);
652652

653-
ast_declare_property(ast_decl_ce, AST_STR(endLineno), &zv);
654-
ast_declare_property(ast_decl_ce, AST_STR(name), &zv);
655-
ast_declare_property(ast_decl_ce, AST_STR(docComment), &zv);
653+
ast_declare_property(ast_decl_ce, AST_STR(str_endLineno), &zv);
654+
ast_declare_property(ast_decl_ce, AST_STR(str_name), &zv);
655+
ast_declare_property(ast_decl_ce, AST_STR(str_docComment), &zv);
656656
}
657657

658658
return SUCCESS;
659659
}
660660

661661
PHP_MSHUTDOWN_FUNCTION(ast) {
662-
#define X(str) zend_string_release(AST_STR(str));
662+
#define X(str) zend_string_release(AST_STR(str_ ## str));
663663
AST_STR_DEFS
664664
#undef X
665665

0 commit comments

Comments
 (0)