+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.
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
+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
/* { 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"
/* { 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"
/* { 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"
/* { 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"
/* { 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>
/* { 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"
/* { 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"
/* { 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"
/* { 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"
/* { 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"
}
}
+# 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
#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
+}