[qfcc] Clean up some overzealous const correctness

I'm not sure why I made those functions take const type_t *, but they
didn't need it. There's still a relevant fixime in find_handle, but I
haven't decided how to fix that one just yet.
This commit is contained in:
Bill Currie 2024-11-20 17:00:54 +09:00
parent 28a85b1624
commit 5e605aee36
3 changed files with 9 additions and 10 deletions

View file

@ -48,9 +48,9 @@ struct symbol_s *find_handle (struct symbol_s *tag, const type_t *type);
struct symtab_s *start_struct (int *su, struct symbol_s *tag,
struct symtab_s *parent);
struct symbol_s *find_struct (int su, struct symbol_s *tag,
const type_t *type);
type_t *type);
struct symbol_s *build_struct (int su, struct symbol_s *tag,
struct symtab_s *symtab, const type_t *type,
struct symtab_s *symtab, type_t *type,
int base);
struct symbol_s *find_enum (struct symbol_s *tag);
struct symtab_s *start_enum (struct symbol_s *enm);
@ -61,7 +61,7 @@ bool enum_as_bool (const type_t *enm, struct expr_s **zero,
struct expr_s **one);
struct symbol_s *make_structure (const char *name, int su, struct_def_t *defs,
const type_t *type);
type_t *type);
struct defspace_s;
struct def_s * emit_structure (const char *name, int su, struct_def_t *defs,
const type_t *type, void *data,

View file

@ -65,7 +65,7 @@
#include "tools/qfcc/include/value.h"
static symbol_t *
find_tag (ty_meta_e meta, symbol_t *tag, const type_t *type)
find_tag (ty_meta_e meta, symbol_t *tag, type_t *type)
{
const char *tag_name;
symbol_t *sym;
@ -87,7 +87,7 @@ find_tag (ty_meta_e meta, symbol_t *tag, const type_t *type)
return sym;
}
sym = new_symbol (tag_name);
type_t *t = (type_t *) type;//FIXME
type_t *t = type;
if (!t)
t = new_type ();
if (!t->name)
@ -146,7 +146,7 @@ find_handle (symbol_t *tag, const type_t *type)
}
symbol_t *
find_struct (int su, symbol_t *tag, const type_t *type)
find_struct (int su, symbol_t *tag, type_t *type)
{
ty_meta_e meta = ty_struct;
@ -157,7 +157,7 @@ find_struct (int su, symbol_t *tag, const type_t *type)
}
symbol_t *
build_struct (int su, symbol_t *tag, symtab_t *symtab, const type_t *type,
build_struct (int su, symbol_t *tag, symtab_t *symtab, type_t *type,
int base)
{
symbol_t *sym = find_struct (su, tag, type);
@ -344,8 +344,7 @@ enum_as_bool (const type_t *enm, expr_t **zero, expr_t **one)
}
symbol_t *
make_structure (const char *name, int su, struct_def_t *defs,
const type_t *type)
make_structure (const char *name, int su, struct_def_t *defs, type_t *type)
{
symtab_t *strct;
symbol_t *field;

View file

@ -55,7 +55,7 @@ void def_to_ddef (def_t *def, ddef_t *ddef, int aux) {}
__attribute__((noreturn)) void _internal_error (const expr_t *e, const char *file, int line, const char *func, const char *fmt, ...) {abort();}
void _warning (const expr_t *e, const char *file, int line, const char *func, const char *fmt, ...) {}
__attribute__((const)) const expr_t *_error (const expr_t *e, const char *file, int line, const char *func, const char *fmt, ...) {return 0;}
__attribute__((const)) symbol_t *make_structure (const char *name, int su, struct_def_t *defs, const type_t *type) {return 0;}
__attribute__((const)) symbol_t *make_structure (const char *name, int su, struct_def_t *defs, type_t *type) {return 0;}
__attribute__((const)) symbol_t *symtab_addsymbol (symtab_t *symtab, symbol_t *symbol) {return 0;}
__attribute__((const)) symbol_t *new_symbol_type (const char *name, const type_t *type) {return 0;}
__attribute__((const)) def_t *qfo_encode_type (const type_t *type, defspace_t *space) {return 0;}