Build error on Linux 32 bit due to a warning in task_queue_libevent.cc with clang 4.0

RESOLVED FIXED in Firefox 56

Status

()

defect
P1
normal
Rank:
19
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: Ehsan, Assigned: dminor)

Tracking

(Blocks 1 bug)

unspecified
mozilla56
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox56 fixed)

Details

Attachments

(1 attachment, 1 obsolete attachment)

mozconfig:
export CC=clang
export CXX=clang++
export CCACHE_COMPRESS=""
export CCACHE_CPP2="yes"
export CFLAGS="-fcolor-diagnostics"
export CXXFLAGS="-fcolor-diagnostics"

. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-ff-opt32
mk_add_options AUTOCLOBBER=1

ac_add_options --enable-optimize
ac_add_options --disable-debug
ac_add_options --enable-profiling

error:
20:17.87 /moz/src.1347035/media/webrtc/trunk/webrtc/base/task_queue_libevent.cc:237:19: error: non-constant-expression cannot be narrowed from type 'unsigned int' to '__time_t' (aka 'long') in initializer list [-Wc++11-narrowing]
20:17.87     timeval tv = {milliseconds / 1000,
20:17.87                   ^~~~~~~~~~~~~~~~~~~
20:17.87 /moz/src.1347035/media/webrtc/trunk/webrtc/base/task_queue_libevent.cc:237:19: note: insert an explicit cast to silence this issue
20:17.87     timeval tv = {milliseconds / 1000,
20:17.87                   ^~~~~~~~~~~~~~~~~~~
20:17.87                   static_cast<__time_t>( )
Blocks: buildwarning
Duplicate of this bug: 1378600
Assignee: nobody → dminor
Rank: 19
Priority: -- → P1
Posted patch Fix warning (obsolete) — Splinter Review
Fixes the warning as the compiler suggests.
Attachment #8883934 - Flags: review?(rjesup)
You probably want to cast to time_t, not __time_t (the latter is an internal compiler specific typedef AFAIK.  Also note that this is upstream code AFAIK which we may not be allowed to modify locally.
Posted patch Fix warningSplinter Review
Thanks for pointing out I had used __time_t.

We have already had to add a cast in the following line over in Bug 1375238 to fix another clang warning, so there's a precedent for fixing these.
Attachment #8883934 - Attachment is obsolete: true
Attachment #8883934 - Flags: review?(rjesup)
Attachment #8884007 - Flags: review?(rjesup)
Attachment #8884007 - Flags: review?(rjesup) → review+
Pushed by dminor@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/2b3851740c1b
Fix build error on Linux 32 bit due to a warning in task_queue_libevent.cc with clang 4.0; r=jesup
https://hg.mozilla.org/mozilla-central/rev/2b3851740c1b
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.