Bug 3739

Summary: GCC preprocessor bug
Product: [Retired] Red Hat Linux Reporter: brownb
Component: glibcAssignee: Cristian Gafton <gafton>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-06-26 14:30:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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 -------