Tao Wu wrote:
Hi, I think typeof should ignore some attributes like "external", otherwise the following code will not compile.... #define max(x,y) ({ \ const typeof(x) _x = (x); \ const typeof(y) _y = (y); \ (void) (&_x == &_y); \ _x > _y ? _x : _y; }) ? _x : _y; }) ... extern int a; int b=max(a,4); the problem is that compiler can not parse "const extern int _x = (a);" the following patch should fix it, but I don't know whether I have ignored some attributes which should not be ignored by "typeof". But I think "exter"diff -urN tcc-0.9.23/tcc.c tcc-0.9.23-lepton/tcc.c --- tcc-0.9.23/tcc.c 2005-06-27 23:05:42.000000000 +0800 +++ tcc-0.9.23-lepton/tcc.c 2005-06-27 01:34:12.000000000 +0800 @@ -6690,7 +6690,7 @@ case TOK_ENUM: struct_decl(&type1, VT_ENUM); basic_type2: - u = type1.t; + u = type1.t & (~(VT_EXTERN|VT_STATIC|VT_INLINE|VT_CONST|VT_VOLATILE)); type->ref = type1.ref; goto basic_type1; case TOK_STRUCT:
Ignoring const and volatile does not seem correct to me... Fabrice. _______________________________________________ Tinycc-devel mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/tinycc-devel
