diff options
author | Howard Hinnant <hhinnant@apple.com> | 2013-03-22 20:05:40 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2013-03-22 20:05:40 +0000 |
commit | 7c5b88b134b0141c3ffda62534572a89d5a9640e (patch) | |
tree | c8e8b66f42f35f8d2249a4dc62dbcf9275bf688e /libcxx/test/support | |
parent | 7c8dbc12bb73c1d42307e784410a1d5383461732 (diff) | |
download | bcm5719-llvm-7c5b88b134b0141c3ffda62534572a89d5a9640e.tar.gz bcm5719-llvm-7c5b88b134b0141c3ffda62534572a89d5a9640e.zip |
Test cleanup with respect to use of deprecated tmpnam function. Also Windows port for these tests to use _tempnam. The bulk of this patch was donated anonymously. I've tested it on OS X and accept responsibility for it. If I've broken anyone's platform by switching from tmpnam to mktemp for the generation of temporary file names, just let me know. Should be easy to fix in test/support/platform_support.h
llvm-svn: 177755
Diffstat (limited to 'libcxx/test/support')
-rw-r--r-- | libcxx/test/support/platform_support.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libcxx/test/support/platform_support.h b/libcxx/test/support/platform_support.h index 0035975019a..4633ce047f0 100644 --- a/libcxx/test/support/platform_support.h +++ b/libcxx/test/support/platform_support.h @@ -39,4 +39,25 @@ #define LOCALE_zh_CN_UTF_8 "zh_CN.UTF-8" #endif +#include <stdio.h> +#include <stdlib.h> +#include <string> + +inline +std::string +get_temp_file_name() +{ +#ifdef _WIN32 + char* p = _tempnam( NULL, NULL ); + if (p == nullptr) + abort(); + std::string s(p); + free( p ); +#else + std::string s("temp.XXXX"); + mktemp(&s[0]); +#endif + return s; +} + #endif // PLATFORM_SUPPORT_H |