Article View: gnu.gcc.bug
Article #2049#line in gnu preprocessor
From: Dave Hanson
Date: Fri, 16 Dec 1988 14:52
Date: Fri, 16 Dec 1988 14:52
34 lines
1362 bytes
1362 bytes
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.
Technical Details
Message-ID:
<13783@princeton.Princeton.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!bu-cs!bloom-beacon!tut.cis.ohio-state.edu!rutgers!njin!princeton!notecnirp!drhShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!bu-cs!bloom-beacon!tut.cis.ohio-state.edu!rutgers!njin!princeton!notecnirp!drh From: drh@notecnirp.Princeton.EDU (Dave Hanson) Newsgroups: gnu.gcc.bug Subject: #line in gnu preprocessor Message-ID: <13783@princeton.Princeton.EDU> Date: 16 Dec 88 14:52:25 GMT Sender: news@princeton.Princeton.EDU Reply-To: drh@princeton.Princeton.EDU (Dave Hanson) Distribution: gnu Organization: Dept. of Computer Science, Princeton University Lines: 34