[gcc/devel/c++-modules] Add flang-include-translate-not

Nathan Sidwell nathan@gcc.gnu.org
Tue Nov 24 13:36:21 GMT 2020


https://gcc.gnu.org/g:505e63fe2694c719bbf40df936ac3267481fc853

commit 505e63fe2694c719bbf40df936ac3267481fc853
Author: Nathan Sidwell <nathan@acm.org>
Date:   Mon Nov 23 04:52:40 2020 -0800

    Add flang-include-translate-not
    
            gcc/
            * doc/invoke.texi (-flang-include-translate-not): Document.
            gcc/cp/
            * module.cc (maybe_translate_include): Add not-translate noting.
            gcc/c-family/
            * c.opt (flang-include-translate-not): New.

Diff:
---
 ChangeLog.modules   |  7 +++++++
 gcc/c-family/c.opt  |  6 +++++-
 gcc/cp/module.cc    | 10 ++++++----
 gcc/doc/invoke.texi | 17 ++++++++++++-----
 4 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/ChangeLog.modules b/ChangeLog.modules
index d7154bb068b..09390b8ddfa 100644
--- a/ChangeLog.modules
+++ b/ChangeLog.modules
@@ -1,5 +1,12 @@
 2020-11-23  Nathan Sidwell  <nathan@acm.org>
 
+	gcc/
+	* doc/invoke.texi (-flang-include-translate-not): Document.
+	gcc/cp/
+	* module.cc (maybe_translate_include): Add not-translate noting.
+	gcc/c-family/
+	* c.opt (flang-include-translate-not): New.
+
 	libcody/
 	Update from upstream, INCLUDE_TRANSLATE response meaning change
 
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 50b0e4265e7..fbb667fa23e 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1731,9 +1731,13 @@ C++ ObjC++ Var(warn_imported_macros)
 Warn about macros that have conflicting header units definitions.
 
 flang-info-include-translate
-C++ Var(note_include_translate)
+C++ Var(note_include_translate_yes)
 Note #include directives translated to import declarations.
 
+flang-info-include-translate-not
+C++ Var(note_include_translate_no)
+Note #include directives not translated to import declarations, and not known to be textual
+
 flang-info-include-translate=
 C++ Joined RejectNegative MissingArgError(missing header name)
 Note a #include translation of a specific header.
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 2c0a84712cf..fa531b30bf3 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -19046,13 +19046,13 @@ maybe_translate_include (cpp_reader *reader, line_maps *lmaps, location_t loc,
   auto packet = mapper->IncludeTranslate (path, Cody::Flags::None, len);
   int xlate = false;
   if (packet.GetCode () == Cody::Client::PC_BOOL)
-    xlate = packet.GetInteger ();
+    xlate = -int (packet.GetInteger ());
   else if (packet.GetCode () == Cody::Client::PC_PATHNAME)
     {
       /* Record the CMI name for when we do the import.  */
       module_state *import = get_module (build_string (len, path));
       import->set_filename (packet);
-      xlate = true;
+      xlate = +1;
     }
   else
     {
@@ -19062,7 +19062,9 @@ maybe_translate_include (cpp_reader *reader, line_maps *lmaps, location_t loc,
     }
 
   bool note = false;
-  if (note_include_translate && xlate)
+  if (note_include_translate_yes && xlate > 1)
+    note = true;
+  else if (note_include_translate_no && xlate == 0)
     note = true;
   else if (note_includes)
     {
@@ -19088,7 +19090,7 @@ maybe_translate_include (cpp_reader *reader, line_maps *lmaps, location_t loc,
 		   : "Keeping include as include");
   dump.pop (0);
 
-  if (!xlate)
+  if (!(xlate > 0))
     return nullptr;
   
   /* Create the translation text.  */
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 1857e16e475..eb66262277f 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -242,6 +242,7 @@ in the following sections.
 -fvisibility-ms-compat @gol
 -fext-numeric-literals @gol
 -flang-info-include-translate@r{[}=@var{name}@r{]} @gol
+-flang-info-include-translate-not @gol
 -Wabi-tag  -Wcatch-value  -Wcatch-value=@var{n} @gol
 -Wno-class-conversion  -Wclass-memaccess @gol
 -Wcomma-subscript  -Wconditionally-supported @gol
@@ -3361,8 +3362,10 @@ C++, but do still search the other standard directories.  (This option
 is used when building the C++ library.)
 
 @item -flang-info-include-translate
+@itemx -flang-info-include-translate-not
 @itemx -flang-info-include-translate=@var{header}
 @opindex flang-info-include-translate
+@opindex flang-info-include-translate-not
 Give notice of include translation events.
 
 @end table
@@ -32689,11 +32692,15 @@ descriptors.  By default, the limit is a few less than the per-process
 file descriptor hard limit, if that is determinable.@footnote{Where
 applicable the soft limit is incremented as needed towards the hard limit.}
 
-The @option{-flang-info-include-translate} option notes whether
-include translation occurs.  With no argument, all include translation
-is noted.  Otherwise, queries about include translation of a specific
-header file is noted.  The latter form may be repeated.  This option
-may be helpful in determining whether include translation is
+The @option{-flang-info-include-translate} and
+@option{-flang-info-include-translate-not} options notes whether
+include translation occurs or not.  With no argument, the first will
+note all include translation.  The second will note all
+non-translations of include files not known to intentionally be
+textual.  With an argument, queries about include translation of a
+header files with that particular trailing pathname are noted.  You
+may repeat this form to cover several different header files.  This
+option may be helpful in determining whether include translation is
 happenning -- if it is working correctly, it'll behave as if it wasn't
 there at all.


More information about the Gcc-cvs mailing list