diff options
author | Jason Merrill <jason@redhat.com> | 2024-11-26 16:19:05 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2024-11-26 23:53:37 -0500 |
commit | 134dc932e1ceb13519846795c895319f77df3235 (patch) | |
tree | 5ed0da4750a8ed3c5ffeabe0a3df79937ad20d4d /gcc | |
parent | 5e718a7a789b39ef877e0d66c7a6a85b54eb112f (diff) | |
download | gcc-134dc932e1ceb13519846795c895319f77df3235.zip gcc-134dc932e1ceb13519846795c895319f77df3235.tar.gz gcc-134dc932e1ceb13519846795c895319f77df3235.tar.bz2 |
libcpp: modules and -include again
I enabled include translation to header units in r15-1104-ga29f481bbcaf2b,
but it seems that patch wasn't sufficient, as any diagnostics in the main
source file would show up as coming from the header instead.
Fixed by setting buffer->file for leaving the file transition that my
previous patch made us enter. And don't push a buffer of newlines, in this
case that messes up line numbers instead of aligning them.
libcpp/ChangeLog:
* files.cc (_cpp_stack_file): Handle -include of header unit more
specially.
gcc/testsuite/ChangeLog:
* g++.dg/modules/dashinclude-1_b.C: Add an #error.
* g++.dg/modules/dashinclude-1_a.H: Remove dg-module-do run.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/g++.dg/modules/dashinclude-1_a.H | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/modules/dashinclude-1_b.C | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/gcc/testsuite/g++.dg/modules/dashinclude-1_a.H b/gcc/testsuite/g++.dg/modules/dashinclude-1_a.H index c1b40a5..82ee340 100644 --- a/gcc/testsuite/g++.dg/modules/dashinclude-1_a.H +++ b/gcc/testsuite/g++.dg/modules/dashinclude-1_a.H @@ -1,4 +1,3 @@ -// { dg-module-do run } // { dg-additional-options "-fmodule-header" } // { dg-module-cmi {} } diff --git a/gcc/testsuite/g++.dg/modules/dashinclude-1_b.C b/gcc/testsuite/g++.dg/modules/dashinclude-1_b.C index 6e6a334..f257a1d 100644 --- a/gcc/testsuite/g++.dg/modules/dashinclude-1_b.C +++ b/gcc/testsuite/g++.dg/modules/dashinclude-1_b.C @@ -6,4 +6,6 @@ int main () return f(); } +#error foo // { dg-error "foo" } + // { dg-final { scan-lang-dump {Translating include to import} module } } |