mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-19 15:30:50 +00:00
[qfcc] Unalias types before checking for equality
Fixes a bogus redefinition when going from struct declaration to typedef.
This commit is contained in:
parent
f1d097c0c4
commit
bdc9e9c39f
3 changed files with 11 additions and 1 deletions
|
@ -181,6 +181,7 @@ int is_func (const type_t *type) __attribute__((pure));
|
||||||
int is_string (const type_t *type) __attribute__((pure));
|
int is_string (const type_t *type) __attribute__((pure));
|
||||||
int type_compatible (const type_t *dst, const type_t *src) __attribute__((pure));
|
int type_compatible (const type_t *dst, const type_t *src) __attribute__((pure));
|
||||||
int type_assignable (const type_t *dst, const type_t *src);
|
int type_assignable (const type_t *dst, const type_t *src);
|
||||||
|
int type_same (const type_t *dst, const type_t *src) __attribute__((pure));
|
||||||
int type_size (const type_t *type) __attribute__((pure));
|
int type_size (const type_t *type) __attribute__((pure));
|
||||||
|
|
||||||
void init_types (void);
|
void init_types (void);
|
||||||
|
|
|
@ -529,7 +529,7 @@ initialize_def (symbol_t *sym, expr_t *init, defspace_t *space,
|
||||||
reloc_t *relocs = 0;
|
reloc_t *relocs = 0;
|
||||||
|
|
||||||
if (check && check->table == current_symtab) {
|
if (check && check->table == current_symtab) {
|
||||||
if (check->sy_type != sy_var || check->type != sym->type) {
|
if (check->sy_type != sy_var || !type_same (check->type, sym->type)) {
|
||||||
error (0, "%s redefined", sym->name);
|
error (0, "%s redefined", sym->name);
|
||||||
} else {
|
} else {
|
||||||
// is var and same type
|
// is var and same type
|
||||||
|
|
|
@ -1066,6 +1066,15 @@ type_assignable (const type_t *dst, const type_t *src)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
type_same (const type_t *dst, const type_t *src)
|
||||||
|
{
|
||||||
|
dst = unalias_type (dst);
|
||||||
|
src = unalias_type (src);
|
||||||
|
|
||||||
|
return dst == src;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
type_size (const type_t *type)
|
type_size (const type_t *type)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue