Bug 3739 - GCC preprocessor bug
Summary: GCC preprocessor bug
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc
Version: 6.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Cristian Gafton
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-06-25 23:21 UTC by brownb
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 1999-06-26 14:30:22 UTC


Attachments (Terms of Use)

Description brownb 1999-06-25 23:21:21 UTC
The following program will not compile when I use the "-O"
switch:

#include <stdio.h>
#include <string.h>

int main()
{
	char *foo;

	foo = strdup("lslsjflsdjf"
#ifdef foobar
			"lskjflsjfl"
#endif
			"hello world");
}

Here is the compiler output I get:

egret [266]  egcs foo.c -o foo -O
foo.c:12: warning: preprocessing directive not recognized
within macro arg
foo.c:12: warning: preprocessing directive not recognized
within macro arg
foo.c:12: warning: preprocessing directive not recognized
within macro arg
foo.c:12: warning: preprocessing directive not recognized
within macro arg
foo.c:12: warning: preprocessing directive not recognized
within macro arg
foo.c:12: warning: preprocessing directive not recognized
within macro arg
foo.c: In function `main':
foo.c:9: undefined or invalid # directive
foo.c:11: undefined or invalid # directive
foo.c:12: parse error before `#'
foo.c:12: parse error before `#'
foo.c:12: parse error before `#'
foo.c:12: parse error before `#'
foo.c:12: parse error before `#'
foo.c:12: parse error before `#'

Comment 1 Jeff Johnson 1999-06-26 14:29:59 UTC
This is a problem with glibc, not gcc so I'm changing the
component.

Most string functions are now implemented as preprocessor
macros. That means that the construct (from nmh, right :-)
is no longer valid. Change the scope of the ifdef to include
the strdup to fix.


------- Email Received From  "Robert E. Brown" <brownb@jany.gs.com> 06/26/99 20:00 -------


Note You need to log in before you can comment on or make changes to this bug.