[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] [PATCH] pp should interpret #num as #line num

From: Thomas Preud'homme
Subject: Re: [Tinycc-devel] [PATCH] pp should interpret #num as #line num
Date: Sat, 03 Jan 2015 21:36:24 +0000
User-agent: KMail/4.14.1 (Linux/2.6.38-ac2-ac100; KDE/4.14.2; armv7l; ; )

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 @@
     case TOK_LINE:
-        next();
+    case TOK_PPNUM:
+       if (tok == TOK_LINE)
+           next();
+       else
+           parse_number((char *)tokc.cstr->data);
         if (tok != TOK_CINT)
         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,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]