diff options
Diffstat (limited to 'libcpp/files.cc')
-rw-r--r-- | libcpp/files.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libcpp/files.cc b/libcpp/files.cc index c61df33..78f56e3 100644 --- a/libcpp/files.cc +++ b/libcpp/files.cc @@ -1008,7 +1008,10 @@ _cpp_stack_file (cpp_reader *pfile, _cpp_file *file, include_type type, if (decrement) pfile->line_table->highest_location--; - if (file->header_unit <= 0) + /* Normally a header unit becomes an __import directive in the current file, + but with -include we need something to LC_LEAVE to trigger the file_change + hook and continue to the next -include or the main source file. */ + if (file->header_unit <= 0 || type == IT_CMDLINE) /* Add line map and do callbacks. */ _cpp_do_file_change (pfile, LC_ENTER, file->path, /* With preamble injection, start on line zero, |