diff options
| author | jiang <30155751@qq.com> | 2014-05-17 00:55:02 +0800 |
|---|---|---|
| committer | jiang <30155751@qq.com> | 2014-05-17 00:55:02 +0800 |
| commit | 196c9995151e046fcbc78d8a72f66a7176fd1456 (patch) | |
| tree | 991d1eac14975d280e8d8803a767e690163896bd /tccpp.c | |
| parent | 276553c6b2b4df0ac9593d15b8889d470edb27de (diff) | |
| download | tinycc-196c9995151e046fcbc78d8a72f66a7176fd1456.tar.gz tinycc-196c9995151e046fcbc78d8a72f66a7176fd1456.tar.bz2 | |
1 macro_push and macro_pop work I made a mistake, no matter the definition does not define can be macro_push.
And the modified tcctest.c test
2, pack: in the compiler under the mode of s1->ppfp, I have no clear ideas1->ppfp
Some advice thank you Roy to me.This patch, I hope I can pass the Roy test
Diffstat (limited to 'tccpp.c')
| -rw-r--r-- | tccpp.c | 27 |
1 files changed, 12 insertions, 15 deletions
@@ -1627,7 +1627,7 @@ skip: break; case TOK_PRAGMA: next(); - if (tok == TOK_pack && parse_flags & PARSE_FLAG_PACK) { + if (tok == TOK_pack && s1->output_type != TCC_OUTPUT_PREPROCESS) { /* This may be: #pragma pack(1) // set @@ -1736,32 +1736,29 @@ pack_error: def = &ts->sym_define; if(t == TOK_PUSH_MACRO){ void *tmp = def->data[def->off]; - if(tmp){ - def->off++; - if(def->off >= def->size){ - int size = def->size; - size *= 2; - if (size > MACRO_STACK_SIZE) - tcc_error("stack full"); - def->data = tcc_realloc(def->data, size*sizeof(Sym*)); - def->size = size; - } - def->data[def->off] = tmp; + def->off++; + if(def->off >= def->size){ + int size = def->size; + size *= 2; + if (size > MACRO_STACK_SIZE) + tcc_error("stack full"); + def->data = tcc_realloc(def->data, size*sizeof(Sym*)); + def->size = size; } + def->data[def->off] = tmp; }else{ if(def->off){ --def->off; - }else{ - tcc_warning("stack empty"); } } } - }else{ + }else if(s1->output_type == TCC_OUTPUT_PREPROCESS){ fputs("#pragma ", s1->ppfp); while (tok != TOK_LINEFEED){ fputs(get_tok_str(tok, &tokc), s1->ppfp); next(); } + fputs("\n", s1->ppfp); goto the_end; } break; |
