pike.git / src / program.c

version» Context lines:

pike.git/src/program.c:2310: Inside #if defined(PIKE_DEBUG) and #if defined(DEBUG_MALLOC)
   return make_shared_string(tmp);    }    }    }   #endif       return get_program_line(p, line);   }   #endif    - int override_identifier (struct reference *new_ref, struct pike_string *name) + int override_identifier (struct reference *new_ref, struct pike_string *name, +  int required_flags)   {    struct compilation *c = THIS_COMPILATION;    int id = -1, cur_id = 0, is_used = 0;       int new_is_variable =    IDENTIFIER_IS_VARIABLE(ID_FROM_PTR(Pike_compiler->new_program,    new_ref)->identifier_flags);       /* This loop could possibly be optimized by looping over    * each inherit and looking up 'name' in each inherit
pike.git/src/program.c:2341:    struct identifier *i;       /* No need to do anything for ourselves. */    if (ref == new_ref) continue;       /* Do not zapp hidden identifiers */    if(ref->id_flags & ID_HIDDEN) continue;       if(ref->id_flags & ID_VARIANT) continue;    +  if ((ref->id_flags & required_flags) != required_flags) continue; +     /* Do not zapp functions with the wrong name... */    if((i = ID_FROM_PTR(Pike_compiler->new_program, ref))->name != name)    continue;       /* Do not zapp inherited inline ('local') identifiers,    * or inherited externals with new externals,    * since this makes it hard to identify in encode_value().    */    if((ref->id_flags & (ID_INLINE|ID_INHERITED)) == (ID_INLINE|ID_INHERITED)    || (ref->id_flags & new_ref->id_flags & ID_EXTERN)) {
pike.git/src/program.c:2471:    p->identifiers[i].run_time_type = T_FUNCTION;    }    }       /* Fixup identifier overrides. */    for (i = 0; i < p->num_identifier_references; i++) {    struct reference *ref = p->identifier_references + i;    if (ref->id_flags & ID_HIDDEN) continue;    if (ref->id_flags & ID_VARIANT) continue;    if (ref->inherit_offset != 0) continue; -  override_identifier (ref, ID_FROM_PTR (p, ref)->name); +  override_identifier (ref, ID_FROM_PTR (p, ref)->name, 0);    }       /* Ok, sort for binsearch */    for(e=i=0;i<(int)p->num_identifier_references;i++)    {    struct reference *funp;    struct identifier *fun;    funp=p->identifier_references+i;    if(funp->id_flags & ID_HIDDEN) continue;    if(funp->id_flags & ID_VARIANT) continue;
pike.git/src/program.c:3978:       fixate_program();    if(Pike_compiler->num_parse_error)    {    free_program(prog);    prog=0;    }else{    optimize_program(Pike_compiler->new_program);    Pike_compiler->new_program->flags |= PROGRAM_FINISHED;    } +  } else { +  /* All references in prog are now known. +  * Fixup identifier overrides or external symbols, +  * so that inherit is safe. +  */ +  for (e = 0; e < prog->num_identifier_references; e++) { +  struct reference *ref = prog->identifier_references + e; +  if (ref->id_flags & ID_HIDDEN) continue; +  if (ref->inherit_offset != 0) continue; +  override_identifier (ref, ID_FROM_PTR (prog, ref)->name, +  ID_EXTERN);    } -  +  }      #ifdef PIKE_DEBUG    if (prog) {    check_program(prog);    if(l_flag)    dump_program_desc(prog);    }   #endif    }   
pike.git/src/program.c:5666:    }       /* not inherited */    if(Pike_compiler->new_program->identifier_references[n].inherit_offset == 0)    {    my_yyerror("Identifier %S defined twice.", name);    return n;    }       /* override */ -  if ((overridden = override_identifier (&ref, name)) >= 0) { +  if ((overridden = override_identifier (&ref, name, 0)) >= 0) {   #ifdef PIKE_DEBUG    struct reference *oref =    Pike_compiler->new_program->identifier_references+overridden;    if((oref->inherit_offset != ref.inherit_offset) ||    (oref->identifier_offset != ref.identifier_offset) ||    ((oref->id_flags | ID_USED) != (ref.id_flags | ID_USED))) {    Pike_fatal("New constant overriding algorithm failed!\n");    }   #endif    return overridden;
pike.git/src/program.c:6216:       if (flags & ID_PRIVATE) flags |= ID_LOCAL|ID_PROTECTED;       ref.inherit_offset = 0;    ref.id_flags = flags;    if (flags & ID_VARIANT) {    ref.id_flags |= ID_USED;    prog->identifier_references[i] = ref;    overridden = i;    } else { -  overridden = override_identifier(&ref, name); +  overridden = override_identifier(&ref, name, 0);    }    if (overridden >= 0) {   #ifdef PIKE_DEBUG    struct reference *oref = prog->identifier_references+overridden;    if((oref->inherit_offset != ref.inherit_offset) ||    (oref->identifier_offset != ref.identifier_offset) ||    ((oref->id_flags | ID_USED) != (ref.id_flags | ID_USED))) {    fprintf(stderr,    "ref: %d:%d 0x%04x\n"    "got: %d:%d 0x%04x (%d)\n",