Branch: Tag:

2018-06-30

2018-06-30 09:59:28 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Cpp: Ensure that the compile_error counter gets incremented.

As there is code that relies on the counter being incremented
on error (eg the macro expansion), move the increment to code
that can not be overridden via overloading.

731:    int i;    int fun = -1;    if (severity >= REPORT_ERROR) { -  this->compile_errors++; +     compat_fun_name = "compile_error";    }    if (this->compile_errors > 10) return;
796:    struct string_builder s;    struct pike_string *msg;    +  if (severity >= REPORT_ERROR) { +  /* NB: This increment is here (and not in report()), to allow +  * for overloading of report() with code that doesn't always +  * call the above implementation. This increment is not +  * optional as there is code that depends on it to detect +  * whether other code has failed (eg macro expansion). +  */ +  this->compile_errors++; +  } +     push_int(severity);    ref_push_string(this->current_file);    push_int(this->current_line);