Closed Bug 1346859 Opened 7 years ago Closed 7 years ago

Remove dead code found by clang-tidy in unix/nsOSHelperAppService.cpp

Categories

(Developer Infrastructure :: Source Code Analysis, enhancement)

enhancement
Not set
normal

Tracking

(firefox55 fixed)

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: Sylvestre, Assigned: Sylvestre)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Clang-tidy found some incorrect code 
http://clang.llvm.org/extra/clang-tidy/checks/misc-redundant-expression.html 
i guess this is useless
I guess this is dead code as it was introduced in r1 (2007)
Summary: Remove dead code found by clang-tidy in → Remove dead code found by clang-tidy in unix/nsOSHelperAppService.cpp
Comment on attachment 8846743 [details]
Bug 1346859 - Remove dead code found by clang-tidy in unix/nsOSHelperAppService.cpp

https://reviewboard.mozilla.org/r/119750/#review121620

::: uriloader/exthandler/unix/nsOSHelperAppService.cpp
(Diff revision 1)
>        do {
>          --aDescriptionEnd;
>        } while (aDescriptionEnd != aDescriptionStart &&
>                 nsCRT::IsAsciiSpace(*aDescriptionEnd));
> -
> -      if (aDescriptionStart != aDescriptionStart && *aDescriptionEnd == '"') {

In case this isn't obvious, this a != a here
Comment on attachment 8846743 [details]
Bug 1346859 - Remove dead code found by clang-tidy in unix/nsOSHelperAppService.cpp

https://reviewboard.mozilla.org/r/119750/#review121624

I'd be interested to hear your thoughts on the below.  I have a slight preference for changing to what was probably meant so some poor soul doesn't waste a bunch of time debugging this...but the dead since hg@1 issue is also a strong argument that nobody cares...?

::: uriloader/exthandler/unix/nsOSHelperAppService.cpp
(Diff revision 1)
>        do {
>          --aDescriptionEnd;
>        } while (aDescriptionEnd != aDescriptionStart &&
>                 nsCRT::IsAsciiSpace(*aDescriptionEnd));
> -
> -      if (aDescriptionStart != aDescriptionStart && *aDescriptionEnd == '"') {

This function.  Such length.  Very wow.

I think this is supposed to be `aDescriptionEnd != aDescriptionStart`, so I kinda want to change it to that...but if this case has been dead since hg@1...
Attachment #8846743 - Flags: review?(nfroyd) → review+
Comment on attachment 8846743 [details]
Bug 1346859 - Remove dead code found by clang-tidy in unix/nsOSHelperAppService.cpp

https://reviewboard.mozilla.org/r/119750/#review121624

If you want, I can try this change and push to try. :)
I didn't bother as it has been this way for 10 years now and I think we will create bugs instead of fixing any
Nathan, I tried this: https://hg.mozilla.org/try/rev/859ec24402364438402dbc752255597490f1e51a
And this seems green to me. As it is declared as static, I don't expect it is used by something else.
OK for you?
Flags: needinfo?(nfroyd)
(In reply to Sylvestre Ledru [:sylvestre] from comment #7)
> Nathan, I tried this:
> https://hg.mozilla.org/try/rev/859ec24402364438402dbc752255597490f1e51a
> And this seems green to me. As it is declared as static, I don't expect it
> is used by something else.
> OK for you?

That's, uh, possibly a little more extensive than what I had in mind.  I have no idea about the ramifications of removing all that code, and I suspect that automated tests aren't going to provide very good coverage here because they don't have the kind of environment that some of that code was written to catch (e.g. opening realplayer files?  opening StarOffice files?  probably not happening in our tests).

Let's go ahead with the original r+'d mozreview patch; we can remove the code in a separate bug if we really think it necessary.
Flags: needinfo?(nfroyd)
Pushed by sledru@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6e99d208aa1a
Remove dead code found by clang-tidy in unix/nsOSHelperAppService.cpp r=froydnj
https://hg.mozilla.org/mozilla-central/rev/6e99d208aa1a
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Product: Core → Firefox Build System
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: