pike.git / src / docode.c

version» Context lines:

pike.git/src/docode.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   /**/   #include "global.h" - RCSID("$Id: docode.c,v 1.78 2000/08/15 16:13:55 grubba Exp $"); + RCSID("$Id: docode.c,v 1.79 2000/08/16 10:49:19 grubba Exp $");   #include "las.h"   #include "program.h"   #include "pike_types.h"   #include "stralloc.h"   #include "interpret.h"   #include "constants.h"   #include "array.h"   #include "pike_macros.h"   #include "error.h"   #include "pike_memory.h"
pike.git/src/docode.c:336:    case '?':    {    INT32 *prev_switch_jumptable = current_switch_jumptable;    int adroppings , bdroppings;    current_switch_jumptable=0;          if(!CDDR(n))    {    tmp1=alloc_label(); -  do_jump_when_zero(CAR(n), tmp1); +  do_jump_when_zero(CAR(n), DO_NOT_WARN((INT32)tmp1));    DO_CODE_BLOCK(CADR(n)); -  emit1(F_LABEL, tmp1); +  emit1(F_LABEL, DO_NOT_WARN((INT32)tmp1));    current_switch_jumptable = prev_switch_jumptable;    return 0;    }       if(!CADR(n))    {    tmp1=alloc_label(); -  do_jump_when_non_zero(CAR(n), tmp1); +  do_jump_when_non_zero(CAR(n), DO_NOT_WARN((INT32)tmp1));    DO_CODE_BLOCK(CDDR(n)); -  emit1(F_LABEL,tmp1); +  emit1(F_LABEL, DO_NOT_WARN((INT32)tmp1));    current_switch_jumptable = prev_switch_jumptable;    return 0;    }       tmp1=alloc_label(); -  do_jump_when_zero(CAR(n),tmp1); +  do_jump_when_zero(CAR(n), DO_NOT_WARN((INT32)tmp1));       adroppings=do_docode(CADR(n), flags);    tmp3=emit1(F_POP_N_ELEMS,0);       /* Else */    tmp2=do_jump(F_BRANCH,-1); -  emit1(F_LABEL, tmp1); +  emit1(F_LABEL, DO_NOT_WARN((INT32)tmp1));       bdroppings=do_docode(CDDR(n), flags);    if(adroppings < bdroppings)    {    do_pop(bdroppings - adroppings);    }       if(adroppings > bdroppings)    { -  update_arg(tmp3,adroppings-bdroppings); +  update_arg(DO_NOT_WARN((INT32)tmp3), +  adroppings - bdroppings);    adroppings=bdroppings;    }    -  emit1(F_LABEL, tmp2); +  emit1(F_LABEL, DO_NOT_WARN((INT32)tmp2));       current_switch_jumptable = prev_switch_jumptable;    return adroppings;    }       case F_AND_EQ:    case F_OR_EQ:    case F_XOR_EQ:    case F_LSH_EQ:    case F_RSH_EQ:
pike.git/src/docode.c:524:    if(do_docode(CAR(n),0)!=1) yyerror("RHS is void!");    emit0(flags & DO_POP ? F_ASSIGN_AND_POP:F_ASSIGN);    break;    }    return flags & DO_POP ? 0 : 1;    }       case F_LAND:    case F_LOR:    tmp1=alloc_label(); -  do_cond_jump(CAR(n), tmp1, n->token == F_LOR, 0); +  do_cond_jump(CAR(n), DO_NOT_WARN((INT32)tmp1), n->token == F_LOR, 0);    code_expression(CDR(n), flags, n->token == F_LOR ? "||" : "&&"); -  emit1(F_LABEL,tmp1); +  emit1(F_LABEL, DO_NOT_WARN((INT32)tmp1));    return 1;       case F_EQ:    case F_NE:    case F_ADD:    case F_LT:    case F_LE:    case F_GT:    case F_GE:    case F_SUBTRACT:
pike.git/src/docode.c:555:    case F_NOT:    case F_COMPL:    case F_NEGATE:    fatal("Optimizer error.\n");       case F_RANGE:    tmp1=do_docode(CAR(n),DO_NOT_COPY);    if(do_docode(CDR(n),DO_NOT_COPY)!=2)    fatal("Compiler internal error (at %ld).\n",(long)lex.current_line);    emit0(n->token); -  return tmp1; +  return DO_NOT_WARN((INT32)tmp1);       case F_INC:    case F_POST_INC:    tmp1=do_docode(CAR(n),DO_LVALUE);   #ifdef PIKE_DEBUG    if(tmp1 != 2)    fatal("HELP! FATAL INTERNAL COMPILER ERROR (1)\n");   #endif       if(flags & DO_POP)
pike.git/src/docode.c:610:    if(CDR(n))    {    do_jump_when_zero(CAR(n),current_break);    tmp2=ins_label(-1);    DO_CODE_BLOCK(CADR(n));    ins_label(current_continue);    DO_CODE_BLOCK(CDDR(n));    }else{    tmp2=ins_label(-1);    } -  do_jump_when_non_zero(CAR(n),tmp2); +  do_jump_when_non_zero(CAR(n), DO_NOT_WARN((INT32)tmp2));    ins_label(current_break);       current_switch_jumptable = prev_switch_jumptable;    current_break=break_save;    current_continue=continue_save;    return 0;    }       case ' ':    return do_docode(CAR(n),0)+do_docode(CDR(n),DO_LVALUE);
pike.git/src/docode.c:665: Inside #if defined(PIKE_DEBUG)
   * will disappear when new instructions are added to the code, but    * think it is worth it.    */    if(d_flag)    emit0(F_MARK);   #endif    tmp3=do_jump(F_BRANCH,-1);    tmp1=ins_label(-1);    DO_CODE_BLOCK(CDR(n));    ins_label(current_continue); -  emit1(F_LABEL,tmp3); -  do_jump(n->token,tmp1); +  emit1(F_LABEL, DO_NOT_WARN((INT32)tmp3)); +  do_jump(n->token, DO_NOT_WARN((INT32)tmp1));    ins_label(current_break);      #ifdef PIKE_DEBUG    if(d_flag)    emit0(F_POP_MARK);   #endif       current_switch_jumptable = prev_switch_jumptable;    current_break=break_save;    current_continue=continue_save;
pike.git/src/docode.c:708: Inside #if defined(PIKE_DEBUG)
   * think it is worth it.    */    if(d_flag)    emit0(F_MARK);   #endif    tmp3=do_jump(F_BRANCH,-1);    tmp1=ins_label(-1);       DO_CODE_BLOCK(CDR(n));    ins_label(current_continue); -  emit1(F_LABEL,tmp3); -  do_jump(n->token,tmp1); +  emit1(F_LABEL, DO_NOT_WARN((INT32)tmp3)); +  do_jump(n->token, DO_NOT_WARN((INT32)tmp1));    ins_label(current_break);   #ifdef PIKE_DEBUG    if(d_flag)    emit0(F_POP_MARK);   #endif       current_switch_jumptable = prev_switch_jumptable;    current_break=break_save;    current_continue=continue_save;    do_pop(3);
pike.git/src/docode.c:736:    INT32 break_save = current_break;    INT32 continue_save = current_continue;       current_switch_jumptable=0;    current_break=alloc_label();    current_continue=alloc_label();       tmp2=ins_label(-1);    DO_CODE_BLOCK(CAR(n));    ins_label(current_continue); -  do_jump_when_non_zero(CDR(n),tmp2); +  do_jump_when_non_zero(CDR(n), DO_NOT_WARN((INT32)tmp2));    ins_label(current_break);       current_switch_jumptable = prev_switch_jumptable;    current_break=break_save;    current_continue=continue_save;    return 0;    }       case F_POP_VALUE:    {
pike.git/src/docode.c:758:    return 0;    }       case F_CAST:    if(n->type==void_type_string)    {    DO_CODE_BLOCK(CAR(n));    return 0;    }    tmp1=store_prog_string(n->type); -  emit1(F_STRING,tmp1); +  emit1(F_STRING, DO_NOT_WARN((INT32)tmp1));       tmp1=do_docode(CAR(n),0);    if(!tmp1) { emit0(F_CONST0); tmp1=1; } -  if(tmp1>1) do_pop(tmp1-1); +  if(tmp1>1) do_pop(DO_NOT_WARN((INT32)(tmp1-1)));       emit0(F_CAST);    return 1;       case F_SOFT_CAST:    if (runtime_options & RUNTIME_CHECK_TYPES) {    tmp1 = store_prog_string(n->type); -  emit1(F_STRING, tmp1); +  emit1(F_STRING, DO_NOT_WARN((INT32)tmp1));    tmp1 = do_docode(CAR(n), 0);    if (!tmp1) { emit0(F_CONST0); tmp1 = 1; } -  if (tmp1 > 1) do_pop(tmp1 - 1); +  if (tmp1 > 1) do_pop(DO_NOT_WARN((INT32)(tmp1 - 1)));    emit0(F_SOFT_CAST);    return 1;    }    tmp1 = do_docode(CAR(n), flags); -  if (tmp1 > 1) do_pop(tmp1 - 1); +  if (tmp1 > 1) do_pop(DO_NOT_WARN((INT32)(tmp1 - 1)));    return !!tmp1;       case F_APPLY:    if(CAR(n)->token == F_CONSTANT)    {    if(CAR(n)->u.sval.type == T_FUNCTION)    {    if(CAR(n)->u.sval.subtype == FUNCTION_BUILTIN) /* driver fun? */    {    if(!CAR(n)->u.sval.u.efun->docode ||    !CAR(n)->u.sval.u.efun->docode(n))    {    emit0(F_MARK);    do_docode(CDR(n),0);    tmp1=store_constant(& CAR(n)->u.sval,    !(CAR(n)->tree_info & OPT_EXTERNAL_DEPEND),    CAR(n)->name); -  emit1(F_APPLY,tmp1); +  emit1(F_APPLY, DO_NOT_WARN((INT32)tmp1));    }    if(n->type == void_type_string)    return 0;       return 1;    }else{    if(CAR(n)->u.sval.u.object == Pike_compiler->fake_object)    return do_lfun_call(CAR(n)->u.sval.subtype,CDR(n));    }    }       emit0(F_MARK);    do_docode(CDR(n),0);    tmp1=store_constant(& CAR(n)->u.sval,    !(CAR(n)->tree_info & OPT_EXTERNAL_DEPEND),    CAR(n)->name); -  emit1(F_APPLY,tmp1); +  emit1(F_APPLY, DO_NOT_WARN((INT32)tmp1));       return 1;    }    else if(CAR(n)->token == F_IDENTIFIER &&    IDENTIFIER_IS_FUNCTION(ID_FROM_INT(Pike_compiler->new_program,    CAR(n)->u.id.number)->identifier_flags))    {    return do_lfun_call(CAR(n)->u.id.number,CDR(n));    }    else
pike.git/src/docode.c:848:    yyerror("No call_function efun.");    }else{    if(foo->u.sval.type == T_FUNCTION &&    foo->u.sval.subtype == FUNCTION_BUILTIN &&    foo->u.sval.u.efun->function == f_call_function)    {    emit0(F_CALL_FUNCTION);    }else{    /* We might want to put "predef::"+foo->name here /Hubbe */    tmp1=store_constant(& foo->u.sval, 1, foo->name); -  emit1(F_APPLY, tmp1); +  emit1(F_APPLY, DO_NOT_WARN((INT32)tmp1));    }    }    free_node(foo);    return 1;    }       case F_ARG_LIST:    case F_COMMA_EXPR:    tmp1=do_docode(CAR(n),flags & ~WANT_LVALUE);    tmp1+=do_docode(CDR(n),flags); -  return tmp1; +  return DO_NOT_WARN((INT32)tmp1);          /* Switch:    * So far all switches are implemented with a binsearch lookup.    * It stores the case values in the programs area for constants.    * It also has a jump-table in the program itself, for every index in    * the array of cases, there is 2 indexes in the jumptable, and one extra.    * The first entry in the jumptable is used if you call switch with    * a value that is ranked lower than all the indexes in the array of    * cases. (Ranked by the binsearch that is) The second is used if it
pike.git/src/docode.c:960:    current_switch_jumptable[e]=current_switch_default;       order_array(Pike_sp[-1].u.array,order);       reorder((void *)(current_switch_jumptable+2),cases,sizeof(INT32)*2,order);    free((char *)order);       for(e=1; e<cases*2+2; e++)    update_arg(jumptable[e], current_switch_jumptable[e]);    -  update_arg(tmp1, store_constant(Pike_sp-1,1,0)); +  update_arg(DO_NOT_WARN((INT32)tmp1), +  store_constant(Pike_sp-1,1,0));       pop_stack();    free((char *)jumptable);    free((char *)current_switch_jumptable);       current_switch_jumptable = prev_switch_jumptable;    current_switch_default = prev_switch_default;    current_switch_case = prev_switch_case;    current_switch_values_on_stack = prev_switch_values_on_stack;    current_switch_type = prev_switch_type;
pike.git/src/docode.c:1103:    return 0;       case F_RETURN:    do_docode(CAR(n),0);    emit0(F_RETURN);    return 0;       case F_SSCANF:    tmp1=do_docode(CAR(n),DO_NOT_COPY);    tmp2=do_docode(CDR(n),DO_NOT_COPY | DO_LVALUE); -  emit1(F_SSCANF,tmp1+tmp2); +  emit1(F_SSCANF, DO_NOT_WARN((INT32)(tmp1+tmp2)));    return 1;       case F_CATCH:    {    INT32 break_save = current_break;    INT32 continue_save = current_continue;    INT32 *prev_switch_jumptable = current_switch_jumptable;       current_switch_jumptable=0;    current_break=alloc_label();    current_continue=alloc_label();       tmp1=do_jump(F_CATCH,-1);    DO_CODE_BLOCK(CAR(n));    ins_label(current_continue);    ins_label(current_break);    emit0(F_THROW_ZERO); -  ins_label(tmp1); +  ins_label(DO_NOT_WARN((INT32)tmp1));       current_break=break_save;    current_continue=continue_save;    current_switch_jumptable = prev_switch_jumptable;    return 1;    }       case F_LVALUE_LIST:    return do_docode(CAR(n),DO_LVALUE)+do_docode(CDR(n),DO_LVALUE);       case F_ARRAY_LVALUE:    tmp1=do_docode(CAR(n),DO_LVALUE);   #ifdef PIKE_DEBUG    if(tmp1 & 1)    fatal("Very internal compiler error.\n");   #endif -  emit1(F_ARRAY_LVALUE, tmp1>>1); +  emit1(F_ARRAY_LVALUE, DO_NOT_WARN((INT32)(tmp1>>1)));    return 2;       case F_ARROW:    if(CDR(n)->token != F_CONSTANT || CDR(n)->u.sval.type!=T_STRING)    fatal("Bugg in F_ARROW, index not string.");    if(flags & WANT_LVALUE)    {    /* FIXME!!!! ??? I wonder what needs fixing... /Hubbe */    tmp1=do_docode(CAR(n), 0);    emit1(F_ARROW_STRING, store_prog_string(CDR(n)->u.sval.u.string));
pike.git/src/docode.c:1160:    }else{    tmp1=do_docode(CAR(n), DO_NOT_COPY);    emit1(F_ARROW, store_prog_string(CDR(n)->u.sval.u.string));    if(!(flags & DO_NOT_COPY))    {    while(n && (n->token==F_INDEX || n->token==F_ARROW)) n=CAR(n);    if(n->token==F_CONSTANT && !(n->node_info & OPT_EXTERNAL_DEPEND))    emit0(F_COPY_VALUE);    }    } -  return tmp1; +  return DO_NOT_WARN((INT32)tmp1);       case F_INDEX:    if(flags & WANT_LVALUE)    {    int mklval=CAR(n) && match_types(CAR(n)->type, string_type_string);    tmp1=do_docode(CAR(n),    mklval ? DO_LVALUE_IF_POSSIBLE : 0);    if(tmp1==2)    {   #ifdef PIKE_DEBUG
pike.git/src/docode.c:1200:       emit0(F_INDEX);       if(!(flags & DO_NOT_COPY))    {    while(n && (n->token==F_INDEX || n->token==F_ARROW)) n=CAR(n);    if(n->token==F_CONSTANT && !(n->node_info & OPT_EXTERNAL_DEPEND))    emit0(F_COPY_VALUE);    }    } -  return tmp1; +  return DO_NOT_WARN((INT32)tmp1);       case F_CONSTANT:    switch(n->u.sval.type)    {    case T_INT:    if(!n->u.sval.u.integer && n->u.sval.subtype==NUMBER_UNDEFINED)    {    emit0(F_UNDEFINED);    }else{    emit1(F_NUMBER,n->u.sval.u.integer);    }    return 1;       case T_STRING:    tmp1=store_prog_string(n->u.sval.u.string); -  emit1(F_STRING,tmp1); +  emit1(F_STRING, DO_NOT_WARN((INT32)tmp1));    return 1;       case T_FUNCTION:    if(n->u.sval.subtype!=FUNCTION_BUILTIN)    {    if(n->u.sval.u.object == Pike_compiler->fake_object)    {    emit1(F_LFUN,n->u.sval.subtype);    return 1;    }
pike.git/src/docode.c:1251: Inside #if defined(PIKE_DEBUG)
  #ifdef PIKE_DEBUG    case T_OBJECT:    if(n->u.sval.u.object->next == n->u.sval.u.object)    fatal("Internal error: Pointer to parent cannot be a compile time constant!\n");   #endif       default:    tmp1=store_constant(&(n->u.sval),    !(n->tree_info & OPT_EXTERNAL_DEPEND),    n->name); -  emit1(F_CONSTANT,tmp1); +  emit1(F_CONSTANT, DO_NOT_WARN((INT32)tmp1));    return 1;       case T_ARRAY:    case T_MAPPING:    case T_MULTISET:    tmp1=store_constant(&(n->u.sval),    !(n->tree_info & OPT_EXTERNAL_DEPEND),    n->name); -  emit1(F_CONSTANT,tmp1); +  emit1(F_CONSTANT, DO_NOT_WARN((INT32)tmp1));       /* copy now or later ? */    if(!(flags & DO_NOT_COPY) && !(n->tree_info & OPT_EXTERNAL_DEPEND))    emit0(F_COPY_VALUE);    return 1;       }       case F_LOCAL:    if(n->u.integer.a >=