This is the mail archive of the 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 preprocessor, diagnostics] PR preprocessor/53229 - Fix diagnostics location when pasting tokens

On 05/15/2012 07:18 AM, Dodji Seketeli wrote:
+paste_tokens (cpp_reader *pfile, source_location lhs_location,

If in the long run we want the location passed in to be the ## location, let's drop the "lhs" from the parameter name.

-      const cpp_token *result = cpp_get_token (pfile);
+      const cpp_token *result = cpp_get_token_with_location (pfile, NULL);

I find the difference between these two functions confusing, since you aren't passing in a pointer for the location to go into. I see that cpp_get_token_with_location sets pfile->set_invocation_location, which is documented to mean

  /* When expanding a macro at top-level, this is the location of the
     macro invocation.  */
  source_location invocation_location;

  /* True if this call to cpp_get_token should consider setting
     invocation_location.  */
  bool set_invocation_location;

But presumably get_token_no_padding isn't only called when we're starting to expand a top-level macro. And as far as I can tell the value of invocation_location is only used when we aren't tracking virtual locations anyway. So why does the change above fix the testcase?


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