Branch: Tag:

2008-05-24

2008-05-24 15:14:13 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler messaging mega patch.
va_yyreport() is now the main C-level dispatcher for compiler messages.
It also handles the automatic conversion of type errors to warnings in compat mode.
Consolidated the location for the implementation of most of the yy*-messaging functions to program.c.
Added yytype_report().
Changed APIs for yyexplain_*().
Moved the definitions of REPORT_* from pike_compiler.h to program.h.
va_yyerror() and low_yyerror() are no more.
Most type-system messages should now be marked with the appropriate subsystem.
Reenabled the typechecking for sscanf and sprintf() now that errors are converted into warnings in compat mode.

Rev: src/language.yacc:1.425
Rev: src/las.c:1.413
Rev: src/las.h:1.79
Rev: src/modules/sprintf/sprintf.c:1.153
Rev: src/pike_compiler.h:1.14
Rev: src/pike_types.c:1.337
Rev: src/pike_types.h:1.118
Rev: src/program.c:1.702
Rev: src/program.h:1.248
Rev: src/sscanf.c:1.184

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: language.yacc,v 1.424 2008/05/18 13:42:09 grubba Exp $ + || $Id: language.yacc,v 1.425 2008/05/24 15:14:12 grubba Exp $   */      %pure_parser
155:      /* #define LAMBDA_DEBUG 1 */    + static void yyerror_reserved(const char *keyword);   static struct pike_string *get_new_name();   int add_local_name(struct pike_string *, struct pike_type *, node *);   int low_add_local_name(struct compiler_frame *,
4390:      %%    - void low_yyerror(struct pike_string *str) - { -  struct compilation *c = MAYBE_THIS_COMPILATION; -  extern int cumulative_parse_error; -  -  if (!c) return; -  -  STACK_LEVEL_START(0); -  - #ifdef PIKE_DEBUG -  if(Pike_interpreter.recoveries && Pike_sp-Pike_interpreter.evaluator_stack < Pike_interpreter.recoveries->stack_pointer) -  Pike_fatal("Stack error (underflow)\n"); - #endif -  -  CHECK_COMPILER(); -  -  if (Pike_compiler->num_parse_error > 20) return; -  Pike_compiler->num_parse_error++; -  cumulative_parse_error++; -  -  push_int(REPORT_ERROR); -  ref_push_string(c->lex.current_file); -  push_int(c->lex.current_line); -  push_constant_text("parse"); -  ref_push_string(str); -  safe_apply_current(PC_REPORT_FUN_NUM, 5); -  pop_stack(); -  STACK_LEVEL_DONE(0); - } -  - PMOD_EXPORT void yyerror(const char *str) - { -  push_text(str); -  low_yyerror(Pike_sp[-1].u.string); -  pop_stack(); - } -  +    static void yyerror_reserved(const char *keyword)   { -  char fmt[100]; -  SNPRINTF(fmt, sizeof(fmt), "%s is a reserved word.", keyword); -  yyerror(fmt); +  my_yyerror("%s is a reserved word.", keyword);   }      static struct pike_string *get_new_name()