Branch: Tag:

2004-10-11

2004-10-11 16:41:49 by Martin Stjernholm <mast@lysator.liu.se>

Show the error when the compile time replace() optimizer fails.

Rev: src/builtin_functions.c:1.469
Rev: src/language.yacc:1.317
Rev: src/las.c:1.326
Rev: src/program.c:1.493
Rev: src/program.h:1.182

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.492 2004/09/27 15:12:03 grubba Exp $ + || $Id: program.c,v 1.493 2004/10/11 16:41:48 mast Exp $   */      #include "global.h" - RCSID("$Id: program.c,v 1.492 2004/09/27 15:12:03 grubba Exp $"); + RCSID("$Id: program.c,v 1.493 2004/10/11 16:41:48 mast Exp $");   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"
946:       push_svalue(&thrown);    low_safe_apply_handler("compile_exception", error_handler, compat_handler, 1); -  if (SAFE_IS_ZERO(sp-1)) yy_describe_exception(&thrown); +  if (SAFE_IS_ZERO(sp-1)) yy_describe_exception(&thrown, 0);    pop_stack();    free_svalue(&thrown);    } else {
1102:       push_svalue(&thrown);    low_safe_apply_handler("compile_exception", error_handler, compat_handler, 1); -  if (SAFE_IS_ZERO(sp-1)) yy_describe_exception(&thrown); +  if (SAFE_IS_ZERO(sp-1)) yy_describe_exception(&thrown, 0);    pop_stack();    free_svalue(&thrown);    }
3427:    my_yyerror("Error finding program");    push_svalue(&thrown);    low_safe_apply_handler("compile_exception", error_handler, compat_handler, 1); -  if (SAFE_IS_ZERO(sp-1)) yy_describe_exception(&thrown); +  if (SAFE_IS_ZERO(sp-1)) yy_describe_exception(&thrown, 0);    pop_stack();    free_svalue(&thrown);    }
4575:       push_svalue(&thrown);    low_safe_apply_handler("compile_exception", error_handler, compat_handler, 1); -  if (SAFE_IS_ZERO(sp-1)) yy_describe_exception(&thrown); +  if (SAFE_IS_ZERO(sp-1)) yy_describe_exception(&thrown, 0);    pop_stack();    free_svalue(&thrown);   
5222:    }   }    - void yy_describe_exception(struct svalue *thrown) + void yy_describe_exception(struct svalue *thrown, int warning)   {    /* FIXME: Doesn't handle wide string error messages. */    struct pike_string *s = 0;
5245:    push_constant_text("\n");    push_constant_text(" ");    f_replace(3); -  my_yyerror(sp[-1].u.string->str); +  if (warning) +  yywarning (sp[-1].u.string->str); +  else +  yyerror(sp[-1].u.string->str);    pop_stack();    }   }
5860:    throw_value.type = T_INT;    push_svalue(&thrown);    low_safe_apply_handler("compile_exception", error_handler, compat_handler, 1); -  if (SAFE_IS_ZERO(sp-1)) yy_describe_exception(&thrown); +  if (SAFE_IS_ZERO(sp-1)) yy_describe_exception(&thrown, 0);    pop_stack();    free_svalue(&thrown);    zap_placeholder(c);