https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109534

--- Comment #6 from Boris Kolpackov <boris at kolpackov dot net> ---
> The documentation says specifically-fdirectives-only is ignored if 
> -fpreprocessed is supplied.

Hm, that's not how it works, IME. Specifically, just "-fpreprocessed" means the
source code is fully preprocessed (and no further preprocessing is required)
while "-fpreprocessed -fdirectives-only" means the source code is preprocessed
to directives only (and further preprocessing is required). Here is a
demonstration:

$ cat <EOF >test.c
#define FOO 2
int f () {return FOO;}
EOF

$ gcc -E -fdirectives-only -o test.i test.c

$ tail -3 test.i
# 1 "test.c"
#define FOO 2
int f () {return FOO;}

$ gcc -fpreprocessed -fdirectives-only -c -o test.o test.i

$ gcc -fpreprocessed -c -o test.o test.i
test.c: In function ‘f’:
test.c:2:18: error: ‘FOO’ undeclared (first use in this function)
    2 | int f () {return FOO;}

Reply via email to