summaryrefslogtreecommitdiff
path: root/gcc/testsuite/lib/target-supports.exp
diff options
context:
space:
mode:
authorAlexandre Oliva <oliva@adacore.com>2020-04-24 08:32:10 -0300
committerAlexandre Oliva <oliva@gnu.org>2020-04-24 08:32:10 -0300
commit3685c5adf5c0b30268cb8f95c89e4c4a3240ae6f (patch)
treeb63072d91a0b2fdcd2adce6c4fca24952dcd4abd /gcc/testsuite/lib/target-supports.exp
parentc508fd07d7615443f7a62d6745779ec97514e7a2 (diff)
introduce target fileio and require it in tests that use tmpnam
Some target C libraries that aren't recognized as freestanding don't have filesystem support, so calling tmpnam, fopen/open and remove/unlink fails to link. This patch introduces a fileio effective target to the testsuite, and requires it in the tests that call tmpnam. for gcc/testsuite/ChangeLog * lib/target-supports.exp (check_effective_target_fileio): New. * gcc.c-torture/execute/fprintf-2.c: Require it. * gcc.c-torture/execute/printf-2.c: Likewise. * gcc.c-torture/execute/user-printf.c: Likewise.
Diffstat (limited to 'gcc/testsuite/lib/target-supports.exp')
-rw-r--r--gcc/testsuite/lib/target-supports.exp13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index a667ddf4fe4..008def691b3 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -751,6 +751,19 @@ proc check_effective_target_freestanding { } {
return 0
}
+# Check to see that file I/O functions are available.
+proc check_effective_target_fileio { } {
+ return [check_no_compiler_messages fileio_available executable {
+#include <stdio.h>
+int main() {
+ char *n = tmpnam (NULL);
+ FILE *f = fopen (n, "w");
+ fclose (f);
+ remove (n);
+ return 0;
+} } ""]
+}
+
# Return 1 if target has packed layout of structure members by
# default, 0 otherwise. Note that this is slightly different than
# whether the target has "natural alignment": both attributes may be