[libcxx] [test] Fix building create_directory in MSVC configurations
authorMartin Storsjö <martin@martin.st>
Fri, 26 Feb 2021 14:29:16 +0000 (16:29 +0200)
committerMartin Storsjö <martin@martin.st>
Sun, 7 Mar 2021 21:26:41 +0000 (23:26 +0200)
Don't use the mode_t type - the official windows sdk doesn't have that type.
(Mingw headers does have such a typedef though.) The umask function returns
int on windows, in both header variants.

Thus just use auto to deduce the umask return type automatically.

Differential Revision: https://reviews.llvm.org/D98140

libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp

index 30dea61..7554afa 100644 (file)
@@ -32,7 +32,7 @@
 using namespace fs;
 
 fs::perms read_umask() {
-    mode_t old_mask = umask(0);
+    auto old_mask = umask(0); // int on Windows, mode_t on POSIX.
     umask(old_mask); // reset the mask to the old value.
     return static_cast<fs::perms>(old_mask);
 }