[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] [PATCH] pp should interpret #num as #line num
From: |
Sergey Korshunoff |
Subject: |
Re: [Tinycc-devel] [PATCH] pp should interpret #num as #line num |
Date: |
Sun, 4 Jan 2015 10:55:02 +0300 |
But after testing: if "else" removed then tcc can not handle a #line
directive.And with first patch tcc process rigth all forms:
# line XXX "file_name"
# XXX "file_name"
2015-01-04 10:43 GMT+03:00, Sergey Korshunoff <address@hidden>:
> Yes, It looks like else is not needed when processing
> # line XXX "filename"
> We must only get a next token and parse it as number.
>
> 2015-01-04 0:36 GMT+03:00, Thomas Preudomme <address@hidden>:
>> Le samedi 27 décembre 2014, 15:29:53 Sergey Korshunoff a écrit :
>>> A preprocessor should Interpret an input line
>>> # NUM "FILENAME"
>>> like
>>> #line NUM "FILENAME"
>>>
>>> A cpp from gcc do this. A test case:
>>> tcc -E tccasm.c -o tccasm.i
>>> tcc -E tccasm.i -o tccasm.ii
>>>
>>> After a patch the line numbers in tccasm.ii are the same as in tccasm.i
>>
>> @@ -1624,7 +1627,11 @@
>> }
>> break;
>> case TOK_LINE:
>> - next();
>> + case TOK_PPNUM:
>> + if (tok == TOK_LINE)
>> + next();
>> + else
>> + parse_number((char *)tokc.cstr->data);
>> if (tok != TOK_CINT)
>> tcc_error("#line");
>> file->line_num = tokc.i - 1; /* the line number will be
>> incremented
>>
>> after */
>>
>> There is already all the logic to parse the line number after the next
>> (obviously since otherwise TOK_LINE parsing would not be working). So I
>> don't
>> think there is any else statement needed. If you think parse_number is
>> more
>>
>> appropriate than the current adhoc parsing please justify *and* use it
>> for
>> both cases.
>>
>> Best regards,
>>
>> Thomas
>>
>
- Re: [Tinycc-devel] [PATCH] pp should interpret #num as #line num, Thomas Preud'homme, 2015/01/03
- Re: [Tinycc-devel] [PATCH] pp should interpret #num as #line num, Sergey Korshunoff, 2015/01/04
- Re: [Tinycc-devel] [PATCH] pp should interpret #num as #line num,
Sergey Korshunoff <=
- Re: [Tinycc-devel] [PATCH] pp should interpret #num as #line num, Sergey Korshunoff, 2015/01/06
- Re: [Tinycc-devel] [PATCH] pp should interpret #num as #line num, Thomas Preud'homme, 2015/01/06
- Re: [Tinycc-devel] [PATCH] pp should interpret #num as #line num, Sergey Korshunoff, 2015/01/06
- Re: [Tinycc-devel] [PATCH] pp should interpret #num as #line num, Sergey Korshunoff, 2015/01/06
- Re: [Tinycc-devel] [PATCH] pp should interpret #num as #line num, Thomas Preud'homme, 2015/01/11