[cfe-dev] Patch for review: enhancements/fixes to -verify

Andy Gibbs andyg1001 at hotmail.co.uk
Tue Jun 12 11:40:42 PDT 2012


I have posted two patches to the cfe-dev list which I hope should meet the 
concerns raised by Richard:


If these two patches can be approved and committed, then it is possible to 
leave all but the small selection of PCH test-cases and test-cases with 
#error/#warning alone.

I think there is no alternative but to move the position of some of the 
expected-* checks in the PCH test-cases.  As I have suggested in other 
posts, I don't believe this adversely affects the function of these tests, 
so I hope that this should not pose a problem.

With regard to the #error/#warning test cases, this revolves around the fact 
that in clang, the line

#error some error message // with comment

will emit the diagnostic "some error message // with comment", i.e. the 
diagnostic includes the comment.

I've looked into the source to where the #error/#warning is handled, and 
there is the following comment:

// Read the rest of the line raw.  We do this because we don't want macros
// to be expanded and we don't require that the tokens be valid 
// tokens.  For example, this is allowed: "#warning `   'foo".  GCC does
// collapse multiple consequtive white space between tokens, but this isn't
// specified by the standard.

Therefore, it seems that this behaviour is intentional, not a bug.  I would 
hesitate therefore to change the behaviour, unless it is generally felt it 
should be changed.

I also feel, that changed or not, the diagnostic check should still be on a 
separate line so that there can be no possibility that in checking the 
diagnostic, it checks against its own check text (since this is the problem 
in the current behaviour).

Therefore, would it be possible now to submit a new patch for consideration 
that provides the functionality as given in my original patch, but (due to 
the fixes in my separate patches mentioned at the top of this post) requires 
minimal changes to the pre-existing test-cases?  If so, please let me know 
and I will put one together first thing tomorrow.

Many, many thanks!!



More information about the cfe-dev mailing list