[qfcc] Make internal_error const correct

This way it can be used with const expr objects.
This commit is contained in:
Bill Currie 2021-06-27 14:49:16 +09:00
parent d865095d0b
commit 365e298908
3 changed files with 7 additions and 6 deletions

View file

@ -49,7 +49,7 @@ struct expr_s *_error (struct expr_s *e, const char *file, int line,
__attribute__ ((format (PRINTF, 4, 5)));
#define error(e, fmt...) _error(e, __FILE__, __LINE__, fmt)
void _internal_error (struct expr_s *e, const char *file, int line,
void _internal_error (const struct expr_s *e, const char *file, int line,
const char *fmt, ...)
__attribute__ ((format (PRINTF, 4, 5), noreturn));
#define internal_error(e, fmt...) _internal_error(e, __FILE__, __LINE__, fmt)

View file

@ -47,7 +47,7 @@ diagnostic_hook warning_hook;
diagnostic_hook notice_hook;
static void
report_function (expr_t *e)
report_function (const expr_t *e)
{
static function_t *last_func = (function_t *)-1L;
static string_t last_file;
@ -78,7 +78,7 @@ report_function (expr_t *e)
}
static __attribute__((format(PRINTF, 4, 0))) void
format_message (dstring_t *message, const char *msg_type, expr_t *e,
format_message (dstring_t *message, const char *msg_type, const expr_t *e,
const char *fmt, va_list args)
{
string_t file = pr.source_file;
@ -147,7 +147,7 @@ _debug (expr_t *e, const char *file, int line, const char *fmt, ...)
}
static __attribute__((noreturn, format(PRINTF, 4, 0))) void
__internal_error (expr_t *e, const char *file, int line,
__internal_error (const expr_t *e, const char *file, int line,
const char *fmt, va_list args)
{
dstring_t *message = dstring_new ();
@ -234,7 +234,8 @@ _warning (expr_t *e, const char *file, int line, const char *fmt, ...)
}
void
_internal_error (expr_t *e, const char *file, int line, const char *fmt, ...)
_internal_error (const expr_t *e, const char *file, int line,
const char *fmt, ...)
{
va_list args;

View file

@ -37,7 +37,7 @@ __attribute__((const)) codespace_t *codespace_new (void) {return 0;}
void codespace_addcode (codespace_t *codespace, struct dstatement_s *code, int size) {}
__attribute__((const)) int function_parms (function_t *f, byte *parm_size) {return 0;}
void def_to_ddef (def_t *def, ddef_t *ddef, int aux) {}
__attribute__((noreturn)) void _internal_error (expr_t *e, const char *file, int line, const char *fmt, ...) {abort();}
__attribute__((noreturn)) void _internal_error (const expr_t *e, const char *file, int line, const char *fmt, ...) {abort();}
__attribute__((const)) expr_t *_warning (expr_t *e, const char *file, int line, const char *fmt, ...) {return 0;}
__attribute__((const)) expr_t *_error (expr_t *e, const char *file, int line, const char *fmt, ...) {return 0;}
__attribute__((const)) symbol_t *make_structure (const char *name, int su, struct_def_t *defs, type_t *type) {return 0;}