Ignore:
Timestamp:
Oct 8, 2014, 9:18:03 AM (11 years ago)
Author:
Brent Fulgham
Message:

[Win] Resolve some static analysis warnings in JavaScriptCore
https://bugs.webkit.org/show_bug.cgi?id=137508

Reviewed by Geoffrey Garen.

  • API/tests/testapi.c:

(assertEqualsAsCharactersPtr): MSVC insists on using %Iu as its format specifier
for size_t. Make the format string conditional on Windows.

  • bytecode/Watchpoint.h:

(JSC::InlineWatchpointSet::encodeState): Silence warning about left-shifting 'state'
as a 32-bit value before OR-ing it with a 64-bit value.

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode): Silence warning about operator prescedence

causing the
operation to take place before the >= test.
  • dfg/DFGInPlaceAbstractState.cpp:
(JSC::DFG::InPlaceAbstractState::endBasicBlock): Ditto (
before !=)
  • testRegExp.cpp:

(testOneRegExp): Ditto %Iu format specifier.

  • yarr/YarrInterpreter.cpp:

(JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): Silence warning about
using a 32-bit value as part of a 64-bit calculation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/testRegExp.cpp

    r173949 r174455  
    207207        if (outVector.size() != regExpTest->expectVector.size()) {
    208208            result = false;
    209             if (verbose)
    210                 printf("Line %d: output vector size mismatch - expected %lu got %lu\n", lineNumber, regExpTest->expectVector.size(), outVector.size());
     209            if (verbose) {
     210#if OS(WINDOWS)
     211                printf("Line %d: output vector size mismatch - expected %Iu got %Iu\n", lineNumber, regExpTest->expectVector.size(), outVector.size());
     212#else
     213                printf("Line %d: output vector size mismatch - expected %zu got %zu\n", lineNumber, regExpTest->expectVector.size(), outVector.size());
     214#endif
     215            }
    211216        } else if (outVector.size() % 2) {
    212217            result = false;
    213             if (verbose)
    214                 printf("Line %d: output vector size is odd (%lu), should be even\n", lineNumber, outVector.size());
     218            if (verbose) {
     219#if OS(WINDOWS)
     220                printf("Line %d: output vector size is odd (%Iu), should be even\n", lineNumber, outVector.size());
     221#else
     222                printf("Line %d: output vector size is odd (%zu), should be even\n", lineNumber, outVector.size());
     223#endif
     224            }
    215225        } else {
    216226            // Check in pairs since the first value of the pair could be -1 in which case the second doesn't matter.
     
    220230                if (outVector[startIndex] != regExpTest->expectVector[startIndex]) {
    221231                    result = false;
    222                     if (verbose)
    223                         printf("Line %d: output vector mismatch at index %lu - expected %d got %d\n", lineNumber, startIndex, regExpTest->expectVector[startIndex], outVector[startIndex]);
     232                    if (verbose) {
     233#if OS(WINDOWS)
     234                        printf("Line %d: output vector mismatch at index %Iu - expected %d got %d\n", lineNumber, startIndex, regExpTest->expectVector[startIndex], outVector[startIndex]);
     235#else
     236                        printf("Line %d: output vector mismatch at index %zu - expected %d got %d\n", lineNumber, startIndex, regExpTest->expectVector[startIndex], outVector[startIndex]);
     237#endif
     238                    }
    224239                }
    225240                if ((i > 0) && (regExpTest->expectVector[startIndex] != -1) && (outVector[startIndex+1] != regExpTest->expectVector[startIndex+1])) {
    226241                    result = false;
    227                     if (verbose)
    228                         printf("Line %d: output vector mismatch at index %lu - expected %d got %d\n", lineNumber, startIndex+1, regExpTest->expectVector[startIndex+1], outVector[startIndex+1]);
     242                    if (verbose) {
     243#if OS(WINDOWS)
     244                        printf("Line %d: output vector mismatch at index %Iu - expected %d got %d\n", lineNumber, startIndex + 1, regExpTest->expectVector[startIndex + 1], outVector[startIndex + 1]);
     245#else
     246                        printf("Line %d: output vector mismatch at index %zu - expected %d got %d\n", lineNumber, startIndex + 1, regExpTest->expectVector[startIndex + 1], outVector[startIndex + 1]);
     247#endif
     248                    }
    229249                }
    230250            }
Note: See TracChangeset for help on using the changeset viewer.