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 `#'
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.com> 06/26/99 20:00 -------