Closed Bug 1020643 Opened 5 years ago Closed 5 years ago

GCC 4.8 build warning (treated as error) for "scoped_ptr.h:333:49: error: typedef 'U_cannot_be_an_array' locally defined but not used [-Werror=unused-local-typedefs]"

Categories

(Core :: General, defect)

All
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla32

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

STR:
 1. Build with GCC 4.8 and this in your mozconfig:
ac_add_options --enable-warnings-as-errors

ACTUAL RESULTS:
{
 0:12.79 In file included from /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/mozilla/dom/media/GetUserMediaRequest.cpp:5:0,
 0:12.79                  from /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/obj/dom/media/Unified_cpp_dom_media0.cpp:2:
 0:12.79 /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/mozilla/media/webrtc/trunk/webrtc/system_wrappers/interface/scoped_ptr.h: In constructor 'webrtc::DefaultDeleter<T>::DefaultDeleter(const webrtc::DefaultDeleter<U>&)':
 0:12.80 /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/mozilla/media/webrtc/trunk/webrtc/system_wrappers/interface/scoped_ptr.h:137:20: error: typedef 'U_ptr_must_implicitly_convert_to_T_ptr' locally defined but not used [-Werror=unused-local-typedefs]
 0:12.80                     U_ptr_must_implicitly_convert_to_T_ptr);
 0:12.80                     ^
 0:12.80 /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/mozilla/ipc/chromium/src/base/basictypes.h:179:39: note: in definition of macro 'COMPILE_ASSERT'
 0:12.80    typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
 0:12.80                                        ^
 0:12.80 /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/mozilla/media/webrtc/trunk/webrtc/system_wrappers/interface/scoped_ptr.h: In constructor 'webrtc::scoped_ptr<T, D>::scoped_ptr(webrtc::scoped_ptr<U, V>)':
 0:12.80 /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/mozilla/media/webrtc/trunk/webrtc/system_wrappers/interface/scoped_ptr.h:333:49: error: typedef 'U_cannot_be_an_array' locally defined but not used [-Werror=unused-local-typedefs]
 0:12.80      COMPILE_ASSERT(!webrtc::is_array<U>::value, U_cannot_be_an_array);
 0:12.80                                                  ^
 0:12.80 /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/mozilla/ipc/chromium/src/base/basictypes.h:179:39: note: in definition of macro 'COMPILE_ASSERT'
 0:12.80    typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
 0:12.80                                        ^
 0:12.80 /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/mozilla/media/webrtc/trunk/webrtc/system_wrappers/interface/scoped_ptr.h: In member function 'webrtc::scoped_ptr<T, D>& webrtc::scoped_ptr<T, D>::operator=(webrtc::scoped_ptr<U, V>)':
 0:12.80 /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/mozilla/media/webrtc/trunk/webrtc/system_wrappers/interface/scoped_ptr.h:351:49: error: typedef 'U_cannot_be_an_array' locally defined but not used [-Werror=unused-local-typedefs]
 0:12.80      COMPILE_ASSERT(!webrtc::is_array<U>::value, U_cannot_be_an_array);
 0:12.80                                                  ^
 0:12.80 /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/mozilla/ipc/chromium/src/base/basictypes.h:179:39: note: in definition of macro 'COMPILE_ASSERT'
 0:12.80    typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
 0:12.80                                        ^
 0:12.81 In file included from /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/mozilla/media/webrtc/trunk/webrtc/system_wrappers/interface/aligned_malloc.h:22:0,
 0:12.81                  from /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/mozilla/media/webrtc/trunk/webrtc/common_video/plane.h:14,
 0:12.81                  from /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/mozilla/media/webrtc/trunk/webrtc/common_video/interface/i420_video_frame.h:18,
 0:12.81                  from /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/mozilla/media/webrtc/trunk/webrtc/video_engine/include/vie_capture.h:22,
 0:12.81                  from ../../dist/include/MediaEngineWebRTC.h:51,
 0:12.81                  from /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/mozilla/dom/media/MediaManager.cpp:49,
 0:12.81                  from /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/obj/dom/media/Unified_cpp_dom_media0.cpp:15:
 0:12.81 /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/mozilla/media/webrtc/trunk/webrtc/system_wrappers/interface/scoped_ptr.h: In destructor 'webrtc::scoped_array<T>::~scoped_array()':
 0:12.81 /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/mozilla/media/webrtc/trunk/webrtc/system_wrappers/interface/scoped_ptr.h:591:18: error: typedef 'type_must_be_complete' locally defined but not used [-Werror=unused-local-typedefs]
 0:12.81      typedef char type_must_be_complete[sizeof(T)];
 0:12.81                   ^
 0:12.81 /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/mozilla/media/webrtc/trunk/webrtc/system_wrappers/interface/scoped_ptr.h: In member function 'void webrtc::scoped_array<T>::reset(T*)':
 0:12.81 /scratch/work/builds/mozilla-central/mozilla-central.12-12-07.08-38/mozilla/media/webrtc/trunk/webrtc/system_wrappers/interface/scoped_ptr.h:596:18: error: typedef 'type_must_be_complete' locally defined but not used [-Werror=unused-local-typedefs]
 0:12.81      typedef char type_must_be_complete[sizeof(T)];
 0:12.81                   ^
}

See also bug 851237 and bug 890539, where we fixed a bunch of warnings (errors) of this type a while back.
Attached patch fix v1Splinter Review
This uses the same strategy used in bug 890539, and in the first patch on bug 851237.
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #8434522 - Flags: review?(jwalden+bmo)
Comment on attachment 8434522 [details] [diff] [review]
fix v1

This first part fixes the COMPILE_ASSERT() usages mentioned in comment 0's buildspew, but there are still a few explicit typedefs in scoped_ptr.h.  With part 1 applied, I still get 2 errors like this (for lines 591 and 596), for explicit typedefs:
{
scoped_ptr.h:591:18: error: typedef 'type_must_be_complete' locally defined but not used [-Werror=unused-local-typedefs]
      typedef char type_must_be_complete[sizeof(T)];
}

I'll post another patch to address those.
Attachment #8434522 - Attachment description: fix v1 → part 1 v1
Summary: GCC 4.8 build warning (treated as error) for "scoped_ptr.h:596:18: error: typedef 'type_must_be_complete' locally defined but not used [-Werror=unused-local-typedefs]", due to being #included in dom/media → GCC 4.8 build warning (treated as error) for "scoped_ptr.h:333:49: error: typedef 'U_cannot_be_an_array' locally defined but not used [-Werror=unused-local-typedefs]"
Comment on attachment 8434522 [details] [diff] [review]
fix v1

Actually, I'm spinning the type_must_be_complete warning/error off into its own bug (just filed: bug 1020661), since there might be additional upstreaming complications with that part.

So, this bug is now focused on just the basictypes.h COMPILE_ASSERT issue / tweak.
Attachment #8434522 - Attachment description: part 1 v1 → fix v1
Attachment #8434522 - Flags: review?(jwalden+bmo) → review+
https://hg.mozilla.org/mozilla-central/rev/43e4fecc8251
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
You need to log in before you can comment on or make changes to this bug.