This patch fixes the bug that when include a header file, if the header file is already included (with #define _HEADER_H_), libcpp should not decrease its highest_location, otherwise it'll cause incorrect source location when source location numbers are large enough to omit columns.
Passed regression test. OK for trunk? Thanks, Dehao libcpp/ChangeLog: 2013-05-31 Dehao Chen <de...@google.com> * files.c (_cpp_stack_include): Fix the highest_location when header file is guarded by #ifndef and is included twice. Index: libcpp/files.c =================================================================== --- libcpp/files.c (revision 199416) +++ libcpp/files.c (working copy) @@ -1002,7 +1002,8 @@ _cpp_stack_include (cpp_reader *pfile, const char 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) + && type != IT_CMDLINE && type != IT_DEFAULT + && !(file->cmacro && file->cmacro->type == NT_MACRO)) pfile->line_table->highest_location--; return _cpp_stack_file (pfile, file, type == IT_IMPORT);