Bug 817176: Add "(void)" cast to silence GCC unused-var warning for an intentionally-unused variable. r=bsmith
authorDaniel Holbert <dholbert@cs.stanford.edu>
Fri, 30 Nov 2012 16:59:42 -0800
changeset 114677 e0f8cc72dd06361c46b166b67abddeb7618b1997
parent 114676 6bb1e540c73f6f6d14b49016429c881727838878
child 114678 d3ad98d05b2aa7c1bebeb22b3e52bb65ce60db83
push id23926
push userryanvm@gmail.com
push dateSat, 01 Dec 2012 15:27:30 +0000
treeherdermozilla-central@ecdf0e332f17 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmith
bugs817176
milestone20.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 817176: Add "(void)" cast to silence GCC unused-var warning for an intentionally-unused variable. r=bsmith
security/manager/ssl/src/nsSmartCardMonitor.cpp
--- a/security/manager/ssl/src/nsSmartCardMonitor.cpp
+++ b/security/manager/ssl/src/nsSmartCardMonitor.cpp
@@ -2,16 +2,19 @@
  * 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 "nspr.h"
 
 #include "pk11func.h"
 #include "nsNSSComponent.h"
 #include "nsSmartCardMonitor.h"
 #include "nsSmartCardEvent.h"
+#include "mozilla/unused.h"
+
+using namespace mozilla;
 
 //
 // The SmartCard monitoring thread should start up for each module we load
 // that has removable tokens. This code calls an NSS function which waits
 // until there is a change in the token state. NSS uses the 
 // C_WaitForSlotEvent() call in PKCS #11 if the module implements the call,
 // otherwise NSS will poll the token in a loop with a delay of 'latency' 
 // between polls. Note that the C_WaitForSlotEvent() may wake up on any type
@@ -21,18 +24,16 @@
 // Once the event is found, It is passed to nsNSSComponent for dispatching
 // on the UI thread, and forwarding to any interested listeners (including
 // javascript).
 //
 
 
 static NS_DEFINE_CID(kNSSComponentCID, NS_NSSCOMPONENT_CID);
 
-#include <assert.h>
-
 // self linking and removing double linked entry
 // adopts the thread it is passed.
 class SmartCardThreadEntry {
 public:
  SmartCardThreadEntry *next;
  SmartCardThreadEntry *prev;
  SmartCardThreadEntry **head;
  SmartCardMonitoringThread *thread;
@@ -68,33 +69,34 @@ SmartCardThreadList::~SmartCardThreadLis
   while (head) {
     delete head;
   }
 }
 
 void
 SmartCardThreadList::Remove(SECMODModule *aModule)
 {
-  SmartCardThreadEntry *current;
-  for (current = head; current; current=current->next) {
+  for (SmartCardThreadEntry *current = head; current; current = current->next) {
     if (current->thread->GetModule() == aModule) {
       // NOTE: automatically stops the thread and dequeues it from the list
       delete current;
       return;
     }
   }
 }
 
-// adopts the thread passwd to it. Starts the thread as well
+// adopts the thread passed to it. Starts the thread as well
 nsresult
 SmartCardThreadList::Add(SmartCardMonitoringThread *thread)
 {
   SmartCardThreadEntry *current = new SmartCardThreadEntry(thread, head, nullptr,
                                                            &head);
-  // OK to forget current here, it's on the list
+  // OK to forget current here, it's on the list.
+  unused << current;
+
   return thread->Start();
 }
 
 
 // We really should have a Unity PL Hash function...
 static PLHashNumber
 unity(const void *key) { return PLHashNumber(NS_PTR_TO_INT32(key)); }