Bug 162551 - -Wtautological-compare triggered in URLParser::internalValuesConsistent
Summary: -Wtautological-compare triggered in URLParser::internalValuesConsistent
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Minor
Assignee: Michael Catanzaro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-26 01:48 PDT by Michael Catanzaro
Modified: 2016-09-26 12:51 PDT (History)
5 users (show)

See Also:


Attachments
Patch (1.45 KB, patch)
2016-09-26 01:52 PDT, Michael Catanzaro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2016-09-26 01:48:55 PDT
This is wrong:

[3876/6045] Building CXX object Source...s/WebCore.dir/platform/URLParser.cpp.o
../../Source/WebCore/platform/URLParser.cpp: In static member function ‘static bool WebCore::URLParser::internalValuesConsistent(const WebCore::URL&)’:
../../Source/WebCore/platform/URLParser.cpp:2357:26: warning: self-comparison always evaluates to true [-Wtautological-compare]
         && url.m_hostEnd <= url.m_hostEnd
            ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
Comment 1 Michael Catanzaro 2016-09-26 01:52:05 PDT
Created attachment 289810 [details]
Patch
Comment 2 Alexey Proskuryakov 2016-09-26 07:44:26 PDT
Can a regression test detect this?

Also, can this warning be enabled in normal build?
Comment 3 Alex Christensen 2016-09-26 08:18:26 PDT
Comment on attachment 289810 [details]
Patch

We shouldn't be able to add a regression test for this because both inequalities should always be true.  If either one can be false, there is a major error in the parser.  There are a few such cases right now, but when I'm finished soon there won't be.
We should enable the warning somewhere, if not everywhere.
Comment 4 Michael Catanzaro 2016-09-26 11:49:06 PDT
Comment on attachment 289810 [details]
Patch

With GCC it's enabled by -Wall, which is set in CMake ports by WEBKIT_SET_EXTRA_COMPILER_FLAGS, which *hopefully* is used on all targets. Definitely seems like a good idea to set it in Xcode builds as well, but you'll forgive me if I don't assist with that. ;)
Comment 5 WebKit Commit Bot 2016-09-26 12:11:22 PDT
Comment on attachment 289810 [details]
Patch

Clearing flags on attachment: 289810

Committed r206385: <http://trac.webkit.org/changeset/206385>
Comment 6 WebKit Commit Bot 2016-09-26 12:11:26 PDT
All reviewed patches have been landed.  Closing bug.