2017-12-11
2017-12-11 18:05:19 by Henrik Grubbström (Grubba) <grubba@grubba.org>
-
bdfe4eadf595e0fceedfb4cc85bf6266720a7498
(34 lines)
(+19/-15)
[
Show
| Annotate
]
Branch: master
Compiler: Add symbolic constants COMPILER_PASS_*.
This is in preparation for adding more passes.
761:
case F_ASSIGN:
case F_MULTI_ASSIGN:
case F_ASSIGN_SELF:
- if ((!a || a->token == F_CONSTANT) && (Pike_compiler->compiler_pass == 2)) {
+ if ((!a || a->token == F_CONSTANT) &&
+ (Pike_compiler->compiler_pass == COMPILER_PASS_LAST)) {
yyerror("Illegal lvalue.");
}
break;
1381:
}
#endif /* PIKE_DEBUG */
- if (Pike_compiler->compiler_pass == 2 && type->type != PIKE_T_AUTO ) {
+ if (Pike_compiler->compiler_pass == COMPILER_PASS_LAST &&
+ type->type != PIKE_T_AUTO ) {
if (type == void_type_string) {
yywarning("Soft cast to void.");
return mknode(F_POP_VALUE, n, 0);
1486:
return;
case F_UNDEFINED:
- if(Pike_compiler->compiler_pass==2) {
+ if(Pike_compiler->compiler_pass == COMPILER_PASS_LAST) {
/* FIXME: Ought to have the name of the identifier in the message. */
yyerror("Expected constant, got undefined identifier.");
}
1550:
push_svalue(&PROG_FROM_INT(p, numid)->
constants[i->func.const_info.offset].sval);
}else{
- if(Pike_compiler->compiler_pass!=1)
+ if(Pike_compiler->compiler_pass != COMPILER_PASS_FIRST)
yyerror("Constant is not defined yet.");
push_int(0);
}
1580:
break;
default:
- if (Pike_compiler->compiler_pass!=1)
+ if (Pike_compiler->compiler_pass != COMPILER_PASS_FIRST)
yyerror("Illegal program identifier");
pop_stack();
push_int(0);
1627:
SET_SVAL_TYPE(Pike_sp[-1], T_FUNCTION);
}else{
extern void f_object_program(INT32);
- if (Pike_compiler->compiler_pass == 2)
+ if (Pike_compiler->compiler_pass == COMPILER_PASS_LAST)
yywarning("Using object as program identifier.");
f_object_program(1);
}
1663:
/* FALL_THROUGH */
default:
- if (Pike_compiler->compiler_pass!=1)
+ if (Pike_compiler->compiler_pass != COMPILER_PASS_FIRST)
my_yyerror("Illegal program identifier: %O.", Pike_sp-1);
push_object_type(0, 0);
break;
1687:
if (!is_const(n)) {
/* Index dynamically. */
- if (Pike_compiler->compiler_pass == 2 && !(THIS_COMPILATION->lex.pragmas
- & ID_DYNAMIC_DOT))
+ if (Pike_compiler->compiler_pass == COMPILER_PASS_LAST &&
+ !(THIS_COMPILATION->lex.pragmas & ID_DYNAMIC_DOT))
{
yywarning("Using . to index dynamically.");
}
1978: Inside #if defined(PIKE_DEBUG)
case T_OBJECT:
#ifdef PIKE_DEBUG
if (s->u.object->prog == placeholder_program &&
- Pike_compiler->compiler_pass == 2)
+ Pike_compiler->compiler_pass == COMPILER_PASS_LAST)
Pike_fatal("Got placeholder object in second pass.\n");
#endif
if(s->u.object == Pike_compiler->fake_object)
3879:
}
}
}
- if (CDR(n) && (Pike_compiler->compiler_pass == 2)) {
+ if (CDR(n) && (Pike_compiler->compiler_pass == COMPILER_PASS_LAST)) {
fix_type_field(CDR(n));
if (!match_types(CDR(n)->type, enumerable_type_string)) {
yytype_report(REPORT_WARNING,
3890:
}
/* FALL_THROUGH */
case F_CASE:
- if (CAR(n) && (Pike_compiler->compiler_pass == 2)) {
+ if (CAR(n) && (Pike_compiler->compiler_pass == COMPILER_PASS_LAST)) {
fix_type_field(CAR(n));
if (!match_types(CAR(n)->type, enumerable_type_string)) {
yytype_report(REPORT_WARNING,
4269:
void optimize_node(node *n)
{
if(n &&
- Pike_compiler->compiler_pass==2 &&
+ Pike_compiler->compiler_pass == COMPILER_PASS_LAST &&
(n->node_info & OPT_TRY_OPTIMIZE))
{
optimize(n);
4601: Inside #if defined(PIKE_DEBUG)
#ifdef PIKE_DEBUG
(a_flag > 1) ||
#endif
- ((c->lex.pragmas & ID_DISASSEMBLE) && (Pike_compiler->compiler_pass==2)))
+ ((c->lex.pragmas & ID_DISASSEMBLE) &&
+ (Pike_compiler->compiler_pass == COMPILER_PASS_LAST)))
fprintf(stderr, "Doing function '%s' at %lx\n", name->str,
(unsigned long)PIKE_PC);
4630:
fprintf(stderr, "Extra identifier flags:0x%02x\n", vargs);
#endif
- if(Pike_compiler->compiler_pass==1)
+ if(Pike_compiler->compiler_pass != COMPILER_PASS_LAST)
{
tmp.offset=-1;
#ifdef PIKE_DEBUG