[llvm] cbed6e5 - [SystemZ][z/OS] Fix warning caused by umask returning a signed integer type

Abhina Sreeskantharajan via llvm-commits llvm-commits at lists.llvm.org
Wed May 12 09:26:30 PDT 2021


Author: Abhina Sreeskantharajan
Date: 2021-05-12T12:26:22-04:00
New Revision: cbed6e5b2ff026e4d64de8f6ee19bc902b6e0e23

URL: https://github.com/llvm/llvm-project/commit/cbed6e5b2ff026e4d64de8f6ee19bc902b6e0e23
DIFF: https://github.com/llvm/llvm-project/commit/cbed6e5b2ff026e4d64de8f6ee19bc902b6e0e23.diff

LOG: [SystemZ][z/OS] Fix warning caused by umask returning a signed integer type

On z/OS, umask() returns an int because mode_t is type int, however it is being compared to an unsigned int. This patch fixes the following warning we see when compiling Path.cpp.

```
comparison of integers of different signs: 'const int' and 'const unsigned int'
```

Reviewed By: muiez

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

Added: 
    

Modified: 
    llvm/unittests/Support/Path.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index 33f2c712f5ca6..7f95e6cae517d 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -1933,7 +1933,8 @@ TEST_F(FileSystemTest, getUmask) {
   unsigned CurrentMask = fs::getUmask();
   EXPECT_EQ(CurrentMask, 0022U)
       << "getUmask() didn't return previously set umask()";
-  EXPECT_EQ(::umask(OldMask), 0022U) << "getUmask() may have changed umask()";
+  EXPECT_EQ(::umask(OldMask), mode_t(0022U))
+      << "getUmask() may have changed umask()";
 #endif
 }
 


        


More information about the llvm-commits mailing list