[Tinycc-devel] parsing 0x1e+1 as 0x1e +1
Hi! A problem solved (as someone suggested on the list) by teaching tcc to recognize right exponent chars in next_nomacro1().(no any space chars after macro expansion). This is like pcc do. A test prgram: extern int printf(const char *format, ...); #define ACPI_TYPE_INVALID 0x1E #define NUM_NS_TYPES ACPI_TYPE_INVALID+1 int array[NUM_NS_TYPES]; #define n 0xe int main() { printf("n+1 = %d\n", n+1); } prints 15 And preprocessor output is ... printf("n+1 = %d\n", 0x1e+1);. https://github.com/seyko2/tinycc/commit/132a3366132a34d55c67f0b73a14e634219bae93 ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
[Tinycc-devel] X(X(1)) (nested macro substitution)
About #define Y(x) Z(x) #define X Y X(X(1)) If comment out in tccpp.c the following lines /* if nested substitution, do nothing */ if ( (!s->next) && sym_find2(*nested_list, t)) { /* and mark it as TOK_NOSUBST, so it doesn't get subst'd again */ tok_str_add2(tok_str, TOK_NOSUBST, NULL); goto no_subst; } then we get the right result Z(Z(1) (but tcc loops in other macro substiturion cases). Currently we get Z(Y(1)), i.e. Y() is added to the nosubst_list affter first substitution. ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel