On 02.05.2016 12:26, Bernd Schmidt wrote: > On 05/01/2016 09:52 AM, Bernd Edlinger wrote: >> Hi, >> >> I took a closer look at this test case, and I found, except that >> it triggers a dejagnu bug, it is also wrong. I have tested with >> a cross-compiler for target=sh-elf and found that the test case >> actually FAILs because the foo.specs uses "cppruntime" which >> is only referenced in gcc/config/sh/superh.h, but sh/superh.h >> is only included for target sh*-superh-elf, see gcc/config.gcc. >> >> This means that it can only pass for target=sh-superh-elf. >> >> The attached patch fixes the testcase and makes it run always, >> so that it does no longer triggers the dejagnu bug. > > So, two things. Why not use a string in the specs file that exists on > all targets? If it's a sh-specific thing we want to test, move why not > move it to gcc.target?
Yes, you are right. Only the original use-case seems to be sh-superh-elf specific. But there are also spec strings that are always available. I think adding -DFOO to "cpp_unique_options" will work on any target, and make the test case even more useful. So is the updated patch OK? Thanks Bernd.
2016-05-02 Bernd Edlinger <bernd.edlin...@hotmail.de> * gcc.dg/spec-options.c: Run the test on all targets. * gcc.dg/foo.specs: Use cpp_unique_options. Index: gcc/testsuite/gcc.dg/foo.specs =================================================================== --- gcc/testsuite/gcc.dg/foo.specs (revision 235675) +++ gcc/testsuite/gcc.dg/foo.specs (working copy) @@ -1,2 +1,2 @@ -*cppruntime: +*cpp_unique_options: + %{tfoo: -DFOO} Index: gcc/testsuite/gcc.dg/spec-options.c =================================================================== --- gcc/testsuite/gcc.dg/spec-options.c (revision 235675) +++ gcc/testsuite/gcc.dg/spec-options.c (working copy) @@ -1,8 +1,7 @@ /* Check that -mfoo is accepted if defined in a user spec and that it is not passed on the command line. */ /* Must be processed in EXTRA_SPECS to run. */ -/* { dg-do compile } */ -/* { dg-do run { target sh*-*-* } } */ +/* { dg-do run } */ /* { dg-options "-B${srcdir}/gcc.dg --specs=foo.specs -tfoo" } */ extern void abort(void);