[gcc/devel/c++-modules] C++ headers need directives-only preprocessing
Nathan Sidwell
nathan@gcc.gnu.org
Tue Sep 1 19:45:02 GMT 2020
https://gcc.gnu.org/g:7d342ac6faca743ac0d1f448f25d8864b7848c9d
commit 7d342ac6faca743ac0d1f448f25d8864b7848c9d
Author: Nathan Sidwell <nathan@acm.org>
Date: Tue Sep 1 12:44:35 2020 -0700
C++ headers need directives-only preprocessing
gcc/cp/
* lang-specs.h: c++headers always do directives-only preprocessing
in modules mode.
Diff:
---
ChangeLog.modules | 4 ++++
gcc/cp/lang-specs.h | 12 +++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/ChangeLog.modules b/ChangeLog.modules
index d32f7730079..e796ef256fd 100644
--- a/ChangeLog.modules
+++ b/ChangeLog.modules
@@ -1,5 +1,9 @@
2020-08-31 Nathan Sidwell <nathan@acm.org>
+ gcc/cp/
+ * lang-specs.h: c++headers always do directives-only preprocessing
+ in modules mode.
+
Deal with running out of locations.
gcc/cp/
* module.cc (module_state::read_prepare_maps): New.
diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
index aabad9faf26..295185adf15 100644
--- a/gcc/cp/lang-specs.h
+++ b/gcc/cp/lang-specs.h
@@ -40,7 +40,8 @@ along with GCC; see the file COPYING3. If not see
{".tcc", "@c++-header", 0, 0, 0},
{".hh", "@c++-header", 0, 0, 0},
{"@c++-header",
- "%{E|M|MM:cc1plus -E %(cpp_options) %2 %(cpp_debug_options)}"
+ "%{E|M|MM:cc1plus -E %{fmodules-ts:-fdirectives-only}"
+ " %(cpp_options) %2 %(cpp_debug_options)}"
"%{!E:%{!M:%{!MM:"
" %{save-temps*|no-integrated-cpp:cc1plus -E"
" %{fmodules-ts:-fdirectives-only}"
@@ -49,6 +50,7 @@ along with GCC; see the file COPYING3. If not see
" %{fmodules-ts:-fdirectives-only}"
" %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}"
" %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}"
+ " %{fmodules-ts:%{fpreprocessed:-fdirectives-only}}"
" %(cc1_options) %2"
" %{!S:-o %g.s%V}"
" %{fmodules-ts:-fmodule-header}"
@@ -56,7 +58,8 @@ along with GCC; see the file COPYING3. If not see
" %{!o*:--output-pch=%i.gch}%W{o*:--output-pch=%*}}}}}}}}",
CPLUSPLUS_CPP_SPEC, 0, 0},
{"@c++-system-header",
- "%{E|M|MM:cc1plus -E %(cpp_options) %2 %(cpp_debug_options)}"
+ "%{E|M|MM:cc1plus -E %{fmodules-ts:-fdirectives-only}"
+ " %(cpp_options) %2 %(cpp_debug_options)}"
"%{!E:%{!M:%{!MM:"
" %{save-temps*|no-integrated-cpp:cc1plus -E"
" %{fmodules-ts:-fdirectives-only -fmodule-header=system}"
@@ -65,6 +68,7 @@ along with GCC; see the file COPYING3. If not see
" %{fmodules-ts:-fdirectives-only}"
" %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}"
" %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}"
+ " %{fmodules-ts:%{fpreprocessed:-fdirectives-only}}"
" %(cc1_options) %2"
" %{!S:-o %g.s%V}"
" %{fmodules-ts:-fmodule-header%{!fpreprocessed:%{!save-temps*:=system}}}"
@@ -72,7 +76,8 @@ along with GCC; see the file COPYING3. If not see
" %{!o*:--output-pch=%i.gch}%W{o*:--output-pch=%*}}}}}}}}",
CPLUSPLUS_CPP_SPEC, 0, 0},
{"@c++-user-header",
- "%{E|M|MM:cc1plus -E %(cpp_options) %2 %(cpp_debug_options)}"
+ "%{E|M|MM:cc1plus -E %{fmodules-ts:-fdirectives-only}"
+ " %(cpp_options) %2 %(cpp_debug_options)}"
"%{!E:%{!M:%{!MM:"
" %{save-temps*|no-integrated-cpp:cc1plus -E"
" %{fmodules-ts:-fdirectives-only -fmodule-header=user}"
@@ -81,6 +86,7 @@ along with GCC; see the file COPYING3. If not see
" %{fmodules-ts:-fdirectives-only}"
" %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}"
" %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}"
+ " %{fmodules-ts:%{fpreprocessed:-fdirectives-only}}"
" %(cc1_options) %2"
" %{!S:-o %g.s%V}"
" %{fmodules-ts:-fmodule-header%{!fpreprocessed:%{!save-temps*:=user}}}"
More information about the Gcc-cvs
mailing list