Bug 856108 - Port static analyses to clang, part 2f: use MOZ_STACK_CLASS in xpcom. r=bsmedberg
authorJoshua Cranmer <Pidgeot18@gmail.com>
Thu, 11 Apr 2013 22:21:40 -0500
changeset 128544 3a772aaaa017219e47b7fe5e53a8bc5e23780e39
parent 128543 8b5bc945e72f799492685699b3aa53d2a450431b
child 128545 2a343ec4a75cafd3e7eb7c8e56f39ba2998daf22
push id26377
push userPidgeot18@gmail.com
push dateFri, 12 Apr 2013 03:27:12 +0000
treeherdermozilla-inbound@13c33b6d787d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs856108
milestone23.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 856108 - Port static analyses to clang, part 2f: use MOZ_STACK_CLASS in xpcom. r=bsmedberg
xpcom/base/VisualEventTracer.h
xpcom/components/nsComponentManager.cpp
xpcom/glue/AutoRestore.h
xpcom/glue/Monitor.h
xpcom/glue/Mutex.h
xpcom/glue/ReentrantMonitor.h
xpcom/glue/nsBaseHashtable.h
xpcom/glue/nsCOMPtr.h
xpcom/glue/nsThreadUtils.h
xpcom/string/public/nsTString.h
--- a/xpcom/base/VisualEventTracer.h
+++ b/xpcom/base/VisualEventTracer.h
@@ -164,17 +164,17 @@ void Mark(uint32_t aType, void * aItem,
 //
 // Example:
 // int class::func()
 // {
 //    AutoEventTracer tracer(this, eventtracer::eExec, eventtracer::eDone, "func");
 //
 //    do_something_taking_a_long_time();
 // }
-class NS_STACK_CLASS AutoEventTracer
+class MOZ_STACK_CLASS AutoEventTracer
 {
 public:
   AutoEventTracer(void * aInstance, 
                uint32_t aTypeOn, // MarkType marked in constructor
                uint32_t aTypeOff, // MarkType marked in destructor
                const char * aName, 
                const char * aName2 = 0 
                MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
--- a/xpcom/components/nsComponentManager.cpp
+++ b/xpcom/components/nsComponentManager.cpp
@@ -194,17 +194,17 @@ ArenaStrdup(const char *s, PLArenaPool *
 }
 
 // GetService and a few other functions need to exit their mutex mid-function
 // without reentering it later in the block. This class supports that
 // style of early-exit that MutexAutoUnlock doesn't.
 
 namespace {
 
-class NS_STACK_CLASS MutexLock
+class MOZ_STACK_CLASS MutexLock
 {
 public:
     MutexLock(SafeMutex& aMutex)
         : mMutex(aMutex)
         , mLocked(false)
     {
         Lock();
     }
--- a/xpcom/glue/AutoRestore.h
+++ b/xpcom/glue/AutoRestore.h
@@ -3,35 +3,35 @@
  * 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/. */
 
 /* functions for restoring saved values at the end of a C++ scope */
 
 #ifndef mozilla_AutoRestore_h_
 #define mozilla_AutoRestore_h_
 
+#include "mozilla/Attributes.h" // MOZ_STACK_CLASS
 #include "mozilla/GuardObjects.h"
-#include "nscore.h" // NS_STACK_CLASS
 
 namespace mozilla {
 
   /**
    * Save the current value of a variable and restore it when the object
    * goes out of scope.  For example:
    *   {
    *     AutoRestore<bool> savePainting(mIsPainting);
    *     mIsPainting = true;
    *     
    *     // ... your code here ...
    *
    *     // mIsPainting is reset to its old value at the end of this block
    *   }
    */
   template <class T>
-  class NS_STACK_CLASS AutoRestore
+  class MOZ_STACK_CLASS AutoRestore
   {
   private:
     T& mLocation;
     T mValue;
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
   public:
     AutoRestore(T& aValue MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
       : mLocation(aValue), mValue(aValue)
--- a/xpcom/glue/Monitor.h
+++ b/xpcom/glue/Monitor.h
@@ -78,17 +78,17 @@ private:
 
 /**
  * Lock the monitor for the lexical scope instances of this class are
  * bound to (except for MonitorAutoUnlock in nested scopes).
  *
  * The monitor must be unlocked when instances of this class are
  * created.
  */
-class NS_COM_GLUE NS_STACK_CLASS MonitorAutoLock
+class NS_COM_GLUE MOZ_STACK_CLASS MonitorAutoLock
 {
 public:
     MonitorAutoLock(Monitor& aMonitor) :
         mMonitor(&aMonitor)
     {
         mMonitor->Lock();
     }
     
@@ -124,17 +124,17 @@ private:
 
 /**
  * Unlock the monitor for the lexical scope instances of this class
  * are bound to (except for MonitorAutoLock in nested scopes).
  *
  * The monitor must be locked by the current thread when instances of
  * this class are created.
  */
-class NS_COM_GLUE NS_STACK_CLASS MonitorAutoUnlock
+class NS_COM_GLUE MOZ_STACK_CLASS MonitorAutoUnlock
 {
 public:
     MonitorAutoUnlock(Monitor& aMonitor) :
         mMonitor(&aMonitor)
     {
         mMonitor->Unlock();
     }
     
--- a/xpcom/glue/Mutex.h
+++ b/xpcom/glue/Mutex.h
@@ -129,17 +129,17 @@ private:
 /**
  * MutexAutoLock
  * Acquires the Mutex when it enters scope, and releases it when it leaves 
  * scope.
  *
  * MUCH PREFERRED to bare calls to Mutex.Lock and Unlock.
  */ 
 template<typename T>
-class NS_COM_GLUE NS_STACK_CLASS BaseAutoLock
+class NS_COM_GLUE MOZ_STACK_CLASS BaseAutoLock
 {
 public:
     /**
      * Constructor
      * The constructor aquires the given lock.  The destructor
      * releases the lock.
      * 
      * @param aLock A valid mozilla::Mutex* returned by 
@@ -173,17 +173,17 @@ typedef BaseAutoLock<Mutex> MutexAutoLoc
 /**
  * MutexAutoUnlock
  * Releases the Mutex when it enters scope, and re-acquires it when it leaves 
  * scope.
  *
  * MUCH PREFERRED to bare calls to Mutex.Unlock and Lock.
  */ 
 template<typename T>
-class NS_COM_GLUE NS_STACK_CLASS BaseAutoUnlock 
+class NS_COM_GLUE MOZ_STACK_CLASS BaseAutoUnlock 
 {
 public:
     BaseAutoUnlock(T& aLock MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
         mLock(&aLock)
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
         NS_ASSERTION(mLock, "null lock");
         mLock->Unlock();
--- a/xpcom/glue/ReentrantMonitor.h
+++ b/xpcom/glue/ReentrantMonitor.h
@@ -160,17 +160,17 @@ private:
 
 /**
  * ReentrantMonitorAutoEnter
  * Enters the ReentrantMonitor when it enters scope, and exits it when
  * it leaves scope.
  *
  * MUCH PREFERRED to bare calls to ReentrantMonitor.Enter and Exit.
  */ 
-class NS_COM_GLUE NS_STACK_CLASS ReentrantMonitorAutoEnter
+class NS_COM_GLUE MOZ_STACK_CLASS ReentrantMonitorAutoEnter
 {
 public:
     /**
      * Constructor
      * The constructor aquires the given lock.  The destructor
      * releases the lock.
      * 
      * @param aReentrantMonitor A valid mozilla::ReentrantMonitor*. 
--- a/xpcom/glue/nsBaseHashtable.h
+++ b/xpcom/glue/nsBaseHashtable.h
@@ -324,17 +324,17 @@ protected:
   
   static size_t s_SizeOfStub(PLDHashEntryHdr *entry,
                              nsMallocSizeOfFun mallocSizeOf,
                              void *arg);
 };
 
 class nsCycleCollectionTraversalCallback;
 
-struct NS_STACK_CLASS nsBaseHashtableCCTraversalData
+struct MOZ_STACK_CLASS nsBaseHashtableCCTraversalData
 {
   nsBaseHashtableCCTraversalData(nsCycleCollectionTraversalCallback& aCallback,
                                  const char* aName,
                                  uint32_t aFlags)
   : mCallback(aCallback),
     mName(aName),
     mFlags(aFlags)
   {
--- a/xpcom/glue/nsCOMPtr.h
+++ b/xpcom/glue/nsCOMPtr.h
@@ -242,17 +242,17 @@ class nsCOMPtr_helper
   |nsQueryInterface| could have been implemented as an |nsCOMPtr_helper| to
   avoid adding specialized machinery in |nsCOMPtr|, But |do_QueryInterface|
   is called often enough that the codesize savings are big enough to
   warrant the specialcasing.
 */
 
 class
   NS_COM_GLUE
-  NS_STACK_CLASS
+  MOZ_STACK_CLASS
 nsQueryInterface MOZ_FINAL
   {
     public:
       explicit
       nsQueryInterface( nsISupports* aRawPtr )
           : mRawPtr(aRawPtr)
         {
           // nothing else to do here
--- a/xpcom/glue/nsThreadUtils.h
+++ b/xpcom/glue/nsThreadUtils.h
@@ -496,17 +496,17 @@ private:
 };
 
 /**
  * Thread priority in most operating systems affect scheduling, not IO.  This
  * helper is used to set the current thread to low IO priority for the lifetime
  * of the created object.  You can only use this low priority IO setting within
  * the context of the current thread.
  */
-class NS_STACK_CLASS nsAutoLowPriorityIO
+class MOZ_STACK_CLASS nsAutoLowPriorityIO
 {
 public:
   nsAutoLowPriorityIO();
   ~nsAutoLowPriorityIO();
 
 private:
   bool lowIOPrioritySet;
 #if defined(XP_MACOSX)
--- a/xpcom/string/public/nsTString.h
+++ b/xpcom/string/public/nsTString.h
@@ -428,17 +428,17 @@ class nsTFixedString_CharT : public nsTS
    * allocation.  It is normally not a good idea to use this class on the
    * heap, because it will allocate space which may be wasted if the string
    * it contains is significantly smaller or any larger than 64 characters.
    *
    * NAMES:
    *   nsAutoString for wide characters
    *   nsAutoCString for narrow characters
    */
-class NS_STACK_CLASS nsTAutoString_CharT : public nsTFixedString_CharT
+class nsTAutoString_CharT : public nsTFixedString_CharT
   {
     public:
 
       typedef nsTAutoString_CharT    self_type;
 
     public:
 
         /**
@@ -590,17 +590,17 @@ class nsTXPIDLString_CharT : public nsTS
    *    
    *    void some_function()
    *    {
    *      nsXPIDLCString blah;
    *      GetBlah(getter_Copies(blah));
    *      // ...
    *    }
    */
-class NS_STACK_CLASS nsTGetterCopies_CharT
+class MOZ_STACK_CLASS nsTGetterCopies_CharT
   {
     public:
       typedef CharT char_type;
 
       nsTGetterCopies_CharT(nsTSubstring_CharT& str)
         : mString(str), mData(nullptr) {}
 
       ~nsTGetterCopies_CharT()