Unified · Split
| @@ -645,7 +645,7 @@ static char tok_two_chars[] = "<=\236>=\235!=\225&&\240||\241++\244--\242==\224< · 644 unmodified lines | ||
| 645 | 645 | |
| 646 | 646 | #define TOK_ASM_int TOK_INT |
| 647 | 647 | |
| 648 | −enum { | |
| 648 | +enum tcc_token { | |
| 649 | 649 | TOK_LAST = TOK_IDENT - 1, |
| 650 | 650 | #define DEF(id, str) id, |
| 651 | 651 | #include "tcctok.h" |
| @@ -3808,26 +3808,27 @@ static int macro_subst_tok(TokenString *tok_str, · 3156 unmodified lines | ||
| 3808 | 3808 | Sym **nested_list, Sym *s, int can_read_stream) |
| 3809 | 3809 | { |
| 3810 | 3810 | Sym *args, *sa, *sa1; |
| 3811 | − int mstr_allocated, parlevel, *mstr, t; | |
| 3811 | + int mstr_allocated, parlevel, *mstr, t, t1; | |
| 3812 | 3812 | TokenString str; |
| 3813 | 3813 | char *cstrval; |
| 3814 | 3814 | CValue cval; |
| 3815 | 3815 | CString cstr; |
| 3816 | + char buf[32]; | |
| 3816 | 3817 | |
| 3817 | 3818 | /* if symbol is a macro, prepare substitution */ |
| 3818 | 3819 | |
| 3819 | 3820 | /* special macros */ |
| 3820 | 3821 | if (tok == TOK___LINE__) { |
| 3821 | − cval.i = file->line_num; | |
| 3822 | − tok_str_add2(tok_str, TOK_CINT, &cval); | |
| 3822 | + snprintf(buf, sizeof(buf), "%d", file->line_num); | |
| 3823 | + cstrval = buf; | |
| 3824 | + t1 = TOK_PPNUM; | |
| 3825 | + goto add_cstr1; | |
| 3823 | 3826 | } else if (tok == TOK___FILE__) { |
| 3824 | 3827 | cstrval = file->filename; |
| 3825 | 3828 | goto add_cstr; |
| 3826 | − tok_str_add2(tok_str, TOK_STR, &cval); | |
| 3827 | 3829 | } else if (tok == TOK___DATE__ || tok == TOK___TIME__) { |
| 3828 | 3830 | time_t ti; |
| 3829 | 3831 | struct tm *tm; |
| 3830 | − char buf[64]; | |
| 3831 | 3832 | |
| 3832 | 3833 | time(&ti); |
| 3833 | 3834 | tm = localtime(&ti); |
| @@ -3840,11 +3841,13 @@ static int macro_subst_tok(TokenString *tok_str, · 6 unmodified lines | ||
| 3840 | 3841 | } |
| 3841 | 3842 | cstrval = buf; |
| 3842 | 3843 | add_cstr: |
| 3844 | + t1 = TOK_STR; | |
| 3845 | + add_cstr1: | |
| 3843 | 3846 | cstr_new(&cstr); |
| 3844 | 3847 | cstr_cat(&cstr, cstrval); |
| 3845 | 3848 | cstr_ccat(&cstr, '\0'); |
| 3846 | 3849 | cval.cstr = &cstr; |
| 3847 | − tok_str_add2(tok_str, TOK_STR, &cval); | |
| 3850 | + tok_str_add2(tok_str, t1, &cval); | |
| 3848 | 3851 | cstr_free(&cstr); |
| 3849 | 3852 | } else { |
| 3850 | 3853 | mstr = (int *)s->c; |