From 276553c6b2b4df0ac9593d15b8889d470edb27de Mon Sep 17 00:00:00 2001 From: jiang <30155751@qq.com> Date: Fri, 16 May 2014 15:44:51 +0800 Subject: [PATCH] add push_macro test again --- tccpp.c | 2 +- tests/tcctest.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/tccpp.c b/tccpp.c index 91c2aee..4aa8b95 100644 --- a/tccpp.c +++ b/tccpp.c @@ -1741,7 +1741,7 @@ pack_error: if(def->off >= def->size){ int size = def->size; size *= 2; - if (size >= MACRO_STACK_SIZE) + if (size > MACRO_STACK_SIZE) tcc_error("stack full"); def->data = tcc_realloc(def->data, size*sizeof(Sym*)); def->size = size; diff --git a/tests/tcctest.c b/tests/tcctest.c index 3fc7b82..e0b307b 100644 --- a/tests/tcctest.c +++ b/tests/tcctest.c @@ -382,16 +382,29 @@ comment /* macro_push and macro_pop test */ #define MACRO_TEST "macro_test1\n" #pragma push_macro("MACRO_TEST") + printf(MACRO_TEST); #undef MACRO_TEST #define MACRO_TEST "macro_test2\n" #pragma push_macro("MACRO_TEST") + printf(MACRO_TEST); #undef MACRO_TEST #define MACRO_TEST "macro_test3\n" + #pragma push_macro("MACRO_TEST") printf(MACRO_TEST); + #undef MACRO_TEST + + #define MACRO_TEST "macro_test4\n" + printf(MACRO_TEST); + #undef MACRO_TEST + #pragma pop_macro("MACRO_TEST") printf(MACRO_TEST); + + #pragma pop_macro("MACRO_TEST") + printf(MACRO_TEST); + #pragma pop_macro("MACRO_TEST") printf(MACRO_TEST); /* gcc does not support