r337892 - cc1_main: fix -Wsign-compare on FreeBSD

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 24 23:57:31 PDT 2018


Author: maskray
Date: Tue Jul 24 23:57:31 2018
New Revision: 337892

URL: http://llvm.org/viewvc/llvm-project?rev=337892&view=rev
Log:
cc1_main: fix -Wsign-compare on FreeBSD

Its __rlim_t is intentionally signed (__int64_t) because of legacy code
that uses -1 for RLIM_INFINITY.

Modified:
    cfe/trunk/tools/driver/cc1_main.cpp

Modified: cfe/trunk/tools/driver/cc1_main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1_main.cpp?rev=337892&r1=337891&r2=337892&view=diff
==============================================================================
--- cfe/trunk/tools/driver/cc1_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1_main.cpp Tue Jul 24 23:57:31 2018
@@ -140,9 +140,11 @@ static void ensureSufficientStack() {
 
   // Increase the soft stack limit to our desired level, if necessary and
   // possible.
-  if (rlim.rlim_cur != RLIM_INFINITY && rlim.rlim_cur < DesiredStackSize) {
+  if (rlim.rlim_cur != RLIM_INFINITY &&
+      rlim.rlim_cur < rlim_t(DesiredStackSize)) {
     // Try to allocate sufficient stack.
-    if (rlim.rlim_max == RLIM_INFINITY || rlim.rlim_max >= DesiredStackSize)
+    if (rlim.rlim_max == RLIM_INFINITY ||
+        rlim.rlim_max >= rlim_t(DesiredStackSize))
       rlim.rlim_cur = DesiredStackSize;
     else if (rlim.rlim_cur == rlim.rlim_max)
       return;




More information about the cfe-commits mailing list