mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-08 16:52:16 +00:00
[qfcc] Handle algebra types in block initializers
For now, it's an error (but better than a segfault). I'll sort it out when I'm happier with the type system.
This commit is contained in:
parent
2e2dedfd78
commit
a299cda463
1 changed files with 11 additions and 5 deletions
|
@ -46,6 +46,7 @@
|
||||||
#include "QF/sys.h"
|
#include "QF/sys.h"
|
||||||
#include "QF/va.h"
|
#include "QF/va.h"
|
||||||
|
|
||||||
|
#include "tools/qfcc/include/algebra.h"
|
||||||
#include "tools/qfcc/include/diagnostic.h"
|
#include "tools/qfcc/include/diagnostic.h"
|
||||||
#include "tools/qfcc/include/expr.h"
|
#include "tools/qfcc/include/expr.h"
|
||||||
#include "tools/qfcc/include/options.h"
|
#include "tools/qfcc/include/options.h"
|
||||||
|
@ -204,14 +205,19 @@ build_element_chain (element_chain_t *element_chain, const type_t *type,
|
||||||
type = unalias_type (type);
|
type = unalias_type (type);
|
||||||
|
|
||||||
initstate_t state = {};
|
initstate_t state = {};
|
||||||
if (is_struct (type) || is_union (type)
|
if (is_algebra (type)) {
|
||||||
|
error (eles, "block initializer of multi-vector type");
|
||||||
|
return;
|
||||||
|
} else if (is_struct (type) || is_union (type)
|
||||||
|| (is_nonscalar (type) && type->t.symtab)) {
|
|| (is_nonscalar (type) && type->t.symtab)) {
|
||||||
state.field = type->t.symtab->symbols;
|
state.field = type->t.symtab->symbols;
|
||||||
while (skip_field (state.field)) {
|
while (state.field && skip_field (state.field)) {
|
||||||
state.field = state.field->next;
|
state.field = state.field->next;
|
||||||
}
|
}
|
||||||
|
if (state.field) {
|
||||||
state.type = state.field->type;
|
state.type = state.field->type;
|
||||||
state.offset = state.field->s.offset;
|
state.offset = state.field->s.offset;
|
||||||
|
}
|
||||||
} else if (is_array (type)) {
|
} else if (is_array (type)) {
|
||||||
state.type = type->t.array.type;
|
state.type = type->t.array.type;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue