https://gcc.gnu.org/g:dcee0b6547211a428b75adb03a461285fed0f20d

commit r15-4219-gdcee0b6547211a428b75adb03a461285fed0f20d
Author: Jason Merrill <ja...@redhat.com>
Date:   Wed Oct 9 12:28:46 2024 -0400

    c++: more modules and -M
    
    In r15-4119-gc877a27f04f648 I told preprocess_file to use the
    directives-only scan with modules, but it seems that I also need to set the
    cpp_option so that communication between _cpp_handle_directive and
    scan_translation_unit_directives_only works properly in
    c-c++-common/cpp/embed-6.c.
    
    gcc/c-family/ChangeLog:
    
            * c-ppoutput.cc (preprocess_file): Set directives_only flag.

Diff:
---
 gcc/c-family/c-ppoutput.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/c-family/c-ppoutput.cc b/gcc/c-family/c-ppoutput.cc
index 374252bb4f37..e2c38cbd9ebb 100644
--- a/gcc/c-family/c-ppoutput.cc
+++ b/gcc/c-family/c-ppoutput.cc
@@ -93,8 +93,11 @@ preprocess_file (cpp_reader *pfile)
   if (flag_no_output && pfile->buffer)
     {
       if (flag_modules)
-       /* For macros from imported headers we need directives_only_cb.  */
-       scan_translation_unit_directives_only (pfile);
+       {
+         /* For macros from imported headers we need directives_only_cb.  */
+         cpp_get_options (pfile)->directives_only = true;
+         scan_translation_unit_directives_only (pfile);
+       }
       else
        {
          /* Scan -included buffers, then the main file.  */

Reply via email to