Mercurial > hg > CbC > old > device
changeset 483:77cab9687d3f
*** empty log message ***
author | kono |
---|---|
date | Sun, 11 Dec 2005 23:53:27 +0900 |
parents | 8370ba6e8557 |
children | f84d4525ffc8 |
files | Changes mc-codegen.c test/call.c |
diffstat | 3 files changed, 25 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/Changes Sun Dec 11 23:23:18 2005 +0900 +++ b/Changes Sun Dec 11 23:53:27 2005 +0900 @@ -7354,6 +7354,20 @@ attribute は変数にしかつかない。関数の型にconstを入れるとすれば、 ANSI-Cとの互換性を考えても type system に入れるべきでしょう。 - - - +int a0(); +int a5(); + +#define TYPE double + +TYPE addrs[]={ + (TYPE)&a0, + (TYPE)&a5, + (TYPE)a0, + (TYPE)a5, + 0, +}; + +なるほど、long long ではエラーを出して良いらしい。 + + +
--- a/mc-codegen.c Sun Dec 11 23:23:18 2005 +0900 +++ b/mc-codegen.c Sun Dec 11 23:53:27 2005 +0900 @@ -2885,23 +2885,25 @@ emit_space(cadr(e)); return; case CHAR: case UCHAR: + if (car(e)!=CONST) error(INERR); emit_char(cadr(e)); data_alignment++; return; case SHORT: case USHORT: + if (car(e)!=CONST) error(INERR); emit_short(cadr(e)); data_alignment++; return; - case ENUM: - emit_int(cadr(e)); - return; case LONGLONG: case ULONGLONG: + if (car(e)!=LCONST&&car(e)!=CONST) error(INERR); emit_longlong(e); return; case DOUBLE: + if (car(e)!=DCONST&&car(e)!=FCONST) error(INERR); emit_double(e); return; case FLOAT: + if (car(e)!=DCONST&&car(e)!=FCONST) error(INERR); emit_float(e); data_alignment++; return; @@ -2913,7 +2915,8 @@ return; } if (car(t)!=POINTER&&car(t)!=ARRAY) error(-1); - case INT: case UNSIGNED: + case INT: case UNSIGNED: /* including address case */ + case ENUM: switch(car(e)) { case CONST: emit_int(cadr(e));