[Lldb-commits] [lldb] r258199 - [Process] Remove dead code. All the switch cases are already covered.

Davide Italiano via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 19 14:22:18 PST 2016


On Tue, Jan 19, 2016 at 2:11 PM, Zachary Turner <zturner at google.com> wrote:
> What about this:
>
>     switch (m_private_state.GetValue())
>     {
>         case eStateConnected:
>         case eStateAttaching:
>         case eStateLaunching:
>         case eStateStopped:
>         case eStateRunning:
>         case eStateStepping:
>         case eStateCrashed:
>         case eStateSuspended:
>             return true;
>
>         default:
>             return false;
>     }
>

Yes, that should work, I modified the other one in the same way
https://people.freebsd.org/~davide/llvm/lldb_uncoveredswitch.diff
Can you please take a look at the patch before I commit? (and also
ensure it doesn't re-introduce warning with your compiler?)

Thanks!

--
Davide

>
> On Tue, Jan 19, 2016 at 2:10 PM Davide Italiano <davide at freebsd.org> wrote:
>>
>> On Tue, Jan 19, 2016 at 2:08 PM, Davide Italiano <davide at freebsd.org>
>> wrote:
>> > On Tue, Jan 19, 2016 at 2:05 PM, Zachary Turner <zturner at google.com>
>> > wrote:
>> >> This is needed in order to prevent MSVC from warning about this case.
>> >> I
>> >> explicitly added these last week.  Can I ask that you revert this
>> >> change?
>> >>
>>
>> In particular:
>>
>> ../tools/lldb/source/Target/Process.cpp:1507:9: warning: default label in
>> switch
>>  which covers all enumeration values [-Wcovered-switch-default]
>>         default:
>>         ^
>>
>>
>> >
>> > Well, this broke the build with -Werror which is my default, that's
>> > why I made the change.
>> > Is there a way we can make everybody happy you can think of?
>> >
>> >> On Tue, Jan 19, 2016 at 2:03 PM Davide Italiano via lldb-commits
>> >> <lldb-commits at lists.llvm.org> wrote:
>> >>>
>> >>> Author: davide
>> >>> Date: Tue Jan 19 15:59:12 2016
>> >>> New Revision: 258199
>> >>>
>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=258199&view=rev
>> >>> Log:
>> >>> [Process] Remove dead code. All the switch cases are already covered.
>> >>>
>> >>> Modified:
>> >>>     lldb/trunk/source/Expression/ExpressionSourceCode.cpp
>> >>>     lldb/trunk/source/Target/Process.cpp
>> >>>
>> >>> Modified: lldb/trunk/source/Expression/ExpressionSourceCode.cpp
>> >>> URL:
>> >>>
>> >>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ExpressionSourceCode.cpp?rev=258199&r1=258198&r2=258199&view=diff
>> >>>
>> >>>
>> >>> ==============================================================================
>> >>> --- lldb/trunk/source/Expression/ExpressionSourceCode.cpp (original)
>> >>> +++ lldb/trunk/source/Expression/ExpressionSourceCode.cpp Tue Jan 19
>> >>> 15:59:12 2016
>> >>> @@ -118,8 +118,6 @@ public:
>> >>>                      return false;
>> >>>                  else
>> >>>                      return true;
>> >>> -            default:
>> >>> -                return false;
>> >>>          }
>> >>>      }
>> >>>
>> >>>
>> >>> Modified: lldb/trunk/source/Target/Process.cpp
>> >>> URL:
>> >>>
>> >>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=258199&r1=258198&r2=258199&view=diff
>> >>>
>> >>>
>> >>> ==============================================================================
>> >>> --- lldb/trunk/source/Target/Process.cpp (original)
>> >>> +++ lldb/trunk/source/Target/Process.cpp Tue Jan 19 15:59:12 2016
>> >>> @@ -1504,8 +1504,6 @@ Process::IsAlive ()
>> >>>          case eStateCrashed:
>> >>>          case eStateSuspended:
>> >>>              return true;
>> >>> -        default:
>> >>> -            return false;
>> >>>      }
>> >>>  }
>> >>>
>> >>>
>> >>>
>> >>> _______________________________________________
>> >>> lldb-commits mailing list
>> >>> lldb-commits at lists.llvm.org
>> >>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>> >
>> >
>> >
>> > --
>> > Davide
>> >
>> > "There are no solved problems; there are only problems that are more
>> > or less solved" -- Henri Poincare
>>
>>
>>
>> --
>> Davide
>>
>> "There are no solved problems; there are only problems that are more
>> or less solved" -- Henri Poincare



-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare


More information about the lldb-commits mailing list