]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* macro.c (enter_macro_context): Call cb.used callback if defined.
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 20 Nov 2009 08:18:16 +0000 (08:18 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 20 Nov 2009 08:18:16 +0000 (08:18 +0000)
* directives.c (do_idef, do_ifndef): Ditto.
* include/cpplib.h (struct cpp_callbacks): Add used callback.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154359 138bc75d-0d04-0410-961f-82ee72b054a4

libcpp/ChangeLog
libcpp/directives.c
libcpp/include/cpplib.h
libcpp/macro.c

index c842e80c91deea9f78ec5ea5a4f9ba9863647363..af05ca315151a7cb8b4c2b143b706a1e36428f58 100644 (file)
@@ -1,3 +1,9 @@
+2009-11-20  Arnaud Charlet  <charlet@adacore.com>
+
+       * macro.c (enter_macro_context): Call cb.used callback if defined.
+       * directives.c (do_idef, do_ifndef): Ditto.
+       * include/cpplib.h (struct cpp_callbacks): Add used callback.
+
 2009-11-11  Kai Tietz  <kai.tietz@onevision.com>
 
        * directives.c (do_pragma_push_macro): New pragma handler.
index aed940e56e1d8890d0ce8fce930fd58970da400c..409d908b4e807bec09366185d76867756d4af382 100644 (file)
@@ -1808,6 +1808,8 @@ do_ifdef (cpp_reader *pfile)
                    pfile->cb.used_undef (pfile, pfile->directive_line, node);
                }
            }
+         if (pfile->cb.used)
+           pfile->cb.used (pfile, pfile->directive_line, node);
          check_eol (pfile, false);
        }
     }
@@ -1844,6 +1846,8 @@ do_ifndef (cpp_reader *pfile)
                    pfile->cb.used_undef (pfile, pfile->directive_line, node);
                }
            }
+         if (pfile->cb.used)
+           pfile->cb.used (pfile, pfile->directive_line, node);
          check_eol (pfile, false);
        }
     }
index e95f01a412a5e19817a330a496ede089a8ee59f6..6175bbcb092dd5dcb8f43f567c16d3652ca78c8d 100644 (file)
@@ -508,6 +508,9 @@ struct cpp_callbacks
   /* Called before #define and #undef or other macro definition
      changes are processed.  */
   void (*before_define) (cpp_reader *);
+  /* Called whenever a macro is expanded or tested.
+     Second argument is the location of the start of the current expansion.  */
+  void (*used) (cpp_reader *, source_location, cpp_hashnode *);
 };
 
 #ifdef VMS
index 1d284cf9f8a9043fea21789d04d45d4b0a332a2f..6647db567145461789353fe893a6307bc6f86dfc 100644 (file)
@@ -885,6 +885,9 @@ enter_macro_context (cpp_reader *pfile, cpp_hashnode *node,
            pfile->cb.used_define (pfile, pfile->directive_line, node);
        }
 
+      if (pfile->cb.used)
+       pfile->cb.used (pfile, result->src_loc, node);
+
       macro->used = 1;
 
       if (macro->paramc == 0)