[gnu.gcc.bug] #line in gnu preprocessor

drh@notecnirp.Princeton.EDU (Dave Hanson) (12/16/88)

i note that #line n "filename"
directives change the current directory for #include "filename"
directives. here's an example.

[71] pwd
/va/drh
[72] cat baz.c

#line 3 "/u/appel/foo.c"

#include "def.h"

main() {int i = FOO;}
[73] cat def.h
#define FOO 1
[74] gcc -v -S baz.c
gcc version 1.31
 /usr/local/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dvax -Dunix baz.c /tmp/cc008335.cpp
GNU CPP version 1.31
/u/appel/foo.c:4: can't find include file `def.h'
[75] 

in cc's preprocessor, #line's don't affect #include's; e.g.,

[76] cc -S baz.c
[77] 

my reading of the ANSI standard suggests that
gcc-ccp's behavior is within the rules (ie, it's
`implementation defined'), but i found the behavior surprising.

is this behavior intentional, or a bug?
if it's the latter, perhaps it should be mentioned
in the documentation for #line and #include.