Branch: Tag:

2004-11-05

2004-11-05 16:21:23 by Henrik Grubbström (Grubba) <grubba@grubba.org>

my_yyerror() now uses string_builder_vsprintf().
Corrected the arguments for a lot of my_yyerror() invocations.

Rev: src/language.yacc:1.350
Rev: src/las.c:1.352
Rev: src/pike_types.c:1.239
Rev: src/program.c:1.575
Rev: src/treeopt.in:1.75

2:   || 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.574 2004/10/30 15:57:19 nilsson Exp $ + || $Id: program.c,v 1.575 2004/11/05 16:21:23 grubba Exp $   */      #include "global.h"
1518:    else    if(Pike_compiler->compiler_pass==2) {    if (throw_value.type == T_STRING) { -  my_yyerror("%O", throw_value); +  my_yyerror("%S", throw_value.u.string);    free_svalue(&throw_value);    throw_value.type = T_INT;    }
1926:    }    if ((fun->func.offset == -1) && (funp->id_flags & ID_INLINE) &&    IDENTIFIER_IS_PIKE_FUNCTION(fun->identifier_flags)) { -  if (fun->name->len < 900) { +     my_yyerror("Missing definition for local function %S.",    fun->name); -  } else { -  yyerror("Missing definition for local function."); +     } -  } +     add_to_identifier_index(i);    }    fsort_program_identifier_index(p->identifier_index,
1964:       if((e != i) && (e != -1))    { -  if(name->len < 1024) +     my_yyerror("Illegal to redefine final identifier %S", name); -  else -  my_yyerror("Illegal to redefine final identifier (name too large to print)."); +     }    }    }
4245:    if(!IDENTIFIER_IS_VARIABLE(ID_FROM_INT(Pike_compiler->new_program, n)->    identifier_flags))    { -  my_yyerror("Illegal to redefine inherited variable " -  "with different type."); +  my_yyerror("Illegal to redefine inherited variable %S " +  "with different type.", name);    return n;    }   
4254:    PIKE_T_MIXED) &&    (ID_FROM_INT(Pike_compiler->new_program, n)->run_time_type !=    compile_type_to_runtime_type(type))) { -  my_yyerror("Illegal to redefine inherited variable " -  "with different type."); +  my_yyerror("Illegal to redefine inherited variable %S " +  "with different type.", name);    return n;    }   
5929:      void va_yyerror(const char *fmt, va_list args)   { -  char buf[8192]; -  Pike_vsnprintf (buf, sizeof (buf), fmt, args); -  yyerror(buf); +  struct string_builder s; +  struct pike_string *tmp; +  init_string_builder(&s, 0); +  string_builder_vsprintf(&s, fmt, args); +  tmp = finish_string_builder(&s); +  low_yyerror(tmp); +  free_string(tmp);   }      void my_yyerror(const char *fmt,...)
5981:    if (SAFE_IS_ZERO(sp-1)) {    struct pike_string *s = format_exception_for_error_msg (&thrown);    if (s) { -  my_yyerror("%S", s); +  low_yyerror(s);    free_string (s);    }    }