public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* preprocessor: new callbacks
@ 2020-11-17 16:21 Nathan Sidwell
  0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2020-11-17 16:21 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 391 bytes --]


These two callbacks are	needed for C++ modules.  The first is for
handling macros from header-units.  These are resolved lazily.	The
second is for include-translation -- whether a #include gets turned
into a header-unit import.

         libcpp/
         * include/cpplib.h (struct cpp_callbacks): Add
         user_deferred_macro & translate_include.

pushing to trunk

-- 
Nathan Sidwell

[-- Attachment #2: 03-cpp-callbacks.diff --]
[-- Type: text/x-patch, Size: 1019 bytes --]

diff --git c/libcpp/include/cpplib.h w/libcpp/include/cpplib.h
index 8e398863cf6..81be6457951 100644
--- c/libcpp/include/cpplib.h
+++ w/libcpp/include/cpplib.h
@@ -680,6 +695,9 @@ struct cpp_callbacks
   /* Callback that can change a user lazy into normal macro.  */
   void (*user_lazy_macro) (cpp_reader *, cpp_macro *, unsigned);
 
+  /* Callback to handle deferred cpp_macros.  */
+  cpp_macro *(*user_deferred_macro) (cpp_reader *, location_t, cpp_hashnode *);
+
   /* Callback to parse SOURCE_DATE_EPOCH from environment.  */
   time_t (*get_source_date_epoch) (cpp_reader *);
 
@@ -698,6 +716,11 @@ struct cpp_callbacks
   /* Callback for filename remapping in __FILE__ and __BASE_FILE__ macro
      expansions.  */
   const char *(*remap_filename) (const char*);
+
+  /* Maybe translate a #include into something else.  Return a
+     cpp_buffer containing the translation if translating.  */
+  char *(*translate_include) (cpp_reader *, line_maps *, location_t,
+			      const char *path);
 };
 
 #ifdef VMS

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-17 16:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17 16:21 preprocessor: new callbacks Nathan Sidwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).