public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/15572] New: multi-line -D value no longer works in cpp
@ 2004-05-22 18:50 jimc at f5 dot com
  2004-05-22 19:28 ` [Bug preprocessor/15572] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: jimc at f5 dot com @ 2004-05-22 18:50 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-07-04 12:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-22 18:50 [Bug preprocessor/15572] New: multi-line -D value no longer works in cpp jimc at f5 dot com
2004-05-22 19:28 ` [Bug preprocessor/15572] " pinskia at gcc dot gnu dot org
2004-05-26 20:04 ` [Bug preprocessor/15572] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-06-06  3:59 ` giovannibajo at libero dot it
2004-06-19 17:48 ` mmitchel at gcc dot gnu dot org
2004-06-26  8:43 ` neil at gcc dot gnu dot org
2004-06-28 20:28 ` cvs-commit at gcc dot gnu dot org
2004-06-28 20:41 ` [Bug preprocessor/15572] [3.3/3.5 " pinskia at gcc dot gnu dot org
2004-07-04 12:58 ` cvs-commit at gcc dot gnu dot org
2004-07-04 12:59 ` neil at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).