Branch: Tag:


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

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: program.h,v 1.247 2008/05/21 21:55:49 grubba Exp $ + || $Id: program.h,v 1.248 2008/05/24 15:14:12 grubba Exp $   */      #ifndef PROGRAM_H
53:      extern struct pike_string *this_program_string;    + /* Common compiler subsystems */ + extern struct pike_string *parser_system_string; + extern struct pike_string *type_check_system_string; +    #define LFUN___INIT 0   #define LFUN_CREATE 1   #define LFUN_DESTROY 2
682:   #define SEE_STATIC 1   #define SEE_PRIVATE 2    + /* Report levels */ + #define REPORT_NOTICE 0 /* FYI. */ + #define REPORT_WARNING 1 /* Compiler warning. */ + #define REPORT_ERROR 2 /* Compilation error. */ + #define REPORT_FATAL 3 /* Unrecoverable error. */    -  +    #define COMPILER_IN_CATCH 1      #define ADD_STORAGE(X) low_add_storage(sizeof(X), ALIGNOF(X),0)
879:    struct program *prog, INT32 *linep);   PMOD_EXPORT struct pike_string *low_get_function_line (struct object *o,    int fun, INT32 *linep); - PMOD_EXPORT void va_yyerror(const char *fmt, va_list args); + PMOD_EXPORT void va_yyreport(int severity_level, +  struct pike_string *file, INT32 line, +  struct pike_string *system, INT32 args, +  const char *fmt, va_list vargs); + PMOD_EXPORT void low_yyreport(int severity_level, +  struct pike_string *file, INT32 line, +  struct pike_string *system, +  INT32 args, const char *fmt, ...); + PMOD_EXPORT void yyreport(int severity_level, struct pike_string *system, +  INT32 args, const char *fmt, ...); + PMOD_EXPORT void yywarning(char *fmt, ...);   PMOD_EXPORT void my_yyerror(const char *fmt,...); -  + PMOD_EXPORT void yyerror(const char *s); + void yytype_report(int severity_level, +  struct pike_string *expect_file, INT32 expect_line, +  struct pike_type *expected_t, +  struct pike_string *got_file, INT32 got_line, +  struct pike_type *got_t, +  INT32 args, const char *fmt, ...); + void yytype_error(const char *msg, struct pike_type *expected_t, +  struct pike_type *got_t, unsigned int flags);   struct pike_string *format_exception_for_error_msg (struct svalue *thrown);   void handle_compile_exception (const char *yyerror_fmt, ...);   struct supporter_marker;
934:   PMOD_EXPORT struct program *program_from_svalue(const struct svalue *s);   struct find_child_cache_s;   int find_child(struct program *parent, struct program *child); - void va_yyreport(int severity_level, const char *system, -  const char *fmt, va_list args); - void yyreport(int severity_level, const char *system, const char *fmt, ...); - void yywarning(char *fmt, ...); +    struct implements_cache_s;   PMOD_EXPORT int implements(struct program *a, struct program *b);   PMOD_EXPORT int is_compatible(struct program *a, struct program *b); - void yyexplain_not_compatible(struct program *a, struct program *b, int flags); - void yyexplain_not_implements(struct program *a, struct program *b, int flags); + void yyexplain_not_compatible(int severity_level, +  struct program *a, struct program *b); + void yyexplain_not_implements(int severity_level, +  struct program *a, struct program *b);   PMOD_EXPORT void *parent_storage(int depth);   PMOD_EXPORT void change_compiler_compatibility(int major, int minor);   void make_program_executable(struct program *p);