Fix more clang/gcc and MSVC warnings in js/src/asmjs and js/src/jit

RESOLVED FIXED in Firefox 37

Status

()

defect
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: cpeterson, Assigned: cpeterson)

Tracking

(Blocks 1 bug)

unspecified
mozilla37
x86
macOS
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox36 wontfix, firefox37 fixed)

Details

Attachments

(1 attachment)

This change is a little ugly, but these variables are only used in debug builds:

> js/src/asmjs/AsmJSFrameIterator.cpp:114:23 [-Wunused-const-variable] unused variable 'PushedRetAddr'
> js/src/jit/arm/Assembler-arm.cpp:2887:14: warning: variable 'op' set but not used [-Wunused-but-set-variable]
> js/src/jit/arm/Lowering-arm.cpp:493:17: warning: unused variable 'ptrValue' [-Wunused-variable]
> js/src/jit/x86/Lowering-x86.cpp:223:17: warning: unused variable 'ptrValue' [-Wunused-variable]
> js/src/jit/x86/Lowering-x86.cpp:242:17: warning: unused variable 'ptrValue' [-Wunused-variable]
> js/src/jit/BaselineBailouts.cpp:419:1 [-Wunused-function] unused function 'IsInlinableFallback'

pcDeltaU is unsigned, but ENC3_PC_DELTA_MAX is signed int 0x1ff:

> js/src/jit/JitcodeMap.cpp:316:24: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
> js/src/jit/JitcodeMap.cpp:332:20: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]

MSVC complains about comparisons of bools to other types and relative comparisons of bools:

> js\src\jit/ParallelFunctions.cpp(347) : warning C4805: '==' : unsafe mix of type 'bool' and type 'double' in operation
> js\src\jit/ParallelFunctions.cpp(415) : warning C4804: '<' : unsafe use of type 'bool' in operation
> js\src\jit/ParallelFunctions.cpp(421) : warning C4804: '<=' : unsafe use of type 'bool' in operation
> js\src\jit/ParallelFunctions.cpp(427) : warning C4804: '>' : unsafe use of type 'bool' in operation
> js\src\jit/ParallelFunctions.cpp(433) : warning C4804: '>=' : unsafe use of type 'bool' in operation
Attachment #8530182 - Flags: review?(jdemooij)
Comment on attachment 8530182 [details] [diff] [review]
fix-jit-warnings.patch

Review of attachment 8530182 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks!

::: js/src/asmjs/AsmJSFrameIterator.cpp
@@ +115,2 @@
>  static const unsigned PushedRetAddr = 0;
> +#endif

For each nested #if, add a space after the "#", so:

# if defined(DEBUG)
...
# endif

(See the first #if in AsmJSSignalHandlers.cpp for instance).

Same below.

::: js/src/jit/arm/Lowering-arm.cpp
@@ +506,3 @@
>          int32_t ptrValue = ptr->toConstant()->value().toInt32();
>          // A bounds check is only skipped for a positive index.
>          MOZ_ASSERT(ptrValue >= 0);

Nit: I'd get rid of the ptrValue local so that you don't need the #ifdef DEBUG:

MOZ_ASSERT(ptr->toConstant()->value().toInt32() >= 0);

::: js/src/jit/x86/Lowering-x86.cpp
@@ +230,3 @@
>          int32_t ptrValue = ptr->toConstant()->value().toInt32();
>          // A bounds check is only skipped for a positive index.
>          MOZ_ASSERT(ptrValue >= 0);

Same here.
Attachment #8530182 - Flags: review?(jdemooij) → review+
https://hg.mozilla.org/mozilla-central/rev/99a49bcc523d
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
You need to log in before you can comment on or make changes to this bug.