Bug 1498151 - part 1: Make IUnknownImpl.h define ATTRIBUTE_UNUSED as __attribute__((unused)) when built with clang r=Jamie
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 23 Oct 2018 07:13:33 +0000
changeset 491045 d0d1ccfded5ddefa99bb206ffac2235b457abffe
parent 491044 3b8a9abe2766c4bdc68c143416a3aafe85083be4
child 491046 e61ca916da324a49717d173224c8f54e30097bbe
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersJamie
bugs1498151
milestone65.0a1
Bug 1498151 - part 1: Make IUnknownImpl.h define ATTRIBUTE_UNUSED as __attribute__((unused)) when built with clang r=Jamie IMPL_IUNKNOWN_QUERY_HEAD defines HRESULT as hr. However, if its user uses IMPL_IUNKNOWN_QUERY_TAIL_AGGREGATED, it's never used. Therefore, it causes unused variable warning. hr is defined with ATTRIBUTE_UNUSED. However, this is empty when built with clang. IUnknownImpl.h already defines ATTRIBUTE_UNUSED as __attribute__((unused)) when built with gcc. So, same warnings should be prevented when built with clang too. Differential Revision: https://phabricator.services.mozilla.com/D8510
accessible/windows/msaa/IUnknownImpl.h
--- a/accessible/windows/msaa/IUnknownImpl.h
+++ b/accessible/windows/msaa/IUnknownImpl.h
@@ -15,17 +15,17 @@
 // Avoid warning C4509 like "nonstandard extension used:
 // 'AccessibleWrap::[acc_getName]' uses SEH and 'name' has destructor.
 // At this point we're catching a crash which is of much greater
 // importance than the missing dereference for the nsCOMPtr<>
 #ifdef _MSC_VER
 #pragma warning( disable : 4509 )
 #endif
 
-#ifdef __GNUC__
+#if defined(__GNUC__) || defined(__clang__)
 #define ATTRIBUTE_UNUSED __attribute__((unused))
 #else
 #define ATTRIBUTE_UNUSED
 #endif
 
 namespace mozilla {
 namespace a11y {