[Lldb-commits] [lldb] r217429 - Quiet unused variable warning that only occurs

Eric Christopher echristo at gmail.com
Tue Sep 9 12:45:47 PDT 2014


It does show up a few more times. It's actually somewhat rare for the code
in the assert to be long enough to justify pulling it out. I almost just
folded this check in to the assert.

-eric

On Tue, Sep 9, 2014 at 12:44 PM, Todd Fiala <tfiala at google.com> wrote:

> We used to define macros for that kind of thing (like UNREF (num_printed))
> or UNUSED or something similar to indicate this is only here for some code
> paths.  It essentially became self documenting.  We might want to do
> something like that if we don't already have a similar macro.
>
> -Todd
>
> On Tue, Sep 9, 2014 at 12:23 PM, <jingham at apple.com> wrote:
>
>> Can you include a comment on this kind of change?  It looks dopey till
>> you realize it's there to quiet a compiler warning.
>>
>> Jim
>>
>> > On Sep 9, 2014, at 1:57 AM, Eric Christopher <echristo at gmail.com>
>> wrote:
>> >
>> > Author: echristo
>> > Date: Tue Sep  9 03:57:33 2014
>> > New Revision: 217429
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=217429&view=rev
>> > Log:
>> > Quiet unused variable warning that only occurs
>> > when compiling optimized.
>> >
>> > Modified:
>> >    lldb/trunk/source/Interpreter/CommandInterpreter.cpp
>> >
>> > Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
>> > URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=217429&r1=217428&r2=217429&view=diff
>> >
>> ==============================================================================
>> > --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
>> > +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Tue Sep  9
>> 03:57:33 2014
>> > @@ -469,6 +469,7 @@ CommandInterpreter::LoadCommandDictionar
>> >             char buffer[1024];
>> >             int num_printed = snprintf(buffer, 1024, "%s %s",
>> break_regexes[i][1], "-o");
>> >             assert (num_printed < 1024);
>> > +         (void) num_printed;
>> >             success = tbreak_regex_cmd_ap->AddRegexCommand
>> (break_regexes[i][0], buffer);
>> >             if (!success)
>> >                 break;
>> >
>> >
>> > _______________________________________________
>> > lldb-commits mailing list
>> > lldb-commits at cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>>
>> _______________________________________________
>> lldb-commits mailing list
>> lldb-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>>
>
>
>
> --
> Todd Fiala | Software Engineer | tfiala at google.com | 650-943-3180
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140909/c41e8449/attachment.html>


More information about the lldb-commits mailing list