This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/7] Generate virtual locations for tokens


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]