mirror of git://gcc.gnu.org/git/gcc.git
files.c (_cpp_stack_include): Fix the highest_location when header file is guarded by #ifndef and is included...
2013-06-24 Dehao Chen <dehao@google.com> * files.c (_cpp_stack_include): Fix the highest_location when header file is guarded by #ifndef and is included twice. From-SVN: r200376
This commit is contained in:
parent
b4005c71a2
commit
39953c7972
|
|
@ -1,3 +1,8 @@
|
||||||
|
2013-06-24 Dehao Chen <dehao@google.com>
|
||||||
|
|
||||||
|
* files.c (_cpp_stack_include): Fix the highest_location when header
|
||||||
|
file is guarded by #ifndef and is included twice.
|
||||||
|
|
||||||
2013-04-28 Jakub Jelinek <jakub@redhat.com>
|
2013-04-28 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
N3472 binary constants
|
N3472 binary constants
|
||||||
|
|
|
||||||
|
|
@ -983,6 +983,7 @@ _cpp_stack_include (cpp_reader *pfile, const char *fname, int angle_brackets,
|
||||||
{
|
{
|
||||||
struct cpp_dir *dir;
|
struct cpp_dir *dir;
|
||||||
_cpp_file *file;
|
_cpp_file *file;
|
||||||
|
bool stacked;
|
||||||
|
|
||||||
dir = search_path_head (pfile, fname, angle_brackets, type);
|
dir = search_path_head (pfile, fname, angle_brackets, type);
|
||||||
if (!dir)
|
if (!dir)
|
||||||
|
|
@ -993,19 +994,26 @@ _cpp_stack_include (cpp_reader *pfile, const char *fname, int angle_brackets,
|
||||||
if (type == IT_DEFAULT && file == NULL)
|
if (type == IT_DEFAULT && file == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Compensate for the increment in linemap_add that occurs in
|
/* Compensate for the increment in linemap_add that occurs if
|
||||||
_cpp_stack_file. In the case of a normal #include, we're
|
_cpp_stack_file actually stacks the file. In the case of a
|
||||||
currently at the start of the line *following* the #include. A
|
normal #include, we're currently at the start of the line
|
||||||
separate source_location for this location makes no sense (until
|
*following* the #include. A separate source_location for this
|
||||||
we do the LC_LEAVE), and complicates LAST_SOURCE_LINE_LOCATION.
|
location makes no sense (until we do the LC_LEAVE), and
|
||||||
This does not apply if we found a PCH file (in which case
|
complicates LAST_SOURCE_LINE_LOCATION. This does not apply if we
|
||||||
linemap_add is not called) or we were included from the
|
found a PCH file (in which case linemap_add is not called) or we
|
||||||
command-line. */
|
were included from the command-line. */
|
||||||
if (file->pchname == NULL && file->err_no == 0
|
if (file->pchname == NULL && file->err_no == 0
|
||||||
&& type != IT_CMDLINE && type != IT_DEFAULT)
|
&& type != IT_CMDLINE && type != IT_DEFAULT)
|
||||||
pfile->line_table->highest_location--;
|
pfile->line_table->highest_location--;
|
||||||
|
|
||||||
return _cpp_stack_file (pfile, file, type == IT_IMPORT);
|
stacked = _cpp_stack_file (pfile, file, type == IT_IMPORT);
|
||||||
|
|
||||||
|
if (!stacked)
|
||||||
|
/* _cpp_stack_file didn't stack the file, so let's rollback the
|
||||||
|
compensation dance we performed above. */
|
||||||
|
pfile->line_table->highest_location++;
|
||||||
|
|
||||||
|
return stacked;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Could not open FILE. The complication is dependency output. */
|
/* Could not open FILE. The complication is dependency output. */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue