aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2024-11-16 15:25:04 -0500
committerJason Merrill <jason@redhat.com>2024-11-17 16:23:21 +0100
commit3e89a4d5138e585713604135d4c2601244055e82 (patch)
tree7d218fae45df69ef3ca018f8d553e7315c6d6428
parentdbfbd3aa2c1fb6293defcb1ad16099bb8aa4a0cb (diff)
downloadgcc-3e89a4d5138e585713604135d4c2601244055e82.zip
gcc-3e89a4d5138e585713604135d4c2601244055e82.tar.gz
gcc-3e89a4d5138e585713604135d4c2601244055e82.tar.bz2
c++: -M and modules again
While experimenting with testing module std I noticed that gcc -M broke on it; it seems I need to set directives_only even sooner than I did in r15-4219. gcc/c-family/ChangeLog: * c-ppoutput.cc (preprocess_file): Don't set directives_only here. gcc/cp/ChangeLog: * module.cc (module_preprocess_options): Set directives_only here.
-rw-r--r--gcc/c-family/c-ppoutput.cc1
-rw-r--r--gcc/cp/module.cc2
2 files changed, 2 insertions, 1 deletions
diff --git a/gcc/c-family/c-ppoutput.cc b/gcc/c-family/c-ppoutput.cc
index f6f83bd..97ea864 100644
--- a/gcc/c-family/c-ppoutput.cc
+++ b/gcc/c-family/c-ppoutput.cc
@@ -95,7 +95,6 @@ preprocess_file (cpp_reader *pfile)
if (flag_modules)
{
/* For macros from imported headers we need directives_only_cb. */
- cpp_get_options (pfile)->directives_only = true;
scan_translation_unit_directives_only (pfile);
}
else
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 27eb39b..4136fdc 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -21224,6 +21224,8 @@ module_preprocess_options (cpp_reader *reader)
}
auto *opt = cpp_get_options (reader);
opt->module_directives = true;
+ if (flag_no_output)
+ opt->directives_only = true;
if (opt->main_search == CMS_none)
opt->main_search = cpp_main_search (flag_header_unit);
}