[Lldb-commits] [lldb] 348f9e7 - [lldb] Fix warning: comparison of unsigned expression in >= 0 is always true

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 26 09:13:57 PDT 2024


Author: Jonas Devlieghere
Date: 2024-03-26T09:13:51-07:00
New Revision: 348f9e73d7175f67750dc40b15cf1fc888bf60b5

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

LOG: [lldb] Fix warning: comparison of unsigned expression in >= 0 is always true

lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp:1195:15: warning:
comparison of unsigned expression in ‘>= 0’ is always true
 1195 |   if (weekday >= 0 && weekday < 7)
      |       ~~~~~~~~^~~~

Added: 
    

Modified: 
    lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
index bcb04fae15bd46..d2d50152c07cf8 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -1192,7 +1192,7 @@ bool lldb_private::formatters::LibcxxChronoWeekdaySummaryProvider(
     return false;
 
   const unsigned weekday = ptr_sp->GetValueAsUnsigned(0);
-  if (weekday >= 0 && weekday < 7)
+  if (weekday < 7)
     stream << "weekday=" << weekdays[weekday];
   else
     stream.Printf("weekday=%u", weekday);


        


More information about the lldb-commits mailing list