[cfe-commits] [Patch 3 of 7] -verify fixes and enhancement

Andy Gibbs andyg1001 at hotmail.co.uk
Wed Jul 4 08:41:34 PDT 2012


On Wednesday, July 04, 2012 2:37 AM, Jordan Rose wrote:
> On Jul 3, 2012, at 3:23 PM, Andy Gibbs wrote:
>> Good to commit?
>
> LGTM. Wondering about this case:
> 
> int x; // expected-note + {{...}}
> ...
> // expected-note@<line> {{...}}
>
> ...but I'm willing to say that if you do this to yourself it
> shouldn't surprise you if it doesn't work.

Yes, its a greedy match algorithm.  The above case would always
generate a missing but expected diagnostic message since the "one
or more" directive will have gobbled up all the occurrences and
so the second directive will match nothing.

Alternatively, this:

// expected-note@<line> {{...}}
...
int x; // expected-note + {{...}}

will effectively mean a "2 or more" match.

I think we leave this to the user to sort out.  At least the
diagnostics from -verify will say where the error is...

For this code:

int x;    // expected-note + {{previous}}
double x; // expected-error {{redefinition}}
float x;  // expected-error {{redefinition}}
          // expected-note at 1 {{previous}}

the output is:

error: 'note' diagnostics expected but not seen: 
  Line 1 (directive at 1.c:4): previous
1 error generated.

So the user knows to look to line 4 for the mismatched directive.

Cheers
Andy






More information about the cfe-commits mailing list