[Lldb-commits] [lldb] r221636 - Fix some compiler warnings, one of which was a legit bug.

Zachary Turner zturner at google.com
Mon Nov 10 14:31:51 PST 2014


Author: zturner
Date: Mon Nov 10 16:31:51 2014
New Revision: 221636

URL: http://llvm.org/viewvc/llvm-project?rev=221636&view=rev
Log:
Fix some compiler warnings, one of which was a legit bug.

MSVC warns that not all control paths return a value when a switch
doesn't have a default case handler.  Changed explicit value checks
to a default check.

Also, it caught a case where bitwise AND was being used instead of
logical AND.  I'm not sure what this fixes, but presumably it is
not covered by any kind of test case.

Modified:
    lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
    lldb/trunk/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp

Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=221636&r1=221635&r2=221636&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Mon Nov 10 16:31:51 2014
@@ -173,11 +173,10 @@ public:
     {
         switch (flag)
         {
-            case eLazyBoolCalculate:
-            case eLazyBoolYes:
-                return true;
             case eLazyBoolNo:
                 return false;
+            default:
+                return true;
         }
     }
 
@@ -188,8 +187,7 @@ public:
         {
             case eLazyBoolYes:
                 return true;
-            case eLazyBoolCalculate:
-            case eLazyBoolNo:
+            default:
                 return false;
         }
     }

Modified: lldb/trunk/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp?rev=221636&r1=221635&r2=221636&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp (original)
+++ lldb/trunk/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp Mon Nov 10 16:31:51 2014
@@ -840,8 +840,8 @@ loopnext:
             {
                 ret_insn_offset = m_func_bounds.GetByteSize() - 6;
             }
-            else if (bytebuf[0] == 0x5d && bytebuf[1] == 0xc3 
-                     && bytebuf[2] == 0x0f && bytebuf[3] == 0x1f & bytebuf[4] == 0x44) // mov & ret & nop
+            else if (bytebuf[0] == 0x5d && bytebuf[1] == 0xc3
+                     && bytebuf[2] == 0x0f && bytebuf[3] == 0x1f && bytebuf[4] == 0x44) // mov & ret & nop
             {
                 ret_insn_offset = m_func_bounds.GetByteSize() - 6;
             }





More information about the lldb-commits mailing list