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

Abhina Sree via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 12 07:00:53 PDT 2021


abhina.sreeskantharajan created this revision.
abhina.sreeskantharajan added reviewers: abrachet, Kai, uweigand, anirudhp, fanbo-meng, Jonathan.Crowther, SeanP.
abhina.sreeskantharajan requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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'


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102326

Files:
  llvm/unittests/Support/Path.cpp


Index: llvm/unittests/Support/Path.cpp
===================================================================
--- llvm/unittests/Support/Path.cpp
+++ llvm/unittests/Support/Path.cpp
@@ -1933,7 +1933,8 @@
   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
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102326.344811.patch
Type: text/x-patch
Size: 525 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210512/f8ae6a42/attachment.bin>


More information about the llvm-commits mailing list