This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 2/7] Generate virtual locations for tokens
- From: Jason Merrill <jason at redhat dot com>
- To: Dodji Seketeli <dodji at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, tromey at redhat dot com, gdr at integrable-solutions dot net, joseph at codesourcery dot com, burnus at net-b dot de, charlet at act-europe dot fr, bonzini at gnu dot org
- Date: Mon, 12 Sep 2011 16:04:02 -0400
- Subject: Re: [PATCH 2/7] Generate virtual locations for tokens
- References: <1291979498-1604-1-git-send-email-dodji@redhat.com> <cover.1310812267.git.dodji@redhat.com> <cover.1310824120.git.dodji@redhat.com> <ffd2480555f3297eeae7fd7fb701a1f936310103.1310824121.git.dodji@redhat.com> <m339haskht.fsf@redhat.com>
On 08/09/2011 10:54 AM, Dodji Seketeli wrote:
+ goto ftrack_macro_expansion_with_arg;
+
+ case OPT_ftrack_macro_expansion_:
+ ftrack_macro_expansion_with_arg:
Instead of the goto, just write /* Fall through. */
+consumption if necessary. Value @samp{0} of @var{level} de-activates
+this option just as if no @option{-ftrack-macro-expansion} was present
+on the command line. Value @samp{1} tracks tokens locations in a
+degraded mode for the sake of minimal memory overhead. In this mode
+all tokens resulting from the expansion of an argument of a
+function-like macro have the same location. Value @samp{2} tracks
+tokens locations completely. This value is the most memory hungry. It
+is the default value.
"It is the default value" sounds to me like no -ftrack-macro-expansion
option is equivalent to -ftrack-macro-expansion=2, rather than =0.
+ expansion of arguments of function-like macro. all macro
+ expansion. 2 Means we do track all macro expansions. This last
Seems like the "all macro expansion" is left over from a previous
version of this sentence.
+/* This describes some additional data that is added to the macro
+ token context of type cpp_context, when -ftrack-macro-expansion is
+ on. */
+typedef struct
+{
+ /* The node of the macro we are referring to. */
+ cpp_hashnode *macro_node;
+ /* This buffer contains an array of virtual locations. The virtual
+ location at index 0 is the virtual location of the token at index
+ 0 in the current instance of cpp_context; similarly for all the
+ other virtual locations. */
+ source_location *virt_locs;
+ /* This is a pointer to the current virtual location. This is used
+ to iterate over the virtual locations while we iterate over the
+ tokens they belong to. */
+ source_location *cur_virt_loc;
+} macro_context;
Why track virtual locations separately rather than use them directly as
the src_loc of the tokens?
Jason