mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
[qfcc] Catch declarations of arrays of class
They're still static instances.
This commit is contained in:
parent
101574e697
commit
0de9b02726
4 changed files with 17 additions and 3 deletions
|
@ -140,7 +140,7 @@ new_def (const char *name, type_t *type, defspace_t *space,
|
||||||
if (!space && storage != sc_extern)
|
if (!space && storage != sc_extern)
|
||||||
internal_error (0, "non-external def with no storage space");
|
internal_error (0, "non-external def with no storage space");
|
||||||
|
|
||||||
if (is_class (type)) {
|
if (is_class (type) || (is_array (type) && is_class(type->t.array.type))) {
|
||||||
error (0, "statically allocated instance of class %s",
|
error (0, "statically allocated instance of class %s",
|
||||||
type->t.class->name);
|
type->t.class->name);
|
||||||
return def;
|
return def;
|
||||||
|
@ -157,7 +157,7 @@ new_def (const char *name, type_t *type, defspace_t *space,
|
||||||
}
|
}
|
||||||
if (alignment < 1) {
|
if (alignment < 1) {
|
||||||
print_type (type);
|
print_type (type);
|
||||||
internal_error (0, "temp type has no alignment");
|
internal_error (0, "type has no alignment");
|
||||||
}
|
}
|
||||||
def->offset = defspace_alloc_aligned_loc (space, size, alignment);
|
def->offset = defspace_alloc_aligned_loc (space, size, alignment);
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,7 @@ test_progs_dat=\
|
||||||
fail_progs_dat=
|
fail_progs_dat=
|
||||||
|
|
||||||
test_build_errors=\
|
test_build_errors=\
|
||||||
|
classarray.r \
|
||||||
double-demote-float.r \
|
double-demote-float.r \
|
||||||
double-demote-float-ainit.r \
|
double-demote-float-ainit.r \
|
||||||
double-demote-float-ginit.r \
|
double-demote-float-ginit.r \
|
||||||
|
@ -208,6 +209,9 @@ double.run: Makefile build-run
|
||||||
include ./$(DEPDIR)/double.Qo # am--include-marker
|
include ./$(DEPDIR)/double.Qo # am--include-marker
|
||||||
r_depfiles_remade += ./$(DEPDIR)/double.Qo
|
r_depfiles_remade += ./$(DEPDIR)/double.Qo
|
||||||
|
|
||||||
|
classarray.run$(EXEEXT): classarray.r Makefile build-compile-fail-run
|
||||||
|
@$(srcdir)/build-compile-fail-run $@ $(QFCC) $(QCFLAGS) $<
|
||||||
|
|
||||||
double-demote-int.run$(EXEEXT): double-demote-int.r Makefile build-compile-fail-run
|
double-demote-int.run$(EXEEXT): double-demote-int.r Makefile build-compile-fail-run
|
||||||
@$(srcdir)/build-compile-fail-run $@ $(QFCC) $(QCFLAGS) $<
|
@$(srcdir)/build-compile-fail-run $@ $(QFCC) $(QCFLAGS) $<
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ shift
|
||||||
|
|
||||||
cat > $script <<EOF
|
cat > $script <<EOF
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# compile must fail
|
# compile must fail with a normal error
|
||||||
$@
|
$@
|
||||||
if test \$? != 1; then
|
if test \$? != 1; then
|
||||||
exit 1
|
exit 1
|
||||||
|
|
10
tools/qfcc/test/classarray.r
Normal file
10
tools/qfcc/test/classarray.r
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
@interface foo
|
||||||
|
{
|
||||||
|
id isa;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
void bar ()
|
||||||
|
{
|
||||||
|
foo foos[1];
|
||||||
|
}
|
Loading…
Reference in a new issue