mirror of
https://github.com/mirror/tinycc.git
synced 2024-12-26 03:50:07 +08:00
Fix wrong handling of strings which do not end properly at the end of line
This commit is contained in:
parent
a83b285685
commit
e588b65390
7
tccpp.c
7
tccpp.c
@ -944,19 +944,16 @@ static uint8_t *parse_pp_string(uint8_t *p,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (c == '\n') {
|
} else if (c == '\n') {
|
||||||
file->line_num++;
|
tcc_error("missing terminating %c character",sep);
|
||||||
goto add_char;
|
|
||||||
} else if (c == '\r') {
|
} else if (c == '\r') {
|
||||||
PEEKC_EOB(c, p);
|
PEEKC_EOB(c, p);
|
||||||
if (c != '\n') {
|
if (c != '\n') {
|
||||||
if (str)
|
if (str)
|
||||||
cstr_ccat(str, '\r');
|
cstr_ccat(str, '\r');
|
||||||
} else {
|
} else {
|
||||||
file->line_num++;
|
tcc_error("missing terminating %c character",sep);
|
||||||
goto add_char;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
add_char:
|
|
||||||
if (str)
|
if (str)
|
||||||
cstr_ccat(str, c);
|
cstr_ccat(str, c);
|
||||||
p++;
|
p++;
|
||||||
|
@ -4253,11 +4253,6 @@ void func_arg_test(void)
|
|||||||
/* gcc 2.95.3 does not handle correctly CR in strings or after strays */
|
/* gcc 2.95.3 does not handle correctly CR in strings or after strays */
|
||||||
#define CORRECT_CR_HANDLING
|
#define CORRECT_CR_HANDLING
|
||||||
|
|
||||||
/* deprecated and no longer supported in gcc 3.3 */
|
|
||||||
#ifdef __TINYC__
|
|
||||||
# define ACCEPT_CR_IN_STRINGS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* keep this as the last test because GCC messes up line-numbers
|
/* keep this as the last test because GCC messes up line-numbers
|
||||||
with the ^L^K^M characters below */
|
with the ^L^K^M characters below */
|
||||||
void whitespace_test(void)
|
void whitespace_test(void)
|
||||||
@ -4279,20 +4274,6 @@ ntf("aaa=%d\n", 3);
|
|||||||
\
|
\
|
||||||
ntf("min=%d\n", 4);
|
ntf("min=%d\n", 4);
|
||||||
|
|
||||||
#ifdef ACCEPT_CR_IN_STRINGS
|
|
||||||
printf("len1=%d\n", strlen("
|
|
||||||
"));
|
|
||||||
#ifdef CORRECT_CR_HANDLING
|
|
||||||
str = "
|
|
||||||
";
|
|
||||||
printf("len1=%d str[0]=%d\n", strlen(str), str[0]);
|
|
||||||
#endif
|
|
||||||
printf("len1=%d\n", strlen("
a
|
|
||||||
"));
|
|
||||||
#else
|
|
||||||
printf("len1=1\nlen1=1 str[0]=10\nlen1=3\n");
|
|
||||||
#endif /* ACCEPT_CR_IN_STRINGS */
|
|
||||||
|
|
||||||
#ifdef __LINE__
|
#ifdef __LINE__
|
||||||
printf("__LINE__ defined\n");
|
printf("__LINE__ defined\n");
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user