diff options
| author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-02-27 01:26:04 +0000 |
|---|---|---|
| committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-02-27 01:26:04 +0000 |
| commit | e22e0554af696a1da9c92391160632b5b72f5e64 (patch) | |
| tree | 12f8dccac388230c8b710268dd6bd2607710880a | |
| parent | 6ad7df02c439e43e42dfb2b344213f971f343a28 (diff) | |
| download | ppe42-gcc-e22e0554af696a1da9c92391160632b5b72f5e64.tar.gz ppe42-gcc-e22e0554af696a1da9c92391160632b5b72f5e64.zip | |
* doc/cpp.texi: Clarify documentation of relationship between
#line and #include.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@50079 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/doc/cpp.texi | 38 |
2 files changed, 42 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3bef7cd98ca..05415534fc7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2002-02-26 Zack Weinberg <zack@codesourcery.com> + + * doc/cpp.texi: Clarify documentation of relationship between + #line and #include. + 2002-02-26 Kazu Hirata <kazu@hxi.com> * config/h8300/h8300-protos.h: Update the prototype for diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi index 1e8fd030c8f..d672e575cf5 100644 --- a/gcc/doc/cpp.texi +++ b/gcc/doc/cpp.texi @@ -3044,7 +3044,35 @@ The result should match one of the above two forms. @samp{#line} directives alter the results of the @code{__FILE__} and @code{__LINE__} predefined macros from that point on. @xref{Standard Predefined Macros}. They do not have any effect on @samp{#include}'s -idea of the directory containing the current file. +idea of the directory containing the current file. This is a change +from GCC 2.95. Previously, a file reading + +@smallexample +#line 1 "../src/gram.y" +#include "gram.h" +@end smallexample + +would search for @file{gram.h} in @file{../src}, then the @option{-I} +chain; the directory containing the physical source file would not be +searched. In GCC 3.0 and later, the @samp{#include} is not affected by +the presence of a @samp{#line} referring to a different directory. + +We made this change because the old behavior caused problems when +generated source files were transported between machines. For instance, +it is common practice to ship generated parsers with a source release, +so that people building the distribution do not need to have yacc or +Bison installed. These files frequently have @samp{#line} directives +referring to the directory tree of the system where the distribution was +created. If GCC tries to search for headers in those directories, the +build is likely to fail. + +The new behavior can cause failures too, if the generated file is not +in the same directory as its source and it attempts to include a header +which would be visible searching from the directory containing the +source file. However, this problem is easily solved with an additional +@option{-I} switch on the command line. The failures caused by the old +semantics could sometimes be corrected only by editing the generated +files, which is difficult and error-prone. @node Pragmas @chapter Pragmas @@ -3780,6 +3808,14 @@ were still available in traditional mode. It is now a separate program and does not implement any of the GNU extensions, except for a partial implementation of assertions. Even those may be removed in a future release. + +@item @samp{#line} and @samp{#include} + +The @samp{#line} directive used to change GCC's notion of the +``directory containing the current file,'' used by @samp{#include} with +a double-quoted header file name. In 3.0 and later, it does not. +@xref{Line Control}, for further explanation. + @end itemize @node Invocation |

