tech-toolchain archive

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

Re: traditional cpp



On 01/02/2011 05:01 AM, David Holland wrote:
On Mon, Dec 20, 2010 at 12:03:58PM +0100, Anders Magnusson wrote:
  >  Hm, just curious, do you see any problem with the cpp included in
  >  pcc? Which is already in-tree?

Joerg led me to believe that it wasn't going to work, although this
may not be his fault.

I do see at least one problem with it though:

    valkyrie% ( echo '#define K(x) "x"' ; echo 'K(123)' ) | ./cpp -t

    # 1 "<stdin>"

    "x"
Hm, that was lost in the changes somewhere.  Thanks for pointing it out,
fixed now.  The attached diff can be applied.

-- Ragge



    valkyrie% ( echo '#define K(x) "x"' ; echo 'K(123)' ) | gcc -traditional -E 
-
    # 1 "<stdin>"
    # 1 "<built-in>"
    # 1 "<command line>"
    # 1 "<stdin>"

    "123"
    valkyrie%


Index: pcc/cc/cpp/token.c
===================================================================
RCS file: /cvsroot/pcc/cc/cpp/token.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- pcc/cc/cpp/token.c  27 Dec 2010 18:13:10 -0000      1.41
+++ pcc/cc/cpp/token.c  2 Jan 2011 09:27:28 -0000       1.42
@@ -1,4 +1,4 @@
-/*     $Id: token.c,v 1.41 2010/12/27 18:13:10 ragge Exp $     */
+/*     $Id: token.c,v 1.42 2011/01/02 09:27:28 ragge Exp $     */
 
 /*
  * Copyright (c) 2004,2009 Anders Magnusson. All rights reserved.
@@ -471,6 +471,8 @@
                goto any;
 
        case '\"':
+               if (tflag)
+                       goto any;
        strng:
                for (;;) {
                        if ((ch = inch()) == '\\') {
@@ -486,10 +488,10 @@
                return(STRING);
 
        case 'L':
-               if ((ch = inch()) == '\"') {
+               if ((ch = inch()) == '\"' && !tflag) {
                        yytext[yyp++] = (usch)ch;
                        goto strng;
-               } else if (ch == '\'') {
+               } else if (ch == '\'' && !tflag) {
                        yytext[yyp++] = (usch)ch;
                        goto chlit;
                }


Home | Main Index | Thread Index | Old Index