diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2013-06-28 09:57:43 -0700 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2013-06-28 09:57:43 -0700 |
commit | 7fb75753fa7e7c54af3b5e0aea65d8051feac55d (patch) | |
tree | 568d89cbf5521cbb882c33a3a42fb332ff2e49b8 /libcpp | |
parent | db2127098137dea6c246041e0d763a57a174fa3c (diff) | |
parent | 2814409c2f46b5f71706f08358f395dddc9d8a81 (diff) | |
download | gcc-7fb75753fa7e7c54af3b5e0aea65d8051feac55d.tar.gz |
Merge remote-tracking branch 'origin/gomp-4_0-branch' into cilk-in-gomp
Conflicts:
gcc/Makefile.in
gcc/c-family/c-common.h
gcc/c/c-parser.c
gcc/cp/Make-lang.in
gcc/cp/cp-tree.h
gcc/gimple.h
gcc/omp-low.c
gcc/testsuite/g++.dg/cilk-plus/cilk-plus.exp
gcc/testsuite/gcc.dg/cilk-plus/cilk-plus.exp
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 5 | ||||
-rw-r--r-- | libcpp/files.c | 26 |
2 files changed, 22 insertions, 9 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index da68e5210a9..ca29119c953 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -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> N3472 binary constants diff --git a/libcpp/files.c b/libcpp/files.c index 5c5a0b9b514..ea91b02047d 100644 --- a/libcpp/files.c +++ b/libcpp/files.c @@ -983,6 +983,7 @@ _cpp_stack_include (cpp_reader *pfile, const char *fname, int angle_brackets, { struct cpp_dir *dir; _cpp_file *file; + bool stacked; dir = search_path_head (pfile, fname, angle_brackets, type); if (!dir) @@ -993,19 +994,26 @@ _cpp_stack_include (cpp_reader *pfile, const char *fname, int angle_brackets, if (type == IT_DEFAULT && file == NULL) return false; - /* Compensate for the increment in linemap_add that occurs in - _cpp_stack_file. In the case of a normal #include, we're - currently at the start of the line *following* the #include. A - separate source_location for this location makes no sense (until - we do the LC_LEAVE), and complicates LAST_SOURCE_LINE_LOCATION. - This does not apply if we found a PCH file (in which case - linemap_add is not called) or we were included from the - command-line. */ + /* Compensate for the increment in linemap_add that occurs if + _cpp_stack_file actually stacks the file. In the case of a + normal #include, we're currently at the start of the line + *following* the #include. A separate source_location for this + location makes no sense (until we do the LC_LEAVE), and + complicates LAST_SOURCE_LINE_LOCATION. This does not apply if we + found a PCH file (in which case linemap_add is not called) or we + were included from the command-line. */ if (file->pchname == NULL && file->err_no == 0 && type != IT_CMDLINE && type != IT_DEFAULT) 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. */ |