sourcebuild.texi (dg-add-c99-runtime-options): Document.
authorRichard Sandiford <rsandifo@nildram.co.uk>
Sat, 22 Sep 2007 08:25:43 +0000 (08:25 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Sat, 22 Sep 2007 08:25:43 +0000 (08:25 +0000)
gcc/
* doc/sourcebuild.texi (dg-add-c99-runtime-options): Document.

gcc/testsuite/
* lib/target-supports.exp (add_options_for_c99_runtime): New procedure.
* lib/target-supports-dg.exp (dg-add-options): Likewise.
* gcc.dg/builtins-18.c: Use { dg-add-options c99_runtime } instead of
target-specific dg-options.
* gcc.dg/builtins-20.c: Likewise.
* gcc.dg/builtins-53.c: Likewise.
* gcc.dg/builtins-55.c: Likewise.
* gcc.dg/single-precision-constant.c: Likewise.
* gcc.dg/torture/builtin-convert-1.c: Likewise.
* gcc.dg/torture/builtin-convert-2.c: Likewise.
* gcc.dg/torture/builtin-convert-3.c: Likewise.
* gcc.dg/torture/builtin-convert-4.c: Likewise.
* gcc.dg/torture/builtin-power-1.c: Likewise.

From-SVN: r128663

15 files changed:
gcc/ChangeLog
gcc/doc/sourcebuild.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/builtins-18.c
gcc/testsuite/gcc.dg/builtins-20.c
gcc/testsuite/gcc.dg/builtins-53.c
gcc/testsuite/gcc.dg/builtins-55.c
gcc/testsuite/gcc.dg/single-precision-constant.c
gcc/testsuite/gcc.dg/torture/builtin-convert-1.c
gcc/testsuite/gcc.dg/torture/builtin-convert-2.c
gcc/testsuite/gcc.dg/torture/builtin-convert-3.c
gcc/testsuite/gcc.dg/torture/builtin-convert-4.c
gcc/testsuite/gcc.dg/torture/builtin-power-1.c
gcc/testsuite/lib/target-supports-dg.exp
gcc/testsuite/lib/target-supports.exp

index ffd7bb07519b6c1a6d3cc42890f11baa3f8b8a14..116aa78558ae395f9bc25bf294ad5a8ee177840e 100644 (file)
@@ -1,3 +1,7 @@
+2007-09-22  Richard Sandiford  <rsandifo@nildram.co.uk>
+
+       * doc/sourcebuild.texi (dg-add-c99-runtime-options): Document.
+
 2007-09-19  Michael Meissner  <michael.meissner@amd.com>
 
        * gcc/config/i386/i386.c: Delete trailing whitespace.
index 684069189dcbcc5e3491e25fd77efe41a9d6afbc..4f78d735572fcb4d6480ae6dc3629786bddd9e8a 100644 (file)
@@ -973,6 +973,18 @@ This DejaGnu directive provides a list of compiler options, to be used
 if the target system matches @var{selector}, that replace the default
 options used for this set of tests.
 
+@item @{ dg-add-options @var{feature} ... @}
+Add any compiler options that are needed to access certain features.
+This directive does nothing on targets that enable the features by
+default, or that don't provide them at all.  It must come after
+all @code{dg-options} directives.
+
+The supported values of @var{feature} are:
+@table @code
+@item c99_runtime
+The target's C99 runtime (both headers and libraries).
+@end table
+
 @item @{ dg-skip-if @var{comment} @{ @var{selector} @} @{ @var{include-opts} @} @{ @var{exclude-opts} @} @}
 Skip the test if the test system is included in @var{selector} and if
 each of the options in @var{include-opts} is in the set of options with
index 7558f8f36715cb16bc74473dd68650c5c6d9649a..84681ecbf991f3bb8fe5bafc6f29305f7ee25784 100644 (file)
@@ -1,3 +1,19 @@
+2007-09-22  Richard Sandiford  <rsandifo@nildram.co.uk>
+
+       * lib/target-supports.exp (add_options_for_c99_runtime): New procedure.
+       * lib/target-supports-dg.exp (dg-add-options): Likewise.
+       * gcc.dg/builtins-18.c: Use { dg-add-options c99_runtime } instead of
+       target-specific dg-options.
+       * gcc.dg/builtins-20.c: Likewise.
+       * gcc.dg/builtins-53.c: Likewise.
+       * gcc.dg/builtins-55.c: Likewise.
+       * gcc.dg/single-precision-constant.c: Likewise.
+       * gcc.dg/torture/builtin-convert-1.c: Likewise.
+       * gcc.dg/torture/builtin-convert-2.c: Likewise.
+       * gcc.dg/torture/builtin-convert-3.c: Likewise.
+       * gcc.dg/torture/builtin-convert-4.c: Likewise.
+       * gcc.dg/torture/builtin-power-1.c: Likewise.
+
 2007-09-21  Chao-ying Fu  <fu@mips.com>
 
        * lib/target-supports.exp (check_effective_target_fixed_point): New to
index f4f64c1acb3c9b47d957f8720ed757e4ea94a4a2..9afaca23adab7b51e4ad7e4feca9bc671c1d6b93 100644 (file)
@@ -7,8 +7,7 @@
 
 /* { dg-do link } */
 /* { dg-options "-O2 -ffast-math" } */
-/* { dg-options "-O2 -ffast-math -mmacosx-version-min=10.3" { target powerpc-*-darwin* } } */
-/* { dg-options "-O2 -ffast-math -std=c99" { target *-*-solaris2* } } */
+/* { dg-add-options c99_runtime } */
 
 #include "builtins-config.h"
 
index 9df23c4eb600bf00ae222beff89956ffb6fd6d28..4acb9218cfff61b481250854df0c6c1ece64d6c4 100644 (file)
@@ -7,8 +7,7 @@
 
 /* { dg-do link } */
 /* { dg-options "-O2 -ffast-math" } */
-/* { dg-options "-O2 -ffast-math -mmacosx-version-min=10.3" { target powerpc-*-darwin* } } */
-/* { dg-options "-O2 -ffast-math -std=c99" { target *-*-solaris2* } } */
+/* { dg-add-options c99_runtime } */
 
 #include "builtins-config.h"
 
index 048cda92afb1dd3abb61b967b4d038815e550497..9a50bf5ad3c293934628149ad214c6d4950f0c5b 100644 (file)
@@ -10,8 +10,7 @@
 
 /* { dg-do compile } */
 /* { dg-options "-O2 -ffast-math" } */
-/* { dg-options "-O2 -ffast-math -mmacosx-version-min=10.3" { target powerpc-*-darwin* } } */
-/* { dg-options "-O2 -ffast-math -std=c99" { target *-*-solaris2* } } */
+/* { dg-add-options c99_runtime } */
 
 #include "builtins-config.h"
 
index 7eebd6395cae409a95ce9abf487501862f32b9bb..0db7976a4801c4356a8297eb1504f25c571179b9 100644 (file)
@@ -1,7 +1,6 @@
 /* { dg-do link } */
 /* { dg-options "-O2 -ffast-math" } */
-/* { dg-options "-ffast-math -mmacosx-version-min=10.3" { target powerpc-*-darwin* } } */
-/* { dg-options "-O2 -ffast-math -std=c99" { target *-*-solaris2* } } */
+/* { dg-add-options c99_runtime } */
 
 #include "builtins-config.h"
 
index 3cf9f8ffe8750e862d90f36431ec291c69882e7b..ffd893d93ad03efcaef8289e08398cb7649e3904 100644 (file)
@@ -4,8 +4,7 @@
 
 /* { dg-do run } */
 /* { dg-options "-fsingle-precision-constant" } */
-/* { dg-options "-fsingle-precision-constant -mmacosx-version-min=10.3" { target powerpc-*-darwin* } } */
-/* { dg-options "-fsingle-precision-constant -std=c99" { target *-*-solaris2* } } */
+/* { dg-add-options c99_runtime } */
 
 #include <math.h>
 #include <float.h>
index 7886b9a531ffa940bbb0704069063c35d25fc28a..f13d29e6779d1fbf787865e056efcbda2d719f68 100644 (file)
@@ -7,8 +7,7 @@
 
 /* { dg-do link } */
 /* { dg-options "-ffast-math" } */
-/* { dg-options "-ffast-math -mmacosx-version-min=10.3" { target powerpc-*-darwin* } } */
-/* { dg-options "-ffast-math -std=c99" { target *-*-solaris2* } } */
+/* { dg-add-options c99_runtime } */
 
 #include "../builtins-config.h"
 
index 312b2d4db3b601f71b175a5f0236503b13337073..167ecddcb9a8cc0194711fa42eba817651e0d65f 100644 (file)
@@ -7,8 +7,7 @@
 
 /* { dg-do link } */
 /* { dg-options "-ffast-math" } */
-/* { dg-options "-ffast-math -mmacosx-version-min=10.3" { target powerpc-*-darwin* } } */
-/* { dg-options "-ffast-math -std=c99" { target *-*-solaris2* } } */
+/* { dg-add-options c99_runtime } */
 
 #include "../builtins-config.h"
 
index 9be570bb59237ff0cac2feee86eefd1597c23411..2034b4190cf25e83d061abd31ee0cbbc278572d4 100644 (file)
@@ -7,8 +7,7 @@
 
 /* { dg-do link } */
 /* { dg-options "-ffast-math" } */
-/* { dg-options "-ffast-math -mmacosx-version-min=10.3" { target powerpc-*-darwin* } } */
-/* { dg-options "-ffast-math -std=c99" { target *-*-solaris2* } } */
+/* { dg-add-options c99_runtime } */
 
 #include "../builtins-config.h"
 
index c37bd5e2e8ade579a5d793cb0fa6ca4fb7a29bb3..3dc47ad1ed285b309e1a7d8acbd60bcac69bbbd4 100644 (file)
@@ -7,8 +7,7 @@
 
 /* { dg-do compile } */
 /* { dg-options "-ftrapping-math -fdump-tree-original" } */
-/* { dg-options "-ftrapping-math -fdump-tree-original -mmacosx-version-min=10.3" { target powerpc-*-darwin* } } */
-/* { dg-options "-ftrapping-math -fdump-tree-original -std=c99" { target *-*-solaris2* } } */
+/* { dg-add-options c99_runtime } */
 
 #include "../builtins-config.h"
 
index 58eabfea18ced53514162abe8b3f6967be6a4cdd..a63ebf554238c8a56fda1093e8ad8ae2e27bd58e 100644 (file)
@@ -7,8 +7,7 @@
 
 /* { dg-do link } */
 /* { dg-options "-ffast-math" } */
-/* { dg-options "-ffast-math -mmacosx-version-min=10.3" { target powerpc-*-darwin* } } */
-/* { dg-options "-ffast-math -std=c99" { target *-*-solaris2* } } */
+/* { dg-add-options c99_runtime } */
 
 #include "../builtins-config.h"
 
index e7f9175fa6f378e2a8ed0623e052750431de6012..c4731c15917f60780da03f9868231085b6234fb9 100644 (file)
@@ -162,6 +162,22 @@ proc dg-require-host-local { args } {
     }
 }
 
+# Add any target-specific flags needed for accessing the given list
+# of features.  This must come after all dg-options.
+
+proc dg-add-options { args } {
+    upvar dg-extra-tool-flags extra-tool-flags
+
+    foreach arg [lrange $args 1 end] {
+       if { [info procs add_options_for_$arg] != "" } {
+           set extra-tool-flags \
+               [eval [list add_options_for_$arg ${extra-tool-flags}]]
+       } else {
+           error "Unrecognized option type: $arg"
+       }
+    }
+}
+
 # Check the flags with which the test will be run against options in
 # a test directive that will skip or xfail that test.  The DejaGnu proc
 # check_conditional_xfail will look at the options in compiler_flags, so
index 2aa8bcc1465010707942ac36d449d525d822247e..8bbb141ec105e3b9271bcdfff0c57ae4ebd0d4b0 100644 (file)
@@ -2562,3 +2562,15 @@ proc check_effective_target_wchar { } {
        #include <wchar.h>
     }]
 }
+
+# Add to FLAGS all the target-specific flags needed to access the c99 runtime.
+
+proc add_options_for_c99_runtime { flags } {
+    if { [istarget *-*-solaris2*] } {
+       return "$flags -std=c99"
+    }
+    if { [istarget powerpc-*-darwin*] } {
+       return "$flags -mmacosx-version-min=10.3"
+    }
+    return $flags
+}