Closed Bug 1118149 Opened 7 years ago Closed 7 years ago

Mark js/src as FAIL_ON_WARNINGS for gcc and clang

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: cpeterson, Assigned: cpeterson)

References

Details

Attachments

(1 file)

js/src and js/src/jsapi-tests are now warnings-free for gcc and clang, so we mark these directories as warnings-as-errors (for gcc and clang). There are still some MSVC warnings.

This patch also removes a duplicated `FAIL_ON_WARNINGS = True` from js/xpconnect/shell/moz.build:

https://hg.mozilla.org/mozilla-central/annotate/2a193b7f395c/js/xpconnect/shell/moz.build#l7
Attachment #8544416 - Flags: review?(jorendorff)
Below are the warnings I get when building just SpiderMonkey (including jsapi-tests), using gcc 4.8.3 on Linux.

So ... should I be able to build with this patch applied? (I was able to build. Sort of confused about that.)

My configure options are: --enable-readline --disable-unified-compilation --enable-optimize --enable-debug=-g3 --enable-valgrind

----

/home/jorendorff/dev/gecko/mfbt/double-conversion/fast-dtoa.cc: In function ‘bool double_conversion::FastDtoa(double, double_conversion::FastDtoaMode, int, double_conversion::Vector<char>, int*, int*)’:
/home/jorendorff/dev/gecko/mfbt/double-conversion/fast-dtoa.cc:254:60: warning: array subscript is below array bounds [-Warray-bounds]
   while (number < kSmallPowersOfTen[exponent_plus_one_guess]) {
                                                            ^
/home/jorendorff/dev/gecko/mfbt/double-conversion/fast-dtoa.cc:254:60: warning: array subscript is below array bounds [-Warray-bounds]
   while (number < kSmallPowersOfTen[exponent_plus_one_guess]) {
                                                            ^
/home/jorendorff/dev/gecko/js/src/asmjs/AsmJSValidate.cpp: In member function ‘bool {anonymous}::FunctionCompiler::callPrivate(js::jit::MAsmJSCall::Callee, const {anonymous}::FunctionCompiler::Call&, js::jit::MIRType, js::jit::MDefinition**)’:
/home/jorendorff/dev/gecko/js/src/asmjs/AsmJSValidate.cpp:3034:28: warning: ‘kind’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         CallSiteDesc::Kind kind;
                            ^
/home/jorendorff/dev/gecko/js/src/asmjs/AsmJSValidate.cpp: In function ‘bool CheckCoercionArg({anonymous}::FunctionCompiler&, js::frontend::ParseNode*, js::AsmJSCoercion, js::jit::MDefinition**, {anonymous}::Type*)’:
/home/jorendorff/dev/gecko/js/src/asmjs/AsmJSValidate.cpp:5183:59: warning: ‘retType’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         return CheckCoercedCall(f, arg, retType, def, type);
                                                           ^
/home/jorendorff/dev/gecko/js/src/asmjs/AsmJSValidate.cpp: In function ‘bool CheckFunction({anonymous}::ModuleCompiler&, js::LifoAlloc&, js::jit::MIRGenerator**, {anonymous}::ModuleCompiler::Func**)’:
/home/jorendorff/dev/gecko/js/src/asmjs/AsmJSValidate.cpp:1662:47: warning: ‘min’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         module_->addChangeHeap(mask, min, max);
                                               ^
/home/jorendorff/dev/gecko/js/src/asmjs/AsmJSValidate.cpp:7323:20: note: ‘min’ was declared here
     uint32_t mask, min, max;
                    ^
/home/jorendorff/dev/gecko/js/src/asmjs/AsmJSValidate.cpp:7500:74: warning: ‘fn’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (!CheckFunctionSignature(m, fn, Move(sig), FunctionName(fn), &func))
                                                                          ^


/home/jorendorff/dev/gecko/js/src/jit/LiveRangeAllocator.cpp: In member function ‘const char* js::jit::Requirement::toString() const’:
/home/jorendorff/dev/gecko/js/src/jit/LiveRangeAllocator.cpp:66:12: warning: ‘n’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     cursor += n;
            ^
/home/jorendorff/dev/gecko/js/src/jit/IonBuilder.cpp: In member function ‘bool js::jit::IonBuilder::pushReferenceLoadFromTypedObject(js::jit::MDefinition*, const js::jit::LinearSum&, js::ReferenceTypeDescr::Type, js::PropertyName*)’:
/home/jorendorff/dev/gecko/js/src/jit/IonBuilder.cpp:7598:56: warning: ‘load’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     return pushTypeBarrier(load, observedTypes, barrier);
                                                        ^
/home/jorendorff/dev/gecko/js/src/jit/BaselineIC.cpp: In member function ‘virtual js::jit::ICStub* js::jit::ICGetPropCallDOMProxyNativeCompiler::getStub(js::jit::ICStubSpace*)’:
/home/jorendorff/dev/gecko/js/src/jit/BaselineIC.cpp:7727:18: warning: ‘generation’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         pcOffset_);
                  ^
In file included from /home/jorendorff/dev/gecko/js/src/jit/BaselineIC.cpp:7:0:
/home/jorendorff/dev/gecko/js/src/jit/BaselineIC.h:5058:31: warning: ‘expandoAndGeneration’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         generation_(generation)
                               ^
/home/jorendorff/dev/gecko/js/src/jit/BaselineIC.cpp:7702:27: note: ‘expandoAndGeneration’ was declared here
     ExpandoAndGeneration *expandoAndGeneration;
                           ^
/home/jorendorff/dev/gecko/js/src/jit/x64/Lowering-x64.cpp: In member function ‘virtual void js::jit::LIRGeneratorX64::visitAsmJSStoreHeap(js::jit::MAsmJSStoreHeap*)’:
/home/jorendorff/dev/gecko/js/src/jit/x64/Lowering-x64.cpp:174:22: warning: ‘lir’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     LAsmJSStoreHeap *lir;
                      ^
/home/jorendorff/dev/gecko/js/src/jsstr.cpp: In function ‘bool str_escape(JSContext*, unsigned int, JS::Value*)’:
/home/jorendorff/dev/gecko/js/src/jsstr.cpp:195:67: warning: ‘newLength’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     JSString *res = NewString<CanGC>(cx, newChars.get(), newLength);
                                                                   ^
Flags: needinfo?(cpeterson)
fast-d(In reply to Jason Orendorff [:jorendorff] from comment #1)
> /home/jorendorff/dev/gecko/mfbt/double-conversion/fast-dtoa.cc: In function
> ‘bool double_conversion::FastDtoa(double, double_conversion::FastDtoaMode,
> int, double_conversion::Vector<char>, int*, int*)’:
> /home/jorendorff/dev/gecko/mfbt/double-conversion/fast-dtoa.cc:254:60:
> warning: array subscript is below array bounds [-Warray-bounds]

This isn't in js/src, so it's unaffected by the patch here.

> /home/jorendorff/dev/gecko/js/src/asmjs/AsmJSValidate.cpp: In member
> function ‘bool
> {anonymous}::FunctionCompiler::callPrivate(js::jit::MAsmJSCall::Callee,
> const {anonymous}::FunctionCompiler::Call&, js::jit::MIRType,
> js::jit::MDefinition**)’:
> /home/jorendorff/dev/gecko/js/src/asmjs/AsmJSValidate.cpp:3034:28: warning:
> ‘kind’ may be used uninitialized in this function [-Wmaybe-uninitialized]

We specifically exempt -Wmaybe-uninitialized from being treated as an error, since it has false positives and can be annoying/non-performant to work around. See:
https://mxr.mozilla.org/mozilla-central/source/configure.in?rev=2d323b539934#6991
Flags: needinfo?(cpeterson)
Comment on attachment 8544416 [details] [diff] [review]
js-FAIL_ON_WARNINGS.patch

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

Great. Thanks for the quick response, dholbert.
Attachment #8544416 - Flags: review?(jorendorff) → review+
https://hg.mozilla.org/mozilla-central/rev/bdf7e46a6165
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
You need to log in before you can comment on or make changes to this bug.