Closed
Bug 1242847
Opened 8 years ago
Closed 8 years ago
unreachable-code warning doubles the build time
Categories
(Firefox Build System :: General, defect)
Tracking
(firefox44 unaffected, firefox45 unaffected, firefox46 affected, firefox47 affected)
RESOLVED
WORKSFORME
Tracking | Status | |
---|---|---|
firefox44 | --- | unaffected |
firefox45 | --- | unaffected |
firefox46 | --- | affected |
firefox47 | --- | affected |
People
(Reporter: TYLin, Assigned: cpeterson)
References
Details
I got a lot of "Warning: -Wunreachable-code" [1] since bug 1235717 landed, and it doubles my build time from 20 minutes to 40 minutes. For now I can revert bug 1235717 to restore my build time to normal. I'm using Xcode 7.2. $ clang --version Apple LLVM version 7.0.2 (clang-700.1.81) Target: x86_64-apple-darwin15.3.0 Thread model: posix [1] https://pastebin.mozilla.org/8857624
Assignee | ||
Comment 1•8 years ago
|
||
Thanks for reporting this problem. I'll look into it. 2x is obviously an unacceptable slowdown! :) I use the same clang version, yet I don't see these -Wunreachable-code warnings. Are you compiling with `ac_add_options --disable-debug`? Can you share your mozconfig options?
Assignee: nobody → cpeterson
Blocks: Wunreachable-code
status-firefox44:
--- → unaffected
status-firefox45:
--- → unaffected
status-firefox46:
--- → affected
status-firefox47:
--- → affected
No longer depends on: Wunreachable-code
Flags: needinfo?(tlin)
Reporter | ||
Comment 2•8 years ago
|
||
Sure. My mozconfig is here. mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-firefox mk_add_options AUTOCLOBBER=1 ac_add_options --with-ccache ac_add_options --enable-application=browser ac_add_options --enable-debug ac_add_options --enable-debug-symbols ac_add_options --enable-tests ac_add_options --disable-optimize export ENABLE_MARIONETTE=1 # For distcc export CC="clang -target x86_64-apple-darwin" export CXX="clang++ -target x86_64-apple-darwin"
Flags: needinfo?(tlin) → needinfo?(cpeterson)
Assignee | ||
Comment 3•8 years ago
|
||
Very strange. I am not able to reproduce these warnings. Do they go away if you disable distcc? How much does distcc speed up your build? From the warnings in your pastebin output, it looks like clang is complaining about expanded MOZ_ASSERT macros in the already-preprocessed code that distcc is distributing to be compiled. If these warnings happened on treeherder, the build would break because we enable --enable-warnings-as-errors. I'm not using distcc. On my MacBook Pro, my clean build time is about 30 minutes, with or without -Wunreachable-code enabled.
Flags: needinfo?(cpeterson)
Reporter | ||
Comment 4•8 years ago
|
||
I've tried to disable distcc and remove "export CC" and "export CXX" from my config. The warning did go away. If not using distcc, my clean build time on my MBP 13" is about 30 minutes, too. With distcc, it takes at most 20 minutes. It probably doesn't worth debugging distcc for the extra 10 minutes on clean build :) Chris, thank you so much for your prompt help!
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
Assignee | ||
Comment 5•8 years ago
|
||
It sounds like distcc is a big improvement for your clean builds. I guess you can keep a local patch to revert bug 1235717 when you build. Do these warnings go away if you compile with `ac_add_options --enable-optimize`? Perhaps clang won't complain about MOZ_ASSERT's unreachable `while (0)` code if it knows it will be optimized away.
Assignee | ||
Comment 6•8 years ago
|
||
Here is one of the warnings you reported for posterity, since the pastebin data will disappear in a day: 5:26.75 In file included from /Users/tlin/Projects/gecko-dev/obj-firefox/dom/geolocation/Unified_cpp_dom_geolocation0.cpp:20: 5:26.75 In file included from /Users/tlin/Projects/gecko-dev/dom/geolocation/nsGeoPosition.cpp:9: 5:26.75 In file included from /Users/tlin/Projects/gecko-dev/obj-firefox/dist/include/mozilla/dom/PositionBinding.h:9: 5:26.75 In file included from /Users/tlin/Projects/gecko-dev/obj-firefox/dist/include/mozilla/dom/BindingDeclarations.h:22: 5:26.75 Warning: -Wunreachable-code in /Users/tlin/Projects/gecko-dev/obj-firefox/dist/include/mozilla/dom/DOMString.h: will never be executed 5:26.75 /Users/tlin/Projects/gecko-dev/obj-firefox/dist/include/mozilla/dom/DOMString.h:50:585: warning: will never be executed [-Wunreachable-code] 5:26.75 do { static_assert(mozilla::detail::AssertionConditionType<decltype(!mString || !mStringBuffer)>::isValid, "invalid assertion condition"); if ((__builtin_expect(!!(!(!mString || !mStringBuffer)), 0))) { MOZ_ReportAssertionFailure("!mString || !mStringBuffer" " (" "Shouldn't have both present!" ")", "/Users/tlin/Projects/gecko-dev/obj-firefox/dist/include/mozilla/dom/DOMString.h", 51); CrashReporter::AnnotateMozCrashReason("" "MOZ_RELEASE_ASSERT(" "!mString || !mStringBuffer" ") (" "Shouldn't have both present!" ")"); do { *((volatile int*) __null) = 51; ::abort(); } while (0); } } while (0);
Reporter | ||
Comment 7•8 years ago
|
||
(In reply to Chris Peterson [:cpeterson] from comment #5) > It sounds like distcc is a big improvement for your clean builds. I guess > you can keep a local patch to revert bug 1235717 when you build. Yes. I can do this! > Do these warnings go away if you compile with `ac_add_options > --enable-optimize`? Perhaps clang won't complain about MOZ_ASSERT's > unreachable `while (0)` code if it knows it will be optimized away. No. Those warnings still show with `ac_add_options --enable-optimize`. BTW, My distcc slave is Ubuntu which uses clang-3.4. If I upgrade it to be clang-3.5 or clang-3.6, distcc stops working. I cannot verify whether newer clang version fixes this issue or not.
Updated•6 years ago
|
Product: Core → Firefox Build System
You need to log in
before you can comment on or make changes to this bug.
Description
•