On 01/09/15 17:54, Marek Polacek wrote:
On Tue, Sep 01, 2015 at 12:50:27PM -0400, David Malcolm wrote:
I can't comment on the patch itself, but I noticed that in the testsuite
addition, you've gathered all the "dg-final" clauses at the end.
I think that this is consistent with existing practice in gcc, but
AFAIK, the dg-final clauses can appear anywhere in the file.
Would it make test cases more readable if we put the dg-final clauses
next to the code that they relate to? Or, at least after the function
that they relate to?
For example:
unsigned short
foo (unsigned short a)
{
a ^= 0x4002;
a >>= 1;
a |= 0x8000; /* Simplify to ((a >> 1) ^ 0xa001). */
return a;
}
/* { dg-final { scan-tree-dump "\\^ 40961" "forwprop1" } } */
unsigned short
bar (unsigned short a)
{
/* snip */ /* Simplify to ((a << 1) | 0x8005). */
}
/* { dg-final { scan-tree-dump "\\| 32773" "forwprop1" } } */
... etc ...
I think this may be more readable than the "group them all at the end of
the file approach", especially with testcases with many files and
dg-final directives.
Yeah, it's probably somewhat more readable. Same for dg-output. E.g. some
ubsan tests already use dg-outputs after functions they relate to.
Marek
If no one objects Ill make those changes too. Sounds reasonable to me.
Andre