Cleanup dead/duplicate code

This commit is contained in:
Nikita Popov 2014-07-28 15:23:00 +02:00
parent a2925df653
commit 38c4125c2e
3 changed files with 10 additions and 55 deletions

View File

@ -555,13 +555,6 @@ static int zend_add_const_name_literal(zend_op_array *op_array, zval *zv, int un
#define MAKE_NOP(opline) { opline->opcode = ZEND_NOP; memset(&opline->result,0,sizeof(opline->result)); memset(&opline->op1,0,sizeof(opline->op1)); memset(&opline->op2,0,sizeof(opline->op2)); opline->result_type=opline->op1_type=opline->op2_type=IS_UNUSED; }
void zend_discard_doc_comment(TSRMLS_D) {
if (CG(doc_comment)) {
STR_RELEASE(CG(doc_comment));
CG(doc_comment) = NULL;
}
}
void zend_stop_lexing(TSRMLS_D) {
LANG_SCNG(yy_cursor) = LANG_SCNG(yy_limit);
}
@ -2840,27 +2833,6 @@ ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, int le
}
/* }}} */
void zend_do_halt_compiler_register(TSRMLS_D) /* {{{ */
{
zend_string *name;
zend_string *cfilename;
char haltoff[] = "__COMPILER_HALT_OFFSET__";
if (CG(has_bracketed_namespaces) && CG(in_namespace)) {
zend_error_noreturn(E_COMPILE_ERROR, "__HALT_COMPILER() can only be used from the outermost scope");
}
cfilename = zend_get_compiled_filename(TSRMLS_C);
name = zend_mangle_property_name(haltoff, sizeof(haltoff) - 1, cfilename->val, cfilename->len, 0);
zend_register_long_constant(name->val, name->len, zend_get_scanned_file_offset(TSRMLS_C), CONST_CS, 0 TSRMLS_CC);
STR_FREE(name);
if (CG(in_namespace)) {
zend_do_end_namespace(TSRMLS_C);
}
}
/* }}} */
static zend_constant *zend_get_ct_const(zend_string *name, int all_internal_constants_substitution TSRMLS_DC) /* {{{ */
{
zend_constant *c = NULL;
@ -2996,17 +2968,6 @@ void zend_do_extended_fcall_end(TSRMLS_D) /* {{{ */
}
/* }}} */
void zend_do_ticks(TSRMLS_D) /* {{{ */
{
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
opline->opcode = ZEND_TICKS;
SET_UNUSED(opline->op1);
SET_UNUSED(opline->op2);
opline->extended_value = Z_LVAL(CG(declarables).ticks);
}
/* }}} */
zend_bool zend_is_auto_global(zend_string *name TSRMLS_DC) /* {{{ */
{
zend_auto_global *auto_global;

View File

@ -40,15 +40,13 @@
#define INC_BPC(op_array) if (op_array->fn_flags & ZEND_ACC_INTERACTIVE) { (CG(context).backpatch_count++); }
#define DEC_BPC(op_array) if (op_array->fn_flags & ZEND_ACC_INTERACTIVE) { (CG(context).backpatch_count--); }
#define HANDLE_INTERACTIVE() if (CG(active_op_array)->fn_flags & ZEND_ACC_INTERACTIVE) { execute_new_code(TSRMLS_C); }
#define DO_TICKS() if (Z_LVAL(CG(declarables).ticks)) { zend_do_ticks(TSRMLS_C); }
#define RESET_DOC_COMMENT() \
{ \
if (CG(doc_comment)) { \
STR_RELEASE(CG(doc_comment)); \
CG(doc_comment) = NULL; \
} \
}
#define RESET_DOC_COMMENT() do { \
if (CG(doc_comment)) { \
STR_RELEASE(CG(doc_comment)); \
CG(doc_comment) = NULL; \
} \
} while (0)
typedef struct _zend_op_array zend_op_array;
typedef struct _zend_op zend_op;
@ -495,8 +493,6 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
void zend_do_early_binding(TSRMLS_D);
ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array TSRMLS_DC);
void zend_do_halt_compiler_register(TSRMLS_D);
/* Functions for a null terminated pointer list, used for traits parsing and compilation */
void zend_init_list(void *result, void *item TSRMLS_DC);
void zend_add_to_list(void *result, void *item TSRMLS_DC);
@ -505,8 +501,6 @@ void zend_do_extended_info(TSRMLS_D);
void zend_do_extended_fcall_begin(TSRMLS_D);
void zend_do_extended_fcall_end(TSRMLS_D);
void zend_do_ticks(TSRMLS_D);
void zend_do_abstract_method(const znode *function_name, znode *modifiers, const znode *body TSRMLS_DC);
void zend_do_end_namespace(TSRMLS_D);

View File

@ -255,11 +255,11 @@ top_statement:
zend_stop_lexing(TSRMLS_C); }
| T_NAMESPACE namespace_name ';'
{ $$.ast = zend_ast_create_binary(ZEND_AST_NAMESPACE, $2.ast, NULL);
zend_discard_doc_comment(TSRMLS_C); }
| T_NAMESPACE namespace_name { zend_discard_doc_comment(TSRMLS_C); }
RESET_DOC_COMMENT(); }
| T_NAMESPACE namespace_name { RESET_DOC_COMMENT(); }
'{' top_statement_list '}'
{ $$.ast = zend_ast_create_binary(ZEND_AST_NAMESPACE, $2.ast, $5.ast); }
| T_NAMESPACE { zend_discard_doc_comment(TSRMLS_C); }
| T_NAMESPACE { RESET_DOC_COMMENT(); }
'{' top_statement_list '}'
{ $$.ast = zend_ast_create_binary(ZEND_AST_NAMESPACE, NULL, $4.ast); }
| T_USE use_declarations ';'
@ -607,7 +607,7 @@ class_statement:
variable_modifiers property_list ';'
{ $$.ast = $2.ast; $$.ast->attr = $1.num; }
| T_CONST class_const_list ';'
{ $$.ast = $2.ast; zend_discard_doc_comment(TSRMLS_C); }
{ $$.ast = $2.ast; RESET_DOC_COMMENT(); }
| T_USE name_list trait_adaptations
{ $$.ast = zend_ast_create_binary(ZEND_AST_USE_TRAIT, $2.ast, $3.ast); }
| method_modifiers function returns_ref T_STRING '(' parameter_list ')'