Bug 1499899 - Fix some win64 clang-cl -Wunused-* warnings. r=waldo
☠☠ backed out by f22b804a7c08 ☠ ☠
authorJeff Gilbert <jgilbert@mozilla.com>
Wed, 17 Oct 2018 15:51:01 -0700
changeset 499143 35bae18d7d671b179bcc547319b246576ccc044d
parent 499142 6d09c69fd7e699339628f3c398445318ffe59efc
child 499144 f22b804a7c08da4f006f5c61c676d28663989edc
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswaldo
bugs1499899
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1499899 - Fix some win64 clang-cl -Wunused-* warnings. r=waldo Differential Revision: https://phabricator.services.mozilla.com/D9052 MozReview-Commit-ID: BJjNqGqO5Bd
CLOBBER
accessible/windows/msaa/IUnknownImpl.h
security/sandbox/win/SandboxInitialization.cpp
toolkit/mozapps/update/updater/updater.cpp
tools/profiler/core/shared-libraries-win32.cc
widget/windows/nsWindow.cpp
widget/windows/nsWindowGfx.cpp
xpcom/windbgdlg/windbgdlg.cpp
--- a/CLOBBER
+++ b/CLOBBER
@@ -17,10 +17,9 @@
 #
 # Modifying this file will now automatically clobber the buildbot machines \o/
 #
 
 # Are you updating CLOBBER because you think it's needed for your WebIDL
 # changes to stick? As of bug 928195, this shouldn't be necessary! Please
 # don't change CLOBBER for WebIDL changes any more.
 
-
-Merge day clobber
\ No newline at end of file
+Bug 1499899 - Fix some win64 clang-cl -Wunused-* warnings. (change to IUnknownImpl)
--- a/accessible/windows/msaa/IUnknownImpl.h
+++ b/accessible/windows/msaa/IUnknownImpl.h
@@ -15,22 +15,16 @@
 // 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__
-#define ATTRIBUTE_UNUSED __attribute__((unused))
-#else
-#define ATTRIBUTE_UNUSED
-#endif
-
 namespace mozilla {
 namespace a11y {
 
 class AutoRefCnt
 {
 public:
   AutoRefCnt() : mValue(0) {}
 
@@ -78,17 +72,18 @@ virtual HRESULT STDMETHODCALLTYPE QueryI
 #define IMPL_IUNKNOWN_QUERY_HEAD(Class)                                        \
 STDMETHODIMP                                                                   \
 Class::QueryInterface(REFIID aIID, void** aInstancePtr)                        \
 {                                                                              \
   if (!aInstancePtr)                                                           \
     return E_INVALIDARG;                                                       \
   *aInstancePtr = nullptr;                                                     \
                                                                                \
-  HRESULT hr ATTRIBUTE_UNUSED = E_NOINTERFACE;
+  HRESULT hr = E_NOINTERFACE;                                                  \
+  (void)hr;
 
 #define IMPL_IUNKNOWN_QUERY_TAIL                                               \
   return hr;                                                                   \
 }
 
 #define IMPL_IUNKNOWN_QUERY_TAIL_AGGREGATED(Member)                            \
   return Member->QueryInterface(aIID, aInstancePtr);                           \
 }
--- a/security/sandbox/win/SandboxInitialization.cpp
+++ b/security/sandbox/win/SandboxInitialization.cpp
@@ -5,16 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "SandboxInitialization.h"
 
 #include "base/memory/ref_counted.h"
 #include "nsWindowsDllInterceptor.h"
 #include "sandbox/win/src/sandbox_factory.h"
 #include "mozilla/sandboxing/permissionsService.h"
+#include "mozilla/Unused.h"
 
 namespace mozilla {
 namespace sandboxing {
 
 typedef BOOL(WINAPI* CloseHandle_func) (HANDLE hObject);
 static WindowsDllInterceptor::FuncHookType<CloseHandle_func> stub_CloseHandle;
 
 typedef BOOL(WINAPI* DuplicateHandle_func)(HANDLE hSourceProcessHandle,
@@ -153,17 +154,17 @@ InitializeBrokerServices()
 
   // Comment below copied from Chromium code.
   // Precreate the desktop and window station used by the renderers.
   // IMPORTANT: This piece of code needs to run as early as possible in the
   // process because it will initialize the sandbox broker, which requires
   // the process to swap its window station. During this time all the UI
   // will be broken. This has to run before threads and windows are created.
   scoped_refptr<sandbox::TargetPolicy> policy = brokerServices->CreatePolicy();
-  sandbox::ResultCode result = policy->CreateAlternateDesktop(true);
+  Unused << policy->CreateAlternateDesktop(true);
 
   return brokerServices;
 }
 
 sandbox::BrokerServices*
 GetInitializedBrokerServices()
 {
   static sandbox::BrokerServices* sInitializedBrokerServices =
--- a/toolkit/mozapps/update/updater/updater.cpp
+++ b/toolkit/mozapps/update/updater/updater.cpp
@@ -410,16 +410,17 @@ get_full_path(const NS_tchar *relpath)
 /**
  * Converts a full update path into a relative path; reverses get_full_path.
  *
  * @param  fullpath
  *         The absolute path to convert into a relative path.
  * return pointer to the location within fullpath where the relative path starts
  *        or fullpath itself if it already looks relative.
  */
+/* Unused.
 static const NS_tchar*
 get_relative_path(const NS_tchar *fullpath)
 {
   // If the path isn't absolute, just return it as-is.
 #ifdef XP_WIN
   if (fullpath[1] != ':' && fullpath[2] != '\\') {
 #else
   if (fullpath[0] != '/') {
@@ -431,16 +432,17 @@ get_relative_path(const NS_tchar *fullpa
 
   // If the path isn't long enough to be absolute, return it as-is.
   if (NS_tstrlen(fullpath) <= NS_tstrlen(prefix)) {
     return fullpath;
   }
 
   return fullpath + NS_tstrlen(prefix) + 1;
 }
+*/
 
 /**
  * Gets the platform specific path and performs simple checks to the path. If
  * the path checks don't pass nullptr will be returned.
  *
  * @param  line
  *         The line from the manifest that contains the path.
  * @param  isdir
--- a/tools/profiler/core/shared-libraries-win32.cc
+++ b/tools/profiler/core/shared-libraries-win32.cc
@@ -71,21 +71,16 @@ static bool GetPdbInfo(uintptr_t aStart,
 
   // The PDB file name could be different from module filename, so report both
   // e.g. The PDB for C:\Windows\SysWOW64\ntdll.dll is wntdll.pdb
   *aPdbName = debugInfo->pdbFileName;
 
   return true;
 }
 
-static bool IsDashOrBraces(char c)
-{
-  return c == '-' || c == '{' || c == '}';
-}
-
 static nsCString
 GetVersion(WCHAR* dllPath)
 {
   DWORD infoSize = GetFileVersionInfoSizeW(dllPath, nullptr);
   if (infoSize == 0) {
     return EmptyCString();
   }
 
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -59,16 +59,17 @@
 #include "gfxPlatform.h"
 #include "gfxPrefs.h"
 #include "mozilla/AutoRestore.h"
 #include "mozilla/Logging.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/MiscEvents.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/TouchEvents.h"
+#include "mozilla/Unused.h"
 
 #include "mozilla/ipc/MessageChannel.h"
 #include <algorithm>
 #include <limits>
 
 #include "nsWindow.h"
 #include "nsAppRunner.h"
 
@@ -5220,17 +5221,17 @@ nsWindow::ProcessMessage(UINT msg, WPARA
         sCanQuit = abortQuit ? TRI_FALSE : TRI_TRUE;
       }
       *aRetValue = sCanQuit ? TRUE : FALSE;
       result = true;
       break;
 
     case MOZ_WM_STARTA11Y:
 #if defined(ACCESSIBILITY)
-      (void*)GetAccessible();
+      Unused << GetAccessible();
       result = true;
 #else
       result = false;
 #endif
       break;
 
     case WM_ENDSESSION:
     case MOZ_WM_APP_QUIT:
--- a/widget/windows/nsWindowGfx.cpp
+++ b/widget/windows/nsWindowGfx.cpp
@@ -119,39 +119,16 @@ nsWindow::GetRegionToPaint(bool aForceFu
     }
     LayoutDeviceIntRegion rgn(WinUtils::ConvertHRGNToRegion(paintRgn));
     ::DeleteObject(paintRgn);
     return rgn;
   }
   return LayoutDeviceIntRegion(WinUtils::ToIntRect(ps.rcPaint));
 }
 
-#define WORDSSIZE(x) ((x).width * (x).height)
-static bool
-EnsureSharedSurfaceSize(IntSize size)
-{
-  IntSize screenSize;
-  screenSize.height = GetSystemMetrics(SM_CYSCREEN);
-  screenSize.width = GetSystemMetrics(SM_CXSCREEN);
-
-  if (WORDSSIZE(screenSize) > WORDSSIZE(size))
-    size = screenSize;
-
-  if (WORDSSIZE(screenSize) < WORDSSIZE(size))
-    NS_WARNING("Trying to create a shared surface larger than the screen");
-
-  if (!sSharedSurfaceData || (WORDSSIZE(size) > WORDSSIZE(sSharedSurfaceSize))) {
-    sSharedSurfaceSize = size;
-    sSharedSurfaceData =
-      MakeUniqueFallible<uint8_t[]>(WORDSSIZE(sSharedSurfaceSize) * 4);
-  }
-
-  return !sSharedSurfaceData;
-}
-
 nsIWidgetListener* nsWindow::GetPaintListener()
 {
   if (mDestroyCalled)
     return nullptr;
   return mAttachedWidgetListener ? mAttachedWidgetListener : mWidgetListener;
 }
 
 void nsWindow::ForcePresent()
--- a/xpcom/windbgdlg/windbgdlg.cpp
+++ b/xpcom/windbgdlg/windbgdlg.cpp
@@ -80,17 +80,16 @@ wWinMain(HINSTANCE  hInstance, HINSTANCE
    * set a "word" to 0x3 to abort (die).
    */
   DWORD regType;
   DWORD regValue = -1;
   DWORD regLength = sizeof regValue;
   HKEY hkeyCU, hkeyLM;
   RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyCU);
   RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyLM);
-  int argc =0;
   for (int i = __argc - 1; regValue == (DWORD)-1 && i; --i) {
     bool ok = false;
     if (hkeyCU)
       ok = RegQueryValueExW(hkeyCU, __wargv[i], 0, &regType, (LPBYTE)&regValue, &regLength) == ERROR_SUCCESS;
     if (!ok && hkeyLM)
       ok = RegQueryValueExW(hkeyLM, __wargv[i], 0, &regType, (LPBYTE)&regValue, &regLength) == ERROR_SUCCESS;
     if (!ok)
       regValue = -1;