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.712 2008/05/30 16:57:03 mast Exp $ + || $Id: program.c,v 1.713 2008/05/31 12:15:18 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:8604:    if (((handler = c->handler) && handler->prog &&    ((fun = find_identifier("handle_inherit", handler->prog)) != -1)) ||    ((handler = c->compat_handler) && handler->prog &&    ((fun = find_identifier("handle_inherit", handler->prog)) != -1))) {    apply_low(handler, fun, args);    } else {    apply_external(1, CE_HANDLE_INHERIT_FUN_NUM, args);    }   }    - /*! @decl int(0..1) pop_type_attribute(string attribute, @ -  *! type a, type b) + /*! @decl int(0..1) pop_type_attribute(string attribute, type a, type b)    *!    *! Type attribute handler.    *!    *! Called during type checking when @expr{a <= b@} and    *! @[a] had the type attribute @[attribute] before the    *! comparison.    *!    *! The default implementation implements the "deprecated"    *! attribute.    *!
pike.git/src/program.c:8637:    struct svalue *a, *b;    struct compilation *c = THIS_COMPILATION;    struct pike_string *deprecated_string;       get_all_args("pop_type_attribute", args, "%W%*%*", &attr, &a, &b);       if (Pike_compiler->compiler_pass == 2) {    MAKE_CONST_STRING(deprecated_string, "deprecated");    if ((attr == deprecated_string) &&    !(c->lex.pragmas & ID_NO_DEPRECATION_WARNINGS)) { -  push_int(REPORT_WARNING); -  ref_push_string(c->lex.current_file); -  push_int(c->lex.current_line); -  push_constant_text("type_check"); -  push_constant_text("Using deprecated %O value."); +     push_svalue(a); -  apply_current(PC_REPORT_FUN_NUM, 6); -  args++; +  yytype_report(REPORT_WARNING, NULL, 0, NULL, +  NULL, 0, NULL, +  1, "Using deprecated %O value.");    }    }    pop_n_elems(args);    push_int(1);   }    - /*! @decl int(0..1) push_type_attribute(string attribute, @ -  *! type a, type b) + /*! @decl int(0..1) push_type_attribute(string attribute, type a, type b)    *!    *! Type attribute handler.    *!    *! Called during type checking when @expr{a <= b@} and    *! @[b] had the type attribute @[attribute] before the    *! comparison.    *!    *! The default implementation implements the "deprecated"    *! attribute.    *!
pike.git/src/program.c:8686:    struct pike_string *deprecated_string;       get_all_args("push_type_attribute", args, "%W%*%*", &attr, &a, &b);       if (Pike_compiler->compiler_pass == 2) {    MAKE_CONST_STRING(deprecated_string, "deprecated");    if ((attr == deprecated_string) &&    !(c->lex.pragmas & ID_NO_DEPRECATION_WARNINGS) &&    !((a->type == PIKE_T_TYPE) && (a->u.type == zero_type_string))) {    /* Don't warn about setting deprecated values to zero. */ -  push_int(REPORT_WARNING); -  ref_push_string(c->lex.current_file); -  push_int(c->lex.current_line); -  push_constant_text("type_check"); -  push_constant_text("Using deprecated %O value."); +     push_svalue(b); -  apply_current(PC_REPORT_FUN_NUM, 6); -  args++; +  yytype_report(REPORT_WARNING, NULL, 0, NULL, +  NULL, 0, NULL, +  1, "Using deprecated %O value.");    }    }    pop_n_elems(args);    push_int(1);   }      /*! @decl int(0..1) apply_type_attribute(string attribute, @    *! type a, type|void b)    *!    *! Type attribute handler.
pike.git/src/program.c:8747:       get_all_args("apply_type_attribute", args, "%W%*.%*", &attr, &a, &b);       if (Pike_compiler->compiler_pass == 2) {    MAKE_CONST_STRING(deprecated_string, "deprecated");    if ((attr == deprecated_string) &&    !(c->lex.pragmas & ID_NO_DEPRECATION_WARNINGS) &&    (!b ||    ((b->type == T_INT) && (b->subtype == NUMBER_UNDEFINED) &&    (!b->u.integer)))) { -  push_int(REPORT_WARNING); -  ref_push_string(c->lex.current_file); -  push_int(c->lex.current_line); -  push_constant_text("type_check"); -  push_constant_text("Calling a deprecated value."); -  apply_current(PC_REPORT_FUN_NUM, 5); -  args++; +  push_svalue(a); +  yytype_report(REPORT_WARNING, NULL, 0, NULL, +  NULL, 0, NULL, +  1, "Calling a deprecated %O value.");    }    }    pop_n_elems(args);    push_int(1);   }      /*! @decl type(mixed) apply_attribute_constant(string attr, @    *! mixed value, @    *! type arg_type, @    *! void cont_type)
pike.git/src/program.c:10071:   void low_pop_local_variables(int level)   {    struct compilation *c = THIS_COMPILATION;    while(Pike_compiler->compiler_frame->current_number_of_locals > level)    {    int e;    e=--(Pike_compiler->compiler_frame->current_number_of_locals);    if ((Pike_compiler->compiler_pass == 2) &&    !(Pike_compiler->compiler_frame->variable[e].flags &    LOCAL_VAR_IS_USED)) { -  push_int(REPORT_WARNING); -  ref_push_string(Pike_compiler->compiler_frame->variable[e].file); -  push_int(Pike_compiler->compiler_frame->variable[e].line); -  push_constant_text("parse"); -  push_constant_text("Unused local variable %s."); +     ref_push_string(Pike_compiler->compiler_frame->variable[e].name); -  safe_apply_current(PC_REPORT_FUN_NUM, 6); -  pop_stack(); +  low_yyreport(REPORT_WARNING, +  Pike_compiler->compiler_frame->variable[e].file, +  Pike_compiler->compiler_frame->variable[e].line, +  parser_system_string, +  1, "Unused local variable %s.");    }    free_string(Pike_compiler->compiler_frame->variable[e].name);    free_type(Pike_compiler->compiler_frame->variable[e].type);    if(Pike_compiler->compiler_frame->variable[e].def)    free_node(Pike_compiler->compiler_frame->variable[e].def);       free_string(Pike_compiler->compiler_frame->variable[e].file);    }   }   
pike.git/src/program.c:10103: Inside #if 1
   /* We need to save the variables Kuppo (but not their names) */    if(level < Pike_compiler->compiler_frame->min_number_of_locals)    {    /* FIXME: Consider using flags to indicate whether a local variable    * actually is used from a nested scope. */    for(;level<Pike_compiler->compiler_frame->min_number_of_locals;level++)    {    if ((Pike_compiler->compiler_pass == 2) &&    !(Pike_compiler->compiler_frame->variable[level].flags &    LOCAL_VAR_IS_USED)) { -  push_int(REPORT_WARNING); /* Warning */ -  ref_push_string(Pike_compiler->compiler_frame->variable[level].file); -  push_int(Pike_compiler->compiler_frame->variable[level].line); -  push_constant_text("parse"); -  push_constant_text("Unused local variable %s."); +     ref_push_string(Pike_compiler->compiler_frame->variable[level].name); -  safe_apply_current(PC_REPORT_FUN_NUM, 6); -  pop_stack(); +  low_yyreport(REPORT_WARNING, +  Pike_compiler->compiler_frame->variable[level].file, +  Pike_compiler->compiler_frame->variable[level].line, +  parser_system_string, +  1, "Unused local variable %s.");    /* Make sure we only warn once... */    Pike_compiler->compiler_frame->variable[level].flags |=    LOCAL_VAR_IS_USED;    }    free_string(Pike_compiler->compiler_frame->variable[level].name);    copy_shared_string(Pike_compiler->compiler_frame->variable[level].name,    empty_pike_string);    /* FIXME: Do we need to keep the filenames? */    }    }