aboutsummaryrefslogtreecommitdiff
path: root/tccpp.c
diff options
context:
space:
mode:
authorgrischka <grischka>2016-10-09 20:33:14 +0200
committergrischka <grischka>2016-10-09 20:33:14 +0200
commit71b16f4e18b2794b76cc80cb7d0303243656b050 (patch)
treeafee8de56f0213d74b8404f66c4b9fd62a238730 /tccpp.c
parent78c08898aeb88ae3f8e6a775532a49712188875a (diff)
downloadtinycc-71b16f4e18b2794b76cc80cb7d0303243656b050.tar.gz
tinycc-71b16f4e18b2794b76cc80cb7d0303243656b050.tar.bz2
tccpp : "tcc -E -P" : suppress empty lines
Also: - regenerate all tests/pp/*.expect with gcc - test "insert one space" feature - test "0x1E-1" in asm mode case - PARSE_FLAG_SPACES: ignore \f\v\r better - tcc.h: move some things
Diffstat (limited to 'tccpp.c')
-rw-r--r--tccpp.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/tccpp.c b/tccpp.c
index d08277a..098012d 100644
--- a/tccpp.c
+++ b/tccpp.c
@@ -127,12 +127,19 @@ ST_FUNC void expect(const char *msg)
#define TAL_DEBUG_PARAMS
#else
#define TAL_DEBUG 1
+//#define TAL_INFO 1 /* collect and dump allocators stats */
#define tal_free(al, p) tal_free_impl(al, p, __FILE__, __LINE__)
#define tal_realloc(al, p, size) tal_realloc_impl(&al, p, size, __FILE__, __LINE__)
#define TAL_DEBUG_PARAMS , const char *file, int line
#define TAL_DEBUG_FILE_LEN 15
#endif
-//#define TAL_INFO 1 /* collect and dump allocators stats */
+
+#define TOKSYM_TAL_SIZE (768 * 1024) /* allocator for tiny TokenSym in table_ident */
+#define TOKSTR_TAL_SIZE (768 * 1024) /* allocator for tiny TokenString instances */
+#define CSTR_TAL_SIZE (256 * 1024) /* allocator for tiny CString instances */
+#define TOKSYM_TAL_LIMIT 256 /* prefer unique limits to distinguish allocators debug msgs */
+#define TOKSTR_TAL_LIMIT 128 /* 32 * sizeof(int) */
+#define CSTR_TAL_LIMIT 1024
typedef struct TinyAlloc {
size_t limit;
@@ -3039,7 +3046,8 @@ static int next_argstream(Sym **nested_list, int can_read_stream, TokenString *w
break;
ch = ' ';
}
- tok_str_add(ws_str, ch);
+ if (!(ch == '\f' || ch == '\v' || ch == '\r'))
+ tok_str_add(ws_str, ch);
cinp();
}
}
@@ -3569,15 +3577,13 @@ static void tok_print(const char *msg, const int *str)
static void pp_line(TCCState *s1, BufferedFile *f, int level)
{
int d = f->line_num - f->line_ref;
+
if (s1->dflag & 4)
return;
+
if (s1->Pflag == LINE_MACRO_OUTPUT_FORMAT_NONE) {
- if (level == 0 && f->line_ref && d) {
- d = 1;
- goto simple;
- }
+ ;
} else if (level == 0 && f->line_ref && d < 8) {
-simple:
while (d > 0)
fputs("\n", s1->ppfp), --d;
} else if (s1->Pflag == LINE_MACRO_OUTPUT_FORMAT_STD) {