aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tcc.h2
-rw-r--r--tccpp.c4
-rw-r--r--tests/tcctest.c7
3 files changed, 10 insertions, 3 deletions
diff --git a/tcc.h b/tcc.h
index c49eac4..24cb599 100644
--- a/tcc.h
+++ b/tcc.h
@@ -303,7 +303,7 @@
#define VSTACK_SIZE 256
#define STRING_MAX_SIZE 1024
#define PACK_STACK_SIZE 8
-#define MACRO_STACK_SIZE 4
+#define MACRO_STACK_SIZE 8
#define TOK_HASH_SIZE 8192 /* must be a power of two */
#define TOK_ALLOC_INCR 512 /* must be a power of two */
diff --git a/tccpp.c b/tccpp.c
index a384548..91c2aee 100644
--- a/tccpp.c
+++ b/tccpp.c
@@ -234,7 +234,7 @@ static TokenSym *tok_alloc_new(TokenSym **pts, const char *str, int len)
ts = tcc_malloc(sizeof(TokenSym) + len);
table_ident[i] = ts;
ts->tok = tok_ident++;
- ts->sym_define.data = tcc_malloc(sizeof(Sym**));
+ ts->sym_define.data = tcc_malloc(sizeof(Sym*));
ts->sym_define.off = 0;
ts->sym_define.data[0] = NULL;
ts->sym_define.size = 1;
@@ -1743,7 +1743,7 @@ pack_error:
size *= 2;
if (size >= MACRO_STACK_SIZE)
tcc_error("stack full");
- def->data = tcc_realloc(def->data, size*sizeof(Sym**));
+ def->data = tcc_realloc(def->data, size*sizeof(Sym*));
def->size = size;
}
def->data[def->off] = tmp;
diff --git a/tests/tcctest.c b/tests/tcctest.c
index 3a62354..3fc7b82 100644
--- a/tests/tcctest.c
+++ b/tests/tcctest.c
@@ -383,7 +383,14 @@ comment
#define MACRO_TEST "macro_test1\n"
#pragma push_macro("MACRO_TEST")
#undef MACRO_TEST
+
#define MACRO_TEST "macro_test2\n"
+ #pragma push_macro("MACRO_TEST")
+ #undef MACRO_TEST
+
+ #define MACRO_TEST "macro_test3\n"
+ printf(MACRO_TEST);
+ #pragma pop_macro("MACRO_TEST")
printf(MACRO_TEST);
#pragma pop_macro("MACRO_TEST")
printf(MACRO_TEST);