mirror of
https://github.com/frida/tinycc
synced 2024-11-28 02:29:38 +03:00
error message fixes - CH_EOB is now '\'
This commit is contained in:
parent
2f219d8702
commit
e926c359bb
16
tcc.c
16
tcc.c
@ -220,7 +220,7 @@ typedef struct BufferedFile {
|
||||
unsigned char buffer[IO_BUF_SIZE + 1]; /* extra size for CH_EOB char */
|
||||
} BufferedFile;
|
||||
|
||||
#define CH_EOB 0 /* end of buffer or '\0' char in file */
|
||||
#define CH_EOB '\\' /* end of buffer or '\0' char in file */
|
||||
#define CH_EOF (-1) /* end of file */
|
||||
|
||||
/* parsing state (used to save parser state to reparse part of the
|
||||
@ -1528,6 +1528,11 @@ int tcc_getc_slow(BufferedFile *bf)
|
||||
void handle_eob(void)
|
||||
{
|
||||
TCCState *s1 = tcc_state;
|
||||
|
||||
/* no need to do anything if not at EOB */
|
||||
if (file->buf_ptr <= file->buf_end)
|
||||
return;
|
||||
|
||||
for(;;) {
|
||||
ch1 = tcc_getc_slow(file);
|
||||
if (ch1 != CH_EOF)
|
||||
@ -2501,7 +2506,7 @@ void parse_number(const char *p)
|
||||
}
|
||||
}
|
||||
if (ch != 'p' && ch != 'P')
|
||||
error("exponent expected");
|
||||
expect("exponent");
|
||||
ch = *p++;
|
||||
s = 1;
|
||||
exp_val = 0;
|
||||
@ -2512,7 +2517,7 @@ void parse_number(const char *p)
|
||||
ch = *p++;
|
||||
}
|
||||
if (ch < '0' || ch > '9')
|
||||
error("exponent digits expected");
|
||||
expect("exponent digits");
|
||||
while (ch >= '0' && ch <= '9') {
|
||||
exp_val = exp_val * 10 + ch - '0';
|
||||
ch = *p++;
|
||||
@ -2565,7 +2570,7 @@ void parse_number(const char *p)
|
||||
ch = *p++;
|
||||
}
|
||||
if (ch < '0' || ch > '9')
|
||||
error("exponent digits expected");
|
||||
expect("exponent digits");
|
||||
while (ch >= '0' && ch <= '9') {
|
||||
if (q >= token_buf + STRING_MAX_SIZE)
|
||||
goto num_too_long;
|
||||
@ -2812,7 +2817,7 @@ static inline void next_nomacro1(void)
|
||||
b = (char)b;
|
||||
tokc.i = b;
|
||||
if (ch != '\'')
|
||||
expect("\'");
|
||||
error("unterminated character constant");
|
||||
minp();
|
||||
break;
|
||||
case '\"':
|
||||
@ -7604,6 +7609,7 @@ void tcc_define_symbol(TCCState *s1, const char *sym, const char *value)
|
||||
bf->fd = -1;
|
||||
bf->buf_ptr = bf->buffer;
|
||||
bf->buf_end = bf->buffer + strlen(bf->buffer);
|
||||
*bf->buf_end = CH_EOB;
|
||||
bf->filename[0] = '\0';
|
||||
bf->line_num = 1;
|
||||
file = bf;
|
||||
|
Loading…
Reference in New Issue
Block a user