]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: -include and header unit translation
authorJason Merrill <jason@redhat.com>
Wed, 5 Jun 2024 02:27:56 +0000 (22:27 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 7 Jun 2024 18:29:46 +0000 (14:29 -0400)
commita29f481bbcaf2b196f358122a5f1e45c6869df82
treeacffb45579d8e7f8d55a90e6b5f32a56e68fd812
parent5c761395402a730535983a5e49ef1775561ebc61
c++: -include and header unit translation

 Within a source file, #include is translated to import if a suitable header
 unit is available, but this wasn't working with -include.  This turned out
 to be because we suppressed the translation before the beginning of the
 main file.  After removing that, I had to tweak libcpp file handling to
 accommodate the way it moves from an -include to the main file.

gcc/ChangeLog:

* doc/invoke.texi (C++ Modules): Mention -include.

gcc/cp/ChangeLog:

* module.cc (maybe_translate_include): Allow before the main file.

libcpp/ChangeLog:

* files.cc (_cpp_stack_file): LC_ENTER for -include header unit.

gcc/testsuite/ChangeLog:

* g++.dg/modules/dashinclude-1_b.C: New test.
* g++.dg/modules/dashinclude-1_a.H: New test.
gcc/cp/module.cc
gcc/doc/invoke.texi
gcc/testsuite/g++.dg/modules/dashinclude-1_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/dashinclude-1_b.C [new file with mode: 0644]
libcpp/files.cc