Bug 19824 - javascriptcore\kjs\JSImmediate.h generates MSVC compiler warning.
Summary: javascriptcore\kjs\JSImmediate.h generates MSVC compiler warning.
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-30 02:17 PDT by Paul Pedriana
Modified: 2008-06-30 08:09 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Pedriana 2008-06-30 02:17:49 PDT
javascriptcore\kjs\JSImmediate.h has the following code:

static bool isNegative(const JSValue* v)
{
    ASSERT(isNumber(v));
    return reinterpret_cast<uintptr_t>(v) & 0x80000000;
}

which generates the following warning under MSVC:

JSImmediate.h(88) : warning C4800: 'uintptr_t' : forcing value to bool 'true' or 'false' (performance warning)

A simple workaround which results in identical behavior is to use the following:

static bool isNegative(const JSValue* v)
{
    ASSERT(isNumber(v));
    return (reinterpret_cast<uintptr_t>(v) & 0x80000000) != 0;
}

That this function appears to not work on 64 bit is another issue.
Comment 1 Alexey Proskuryakov 2008-06-30 08:09:03 PDT
At some point, we did try to appease MSVC in this regard, but then decided to stop wasting time on it, given that this warning makes no sense really, and modifications made on the Mac kept breaking Windows build. See WebKitLibraries/win/tools/vsprops/common.vsprops for the full list of warnings that we disable.

> That this function appears to not work on 64 bit is another issue.

That will be a serious issue if it doesn't work.