Closed Bug 1378600 Opened 7 years ago Closed 7 years ago

error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'time_t' with android/clang

Categories

(Core :: WebRTC, defect)

Unspecified
Android
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1378412

People

(Reporter: m_kato, Unassigned)

References

Details

When using android/clang, it cannot build task_queue_libevent.cc due to the following error.

 0:02.81 In file included from /mozilla/objdir-android/media/webrtc/trunk/webrtc/base/base_rtc_task_queue/Unified_cpp_trunk_webrtc_base0.cpp:11:
 0:02.81 /mozilla/mobile/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]
 0:02.81     timeval tv = {milliseconds / 1000,
 0:02.81                   ^~~~~~~~~~~~~~~~~~~
 0:02.81 /mozilla/mobile/media/webrtc/trunk/webrtc/base/task_queue_libevent.cc:237:19: note: insert an explicit cast to silence this issue
 0:02.81     timeval tv = {milliseconds / 1000,
 0:02.81                   ^~~~~~~~~~~~~~~~~~~
 0:02.81                   static_cast<time_t>( )
 0:02.83 1 error generated.
 0:02.83 /mozilla/mobile/config/rules.mk:1010: recipe for target 'Unified_cpp_trunk_webrtc_base0.o' failed
 0:02.83 make[5]: *** [Unified_cpp_trunk_webrtc_base0.o] Error 1


Android's timeval in time.h is the following.

struct timeval {
 time_t tv_sec;
 suseconds_t tv_usec;
};
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.