pike.git / src / program.c

version» Context lines:

pike.git/src/program.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: program.c,v 1.623 2007/10/12 12:59:12 grubba Exp $ + || $Id: program.c,v 1.624 2007/10/12 14:33:28 grubba Exp $   */      #include "global.h"   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"   #include "pike_types.h"   #include "stralloc.h"   #include "las.h"   #include "lex.h"
pike.git/src/program.c:1989: Inside #if defined(PIKE_DEBUG)
     #ifdef PIKE_DEBUG    if (!inh->inherit_level) {    Pike_fatal("Inherit without intermediate levels.\n");    }   #endif       sub_ref = PTR_FROM_INT(inh->prog, cur_id - inh->identifier_level);       /* Check if the symbol was used before it was inherited. */ -  if (sub_ref->id_flags & ID_USED) { +  if ((lex.pragmas & ID_STRICT_TYPES) && +  (sub_ref->id_flags & ID_USED)) {    struct identifier *sub_id = ID_FROM_PTR(inh->prog, sub_ref);    if (IDENTIFIER_IS_FUNCTION(sub_id->identifier_flags)) {    if (!pike_types_le(ID_FROM_PTR(Pike_compiler->new_program,    new_ref)->type, sub_id->type)) {    yywarning("Type mismatch when overloading function %S.", name); -  yytype_error(NULL, -  ID_FROM_PTR(inh->prog, sub_ref)->type, -  ID_FROM_PTR(Pike_compiler->new_program, new_ref)->type, +  yyexplain_nonmatching_types(sub_id->type, +  ID_FROM_PTR(Pike_compiler->new_program, +  new_ref)->type,    YYTE_IS_WARNING);    }    } else {    /* Variable or constant. */    if (!pike_types_le(sub_id->type,    ID_FROM_PTR(Pike_compiler->new_program,    new_ref)->type)) {    yywarning("Type mismatch when overloading %S.", name); -  yytype_error(NULL, -  ID_FROM_PTR(inh->prog, sub_ref)->type, -  ID_FROM_PTR(Pike_compiler->new_program, new_ref)->type, +  yyexplain_nonmatching_types(sub_id->type, +  ID_FROM_PTR(Pike_compiler->new_program, +  new_ref)->type,    YYTE_IS_WARNING);    }    }    }    }    is_used = ref->id_flags & ID_USED;       *ref=*new_ref;    ref->id_flags |= is_used;    id = cur_id;
pike.git/src/program.c:2102:    found_better=t;       /* FIXME: Is this stuff needed?    * It looks like it already is done by define_function().    *    * Yes -- It's needed in case of mixin.    */    if(funa_is_prototype && (funb->func.offset != -1) &&    !(funp->id_flags & ID_INLINE))    { -  if (funp->id_flags & ID_USED) { +  if ((lex.pragmas & ID_STRICT_TYPES) && +  (funp->id_flags & ID_USED)) {    /* Verify that the types are compatible. */    if (!pike_types_le(funb->type, fun->type)) {    yywarning("Type mismatch when overloading %S.", fun->name); -  yytype_error(NULL, fun->type, funb->type, YYTE_IS_WARNING); +  yyexplain_nonmatching_types(fun->type, funb->type, +  YYTE_IS_WARNING);    }    }    funp->inherit_offset = funpb->inherit_offset;    funp->identifier_offset = funpb->identifier_offset;    }    if(!funa_is_prototype && funb->func.offset == -1)    { -  if (funpb->id_flags & ID_USED) { +  if ((lex.pragmas & ID_STRICT_TYPES) && +  (funpb->id_flags & ID_USED)) {    /* Verify that the types are compatible. */    if (!pike_types_le(fun->type, funb->type)) {    yywarning("Type mismatch when overloading %S.", fun->name); -  yytype_error(NULL, funb->type, fun->type, YYTE_IS_WARNING); +  yyexplain_nonmatching_types(funb->type, fun->type, +  YYTE_IS_WARNING);    }    }    funpb->inherit_offset = funp->inherit_offset;    funpb->identifier_offset = funp->identifier_offset;    }    }    }    if(found_better!=-1)    continue;    }