Add dg-add-options feature stack_size
2017-06-19 Tom de Vries <tom@codesourcery.com>
* doc/sourcebuild.texi (Add Options, Features for dg-add-options): Add
stack_size feature.
(Effective-Target Keywords, Other attributes): Suggest using
dg-add-options stack_size feature to get stack limit in stack_size
effective target documentation.
* lib/target-supports.exp (add_options_for_stack_size): New proc.
* gcc.c-torture/execute/920501-7.c: Use dg-add-options stack_size.
---
gcc/doc/sourcebuild.texi | 15 ++++++++++-----
gcc/testsuite/gcc.c-torture/execute/920501-7.c | 2 +-
gcc/testsuite/lib/target-supports.exp | 11 +++++++++++
3 files changed, 22 insertions(+), 6 deletions(-)
@@ -2097,11 +2097,10 @@ Target supports section anchors.
Target defaults to short enums.
@item stack_size
-Target has limited stack size. The stack size limit can be obtained using
-@code{[dg-effective-target-value stack_size]}. For example:
-@smallexample
-/* @{ dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" @{ target @{ stack_size @} @} @} */
-@end smallexample
+@anchor{stack_size_et}
+Target has limited stack size. The stack size limit can be obtained using the
+STACK_SIZE macro defined by @ref{stack_size_ao,,@code{dg-add-options} feature
+@code{stack_size}}.
@item static
Target supports @option{-static}.
@@ -2282,6 +2281,12 @@ compliance mode.
@code{mips16} function attributes.
Only MIPS targets support this feature, and only then in certain modes.
+@item stack_size
+@anchor{stack_size_ao}
+Add the flags needed to define macro STACK_SIZE and set it to the stack size
+limit associated with the @ref{stack_size_et,,@code{stack_size} effective
+target}.
+
@item tls
Add the target-specific flags needed to use thread-local storage.
@end table
@@ -1,6 +1,6 @@
/* { dg-require-effective-target label_values } */
/* { dg-require-effective-target trampolines } */
-/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+/* { dg-add-options stack_size } */
#ifdef STACK_SIZE
#define DEPTH ((STACK_SIZE) / 512 + 1)
@@ -7249,6 +7249,17 @@ proc add_options_for_double_vectors { flags } {
return $flags
}
+# Add to FLAGS the flags needed to define the STACK_SIZE macro.
+
+proc add_options_for_stack_size { flags } {
+ if [is-effective-target stack_size] {
+ set stack_size [dg-effective-target-value stack_size]
+ return "$flags -DSTACK_SIZE=$stack_size"
+ }
+
+ return $flags
+}
+
# Return 1 if the target provides a full C99 runtime.
proc check_effective_target_c99_runtime { } {