This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug preprocessor/15572] New: multi-line -D value no longer works in cpp


The following script snippet runs on Solaris, but not on our
newer Linux boxes.

$ cat bug

    # Calculate the Verilog sensitivity list for
    # the (optional) non-registered FIFO read logic.

    SLIST=""
    if [[ $REG -eq 0 ]] ; then
	SLIST=`awk "BEGIN {for (ii=0; ii<10; ii=ii+1) \
			    print \"or fdhold[\", ii, \"] \"}" </dev/null`
    fi

    echo TEST | cpp -C -P -undef -DTEST="$SLIST"

Solaris:

    $ cpp --version
    2.95.3
    $ ksh bug
    or fdhold[ 0 ] 
    or fdhold[ 1 ] 
    or fdhold[ 2 ] 
    or fdhold[ 3 ] 
    or fdhold[ 4 ] 
    or fdhold[ 5 ] 
    or fdhold[ 6 ] 
    or fdhold[ 7 ] 
    or fdhold[ 8 ] 
    or fdhold[ 9 ] 
    $ 


Linux:

    $ cpp --version
    cpp --version
    cpp (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
    Copyright (C) 2002 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    $ ksh bug
    ksh bug
    or fdhold[ 0 ]
    $ 

It appears that newlines in a -D behave differently now, but the man page
for cpp (still) states:

       -D name=definition
           Predefine name as a macro, with definition definition.  There are
           no restrictions on the contents of definition...

which would lead us to believe that the older cpp is 'correct'.

******************************************************************************

Also, adding -traditional to the cpp invocation crashes the newer version.

$ cat bug

    # Calculate the Verilog sensitivity list for
    # the (optional) non-registered FIFO read logic.

    SLIST=""
    if [[ $REG -eq 0 ]] ; then
	SLIST=`awk "BEGIN {for (ii=0; ii<10; ii=ii+1) \
			    print \"or fdhold[\", ii, \"] \"}" </dev/null`
    fi

    echo TEST | cpp -traditional -C -P -undef -DTEST="$SLIST"

Solaris:

    $ cpp --version
    2.95.3
    $ ksh bug
    or fdhold[ 0 ] 
    or fdhold[ 1 ] 
    or fdhold[ 2 ] 
    or fdhold[ 3 ] 
    or fdhold[ 4 ] 
    or fdhold[ 5 ] 
    or fdhold[ 6 ] 
    or fdhold[ 7 ] 
    or fdhold[ 8 ] 
    or fdhold[ 9 ]
    $ 

Linux:

    $ cpp --version
    cpp --version
    cpp (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
    Copyright (C) 2002 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    $ ksh bug
    :1: internal error in rescan, at tradcpp.c:1575
    Please submit a full bug report.
    See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.
    $ 

-- Jim Cathey (jimc@f5.com)

-- 
           Summary: multi-line -D value no longer works in cpp
           Product: gcc
           Version: 3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jimc at f5 dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15572


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]