[libcxx-commits] [libcxx] [libcxx] Add fallback to standard C when `unistd` is unavailable (PR #102005)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Aug 5 08:39:37 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 9fea73110ecc0a13d18e5c52f8e7fa62a9de9ee9 e4408fcaf74aff96b076c932611d2ba3a18fdeab --extensions h -- libcxx/test/support/platform_support.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/test/support/platform_support.h b/libcxx/test/support/platform_support.h
index b19e9a73c6..ab6a5414c0 100644
--- a/libcxx/test/support/platform_support.h
+++ b/libcxx/test/support/platform_support.h
@@ -42,9 +42,9 @@
# include <fcntl.h> // _O_EXCL, ...
# include <sys/stat.h> // _S_IREAD, ...
#elif __has_include(<unistd.h>)
-# include <unistd.h> // close
+# include <unistd.h> // close
#else
-# define TEST_TEMP_FALLBACK
+# define TEST_TEMP_FALLBACK
#endif
#if defined(_CS_GNU_LIBC_VERSION)
@@ -75,15 +75,15 @@ std::string get_temp_file_name()
abort();
}
#elif defined(TEST_TEMP_FALLBACK)
- char *filename = tmpnam(nullptr);
- if (!filename)
- abort();
- FILE *file = fopen(filename, "w");
- if (!file)
- abort();
- if (fclose(file) == EOF)
- abort();
- return std::string(filename);
+ char* filename = tmpnam(nullptr);
+ if (!filename)
+ abort();
+ FILE* file = fopen(filename, "w");
+ if (!file)
+ abort();
+ if (fclose(file) == EOF)
+ abort();
+ return std::string(filename);
#else
std::string Name = "libcxx.XXXXXX";
int FD = mkstemp(&Name[0]);
``````````
</details>
https://github.com/llvm/llvm-project/pull/102005
More information about the libcxx-commits
mailing list