On 05/12/2014 07:24 PM, Mike Stump wrote:
On Apr 28, 2014, at 3:35 AM, Dimitris Papavasiliou <dpapa...@gmail.com> wrote:
+ a = private; /* { dg-warning "hides instance variable" "" { xfail *-*-* }
} */
+ a = protected; /* { dg-warning "hides instance variable" "" { xfail *-*-* }
} */
+ a = public; /* { dg-warning "hides instance variable" "" { xfail *-*-* }
} */
No, we don’t expect failures. We makes the compiler do what we wants or it
gets the hose again. Then, we expect it to be perfect. If you won’t want
warning, and non are produces, then just remove the /* … */, or write /* no
warning */.
I've fixed these as per your request. For the record though, this form of test
seems to be fairly common in the test suites as this output indicates:
dimitris@debian:~/sandbox/gcc-build$ find ../gcc-source/gcc/testsuite/ -name "*.c" -o -name "*.C"
-o -name "*.m" | xargs grep "xfail \*-\*-\*" | wc -l
354
Many of these seem to be in error or warning messages which are expected not to
show up. In any case if the messages do show up they'll trigger the excessive
messages test so I suppose that's enough.
Once we resolve the 3 warning tests above, this will be ok.
Actually, there were a few more { xfail *-*-* } in the other test cases. I've
removed these as well.
So, let’s make sure we’re on the same page…
Take shadow-2.m for example, before you said:
+ a = private; /* { dg-warning "hides instance variable" "" { xfail *-*-* }
} */
and now you say:
+ a = private; /* No warning. */
So, the first question is, what do we _want_ in the end here? Warning or no
warning? And what do we actually do now, warn or not?
If in the end, we want a warning, then the previous form is the right
eventually form. If we don’t want a warning, then the second is correct,
though, there is another form that is not unreasonable:
i += [Base class_func1]; /* { dg-bogus "invalid receiver type" } */
this says that we used to generate a warning (or an error message), but that
was wrong, and we no longer want to expect a warning, and that the bug has been
fixed and that no warning is generated.
I think we are on the same page, just wanted to make sure...
Well the point of this test is to make sure that the introduced -Wshadow
also controls the warnings related to the shadowing of instance
variables which was not the case in the past. So we declare a couple of
local variables of the same name and expect that they silently shadow
the instance variables, that is that warnings are _not_ generated.
So I take it that I should change these to dg-bogus since this is
behavior expected in the past but not now, as well as any other expected
non-warnings in the other test cases? Is it important in some way that
dg-bogus makes no distinction between warning and error messages?