You're in luck!  dg-warning and similar directives can be skipped or
xfailed for particular targets, but those don't take options into
account.  There is, however, an effective-target keyword for fpic.
Ok I'll give that a whirl. But what if I needed to skip the test
based on some other command line option? Intuitively, I would want
to use dg-skip-if or dg-xfail-if, which provide a more generalized
approach to command line checking and doesnt rely on that special
target.
The directives used in the GCC testsuite, along with effective-target
keywords and target/xfail selectors, are documented at
http://gcc.gnu.org/onlinedocs/gccint/Test-Directives.html.
I read that carefully before asking the question, and it is very
unclear (to me, a non-DG head) what the scope of some of those
directives are. For example, dh-skip-if seems to apply to the
entire test case, whereas things line dg-warning can appear on
a line-by-line basis. Or perhaps I'm just assuming that, and they
can in fact be used on a line-by-line test basis.

For example, in gcc.dg/assign-warn-3.c, how would I
ignore the check for a warning if -fPIC is used?

Any help greatly appreciated.

Something like

  { dg-warning "regexp" { "" { target { ! fpic } } } }
This is purely for my education's sake (the fpic target you
mentioned will suffice for the specific case I care about), but
if I wanted to, say xfail the test if -mfoo was specified on the
command line: Could I have something like:

foo(); /* dg-warning "regexp" { ! dg-skip-if { "" { i?86-*-* } { "-mfoo" } { "" } } */
The tcl syntax makes my head hurt so if thats wrong and you can
show me a generalized way to do this type of thing I would be
very grateful. Thank you Janis!

Kean

Reply via email to