Bug 997026 - Part 1: Fix clang -Wunused-const-variable warnings in xpcom. r=froydnj
authorChris Peterson <cpeterson@mozilla.com>
Tue, 15 Apr 2014 00:24:13 -0700
changeset 197440 1a3585a1b4a5b22cf55fcba2e81404200cca59eb
parent 197439 70bb7587900c1a619ab3514e78999976f08d1c11
child 197441 2bfdbce8d055ab966b86b4d6e4b99c0dfd568e44
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs997026
milestone31.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 997026 - Part 1: Fix clang -Wunused-const-variable warnings in xpcom. r=froydnj
xpcom/glue/nsID.cpp
xpcom/glue/nsVoidArray.cpp
--- a/xpcom/glue/nsID.cpp
+++ b/xpcom/glue/nsID.cpp
@@ -1,23 +1,17 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
 #include "nsID.h"
 #include "prprf.h"
 #include "nsMemory.h"
 
-static const char gIDFormat[] = 
-  "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}";
-
-static const char gIDFormat2[] = 
-  "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x";
-
-
 /**
  * Multiplies the_int_var with 16 (0x10) and adds the value of the
  * hexadecimal digit the_char. If it fails it returns false from
  * the function it's used in.
  */
 
 #define ADD_HEX_CHAR_TO_INT_OR_RETURN_FALSE(the_char, the_int_var) \
     the_int_var = (the_int_var << 4) + the_char; \
@@ -46,18 +40,18 @@ static const char gIDFormat2[] =
 
 /**
  * Parses a hyphen from the char_pointer string. If there is no hyphen there
  * the function returns false from the function it's used in. The
  * char_pointer is advanced one step.
  */
 
  #define PARSE_HYPHEN(char_pointer)   if(*(char_pointer++) != '-') return false
-    
-/* 
+
+/*
  * Turns a {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} string into
  * an nsID. It can also handle the old format without the { and }.
  */
 
 bool nsID::Parse(const char *aIDStr)
 {
   /* Optimized for speed */
   if(!aIDStr) {
@@ -76,29 +70,32 @@ bool nsID::Parse(const char *aIDStr)
   int i;
   for(i=0; i<2; i++)
     PARSE_CHARS_TO_NUM(aIDStr, m3[i], 2);
   PARSE_HYPHEN(aIDStr);
   while(i < 8) {
     PARSE_CHARS_TO_NUM(aIDStr, m3[i], 2);
     i++;
   }
-  
+
   return expectFormat1 ? *aIDStr == '}' : true;
 }
 
 #ifndef XPCOM_GLUE_AVOID_NSPR
 
+static const char gIDFormat[] =
+  "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}";
+
 /*
  * Returns an allocated string in {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
  * format. The string is allocated with NS_Alloc and should be freed by
  * the caller.
  */
 
-char *nsID::ToString() const 
+char *nsID::ToString() const
 {
   char *res = (char*)NS_Alloc(NSID_LENGTH);
 
   if (res != nullptr) {
     PR_snprintf(res, NSID_LENGTH, gIDFormat,
                 m0, (uint32_t) m1, (uint32_t) m2,
                 (uint32_t) m3[0], (uint32_t) m3[1], (uint32_t) m3[2],
                 (uint32_t) m3[3], (uint32_t) m3[4], (uint32_t) m3[5],
--- a/xpcom/glue/nsVoidArray.cpp
+++ b/xpcom/glue/nsVoidArray.cpp
@@ -12,31 +12,29 @@
 #include "nsISupportsImpl.h" // for nsTraceRefcnt
 #include "nsAlgorithm.h"
 
 /**
  * Grow the array by at least this many elements at a time.
  */
 static const int32_t kMinGrowArrayBy = 8;
 static const int32_t kMaxGrowArrayBy = 1024;
-static const int32_t kAutoClearCompactSizeFactor = 4;
 
 /**
  * This is the threshold (in bytes) of the mImpl struct, past which
  * we'll force the array to grow geometrically
  */
 static const int32_t kLinearThreshold = 24 * sizeof(void *);
 
 /**
  * Compute the number of bytes requires for the mImpl struct that will
  * hold |n| elements.
  */
 #define SIZEOF_IMPL(n_) (sizeof(Impl) + sizeof(void *) * ((n_) - 1))
 
-
 /**
  * Compute the number of elements that an mImpl struct of |n| bytes
  * will hold.
  */
 #define CAPACITYOF_IMPL(n_) ((((n_) - sizeof(Impl)) / sizeof(void *)) + 1)
 
 #if DEBUG_VOIDARRAY
 #define MAXVOID 10