gecko-dev/xpcom/glue
Ehsan Akhgari 2824b29025 Bug 895322 - Part 1: Replace the usages of MOZ_STATIC_ASSERT with C++11 static_assert; r=Waldo
This patch was mostly generated by running the following scripts on the codebase, with some
manual changes made afterwards:

# static_assert.sh
#!/bin/bash
# Command to convert an NSPR integer type to the equivalent standard integer type

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*/.hg*" \
       ! -wholename "obj-ff-dbg*" \
       ! -name nsXPCOMCID.h \
       ! -name prtypes.h \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.cc" \
         -o -iname "*.mm" \) | \
    xargs -n 1 `dirname $0`/assert_replacer.py #sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_STATIC_ASSERT static_assert
hg rev --no-backup mfbt/Assertions.h \
                   media/webrtc/signaling/src/sipcc/core/includes/ccapi.h \
                   modules/libmar/src/mar_private.h \
                   modules/libmar/src/mar.h


# assert_replacer.py
#!/usr/bin/python

import sys
import re

pattern = re.compile(r"\bMOZ_STATIC_ASSERT\b")

def replaceInPlace(fname):
  print fname
  f = open(fname, "rw+")
  lines = f.readlines()
  for i in range(0, len(lines)):
    while True:
      index = re.search(pattern, lines[i])
      if index != None:
        index = index.start()
        lines[i] = lines[i][0:index] + "static_assert" + lines[i][index+len("MOZ_STATIC_ASSERT"):]
        for j in range(i + 1, len(lines)):
          if lines[j].find("                 ", index) == index:
            lines[j] = lines[j][0:index] + lines[j][index+4:]
          else:
            break
      else:
        break
  f.seek(0, 0)
  f.truncate()
  f.write("".join(lines))
  f.close()

argc = len(sys.argv)
for i in range(1, argc):
  replaceInPlace(sys.argv[i])

--HG--
extra : rebase_source : 4b4a4047d82f2c205b9fad8d56dfc3f1afc0b045
2013-07-18 13:59:53 -04:00
..
nomozalloc Bug 894941 - Move SSE.{h,cpp} and arm.{h,cpp} to mozglue/build/. r=glandium 2013-07-26 18:46:31 +02:00
standalone bug 789919, (snow-white) make addref/release of CCable objects faster by removing indirect refcnt increase/decrease, r=mccr8, test changes r=ehsan 2013-07-09 13:30:58 -04:00
staticruntime Bug 894941 - Move SSE.{h,cpp} and arm.{h,cpp} to mozglue/build/. r=glandium 2013-07-26 18:46:31 +02:00
tests/gtest backout bug 886526 because it probably made us use a lot more memory to link on windows 2013-07-29 11:03:21 -04:00
AppData.cpp
AppData.h
AutoRestore.h Bug 856108 - Port static analyses to clang, part 2f: use MOZ_STACK_CLASS in xpcom. r=bsmedberg 2013-04-11 22:21:40 -05:00
BlockingResourceBase.cpp Remove some null-checks due to infallible new, no bug, r=me 2013-06-26 14:04:13 -07:00
BlockingResourceBase.h bug 852379 - remove unneeded prlock.h includes r=Ms2ger 2013-03-16 22:46:40 -04:00
CondVar.h
DeadlockDetector.cpp
DeadlockDetector.h
FileUtils.cpp Bug 860827 - Move TEMP_FAILURE_RETRY to FileUtils.h and rename it. r=tbsaunde 2013-05-09 13:42:12 -04:00
FileUtils.h Bug 890144 - Add copedCloseFile to reduce memory leak. r=jlebar 2013-07-23 08:30:55 -04:00
GenericFactory.cpp Bug 884061 - Part 3y: Use NS_DECL_THREADSAFE_ISUPPORTS in xpcom/, r=bsmedberg 2013-07-18 21:31:26 -05:00
GenericFactory.h Bug 884061 - Part 3y: Use NS_DECL_THREADSAFE_ISUPPORTS in xpcom/, r=bsmedberg 2013-07-18 21:31:26 -05:00
GenericModule.cpp Bug 884061 - Part 3y: Use NS_DECL_THREADSAFE_ISUPPORTS in xpcom/, r=bsmedberg 2013-07-18 21:31:26 -05:00
IntentionalCrash.h Bug 857640 - Fix to IntentionalCrash.h when getenv(XPCOM_MEM_BLOAT_LOG) returns NULL. r=bsmedberg 2013-04-08 14:35:31 -04:00
Makefile.in bug 883350: move SDK_HEADERS to mozbuild (file batch #1) r=mshal 2013-07-01 17:24:53 -04:00
Monitor.h Bug 856108 - Port static analyses to clang, part 2f: use MOZ_STACK_CLASS in xpcom. r=bsmedberg 2013-04-11 22:21:40 -05:00
Mutex.h Bug 832609 - Add mozilla::OffTheBooksMutex, which is just like mozilla::Mutex, except it's not leak-checked. r=khuey 2013-05-24 13:10:47 -04:00
Observer.h
ReentrantMonitor.h Bug 856108 - Port static analyses to clang, part 2f: use MOZ_STACK_CLASS in xpcom. r=bsmedberg 2013-04-11 22:21:40 -05:00
moz.build Bug 894941 - Move SSE.{h,cpp} and arm.{h,cpp} to mozglue/build/. r=glandium 2013-07-26 18:46:31 +02:00
nsArrayEnumerator.cpp
nsArrayEnumerator.h
nsArrayUtils.cpp
nsArrayUtils.h
nsBaseHashtable.h Bug 798914 (part 5) - Use newly introduced mozilla::MallocSizeOf instead of nsMallocSizeOfFun. r=njn. 2013-06-23 14:03:39 +02:00
nsCOMArray.cpp Bug 798914 (part 6) - Followup: move MemoryReporting.h include after the cpp's own header include. r=njn. 2013-06-30 18:26:39 +02:00
nsCOMArray.h Bug 798914 (part 5) - Use newly introduced mozilla::MallocSizeOf instead of nsMallocSizeOfFun. r=njn. 2013-06-23 14:03:39 +02:00
nsCOMPtr.cpp
nsCOMPtr.h Bug 895322 - Part 1: Replace the usages of MOZ_STATIC_ASSERT with C++11 static_assert; r=Waldo 2013-07-18 13:59:53 -04:00
nsCRTGlue.cpp Bug 867769 - NS_MakeRandomString generates the same string when called twice within the same second. r=bsmedberg 2013-05-02 14:50:11 -07:00
nsCRTGlue.h
nsCategoryCache.cpp
nsCategoryCache.h
nsClassHashtable.h Bug 849654: Kill nsClassHashtableMT. r=bsmedberg 2013-03-12 13:33:40 -07:00
nsClassInfoImpl.cpp Bug 890714 - Fix mixed line endings. r=joe, r=jesup 2013-07-08 16:33:15 -04:00
nsComponentManagerUtils.cpp
nsComponentManagerUtils.h
nsCycleCollectionNoteChild.h
nsCycleCollectionNoteRootCallback.h Bug 873111 - Statically enforce root/child phase separation in cycle collector graph building. r=smaug 2013-05-20 13:08:11 -07:00
nsCycleCollectionParticipant.cpp Bug 877762 - GC: Post-barrier cycle collector participants - 7 Convert most JSObect to use Heap<T> (ex. XBL) r=bz 2013-06-18 11:00:38 +01:00
nsCycleCollectionParticipant.h bug 789919, (snow-white) make addref/release of CCable objects faster by removing indirect refcnt increase/decrease, r=mccr8, test changes r=ehsan 2013-07-09 13:30:58 -04:00
nsCycleCollectionTraversalCallback.h Bug 873111 - Statically enforce root/child phase separation in cycle collector graph building. r=smaug 2013-05-20 13:08:11 -07:00
nsCycleCollectorUtils.cpp
nsCycleCollectorUtils.h Bug 895845 - Temporary ASan workaround in NS_IsMainThread. r=mccr8 2013-07-27 01:37:19 +02:00
nsDataHashtable.h Bug 849654: Kill nsDataHashtableMT. r=bsmedberg 2013-03-12 14:26:57 -07:00
nsDebug.h
nsDeque.cpp Bug 875557 - Make nsDeque infallible by default. r=bsmedberg 2013-05-28 16:57:54 -07:00
nsDeque.h Bug 875557 - Make nsDeque infallible by default. r=bsmedberg 2013-05-28 16:57:54 -07:00
nsEnumeratorUtils.cpp bug 877850 - fix static constructors in xpcom/ r=jlebar 2013-05-30 17:20:02 -04:00
nsEnumeratorUtils.h
nsHashKeys.h Bug 892401 - Remove NEW_H. r=ted 2013-07-12 09:16:41 +09:00
nsIClassInfoImpl.h Bug 898916 - Properly align statically allocated classinfo objects. r=bsmedberg 2013-07-30 08:57:28 +09:00
nsID.cpp
nsID.h
nsIInterfaceRequestorUtils.cpp
nsIInterfaceRequestorUtils.h
nsINIParser.cpp
nsINIParser.h
nsISupportsImpl.cpp
nsISupportsImpl.h Bug 884061 - Part 2: Add NS_DECL_THREADSAFE_ISUPPORTS, r=jlebar. 2013-07-13 20:28:54 -05:00
nsISupportsUtils.h Bug 888323 - Stop including prtime.h in nsrootidl.idl. r=ehsan 2013-07-04 00:56:26 +09:00
nsIWeakReferenceUtils.h Bug 859817 - Remove implicit conversions from raw pointer to already_AddRefed; r=Ms2ger 2013-04-22 14:15:59 +03:00
nsInterfaceHashtable.h Bug 896385 - Use nsInterfaceHashtable for nsXBLPrototypeBinding::mInterfaceTable; r=mrbkap 2013-07-24 09:39:56 +02:00
nsJSThingHashtable.h Bug 877762 - GC: Post-barrier cycle collector participants - 3 Add hashtable type that stores Heap<T> values r=jlebar 2013-06-18 11:00:37 +01:00
nsMemory.cpp
nsMemory.h Bug 849086: Remove unused *_CLASSNAME defines. r=bsmedberg 2013-03-15 10:52:10 -07:00
nsProxyRelease.cpp
nsProxyRelease.h Bug 883360 - Remove bool operator and nsMainThreadPtrHolder conversion. r=bsmedberg 2013-07-19 12:53:12 -04:00
nsQuickSort.cpp Bug 872497 - Remove problematic "optimization" in NS_QuickSort. r=jlebar 2013-05-18 15:16:02 -04:00
nsQuickSort.h
nsRefPtrHashtable.h Bug 849654: Kill nsRefPtrHashtableMT. r=bsmedberg 2013-04-03 09:54:35 -07:00
nsServiceManagerUtils.h
nsStringAPI.cpp
nsStringAPI.h Bug 895322 - Part 1: Replace the usages of MOZ_STATIC_ASSERT with C++11 static_assert; r=Waldo 2013-07-18 13:59:53 -04:00
nsStringGlue.h
nsTArray-inl.h Bug 895322 - Part 1: Replace the usages of MOZ_STATIC_ASSERT with C++11 static_assert; r=Waldo 2013-07-18 13:59:53 -04:00
nsTArray.cpp
nsTArray.h Bug 895322 - Part 1: Replace the usages of MOZ_STATIC_ASSERT with C++11 static_assert; r=Waldo 2013-07-18 13:59:53 -04:00
nsTArrayForwardDeclare.h Bug 872127 - Part 2: Replace mozilla/StandardInteger.h with stdint.h; r=Waldo,ted 2013-07-30 10:25:31 -04:00
nsTHashtable.cpp
nsTHashtable.h Bug 892401 - Remove NEW_H. r=ted 2013-07-12 09:16:41 +09:00
nsTObserverArray.cpp
nsTObserverArray.h Bug 798914 (part 5) - Use newly introduced mozilla::MallocSizeOf instead of nsMallocSizeOfFun. r=njn. 2013-06-23 14:03:39 +02:00
nsTPriorityQueue.h
nsTWeakRef.h
nsTextFormatter.cpp Bug 895141 - Remove useless prlong.h inclusions from the tree; r=jcranmer 2013-07-18 12:06:38 -04:00
nsTextFormatter.h
nsThreadIDs.h
nsThreadUtils.cpp Bug 884061 - Part 3y: Use NS_DECL_THREADSAFE_ISUPPORTS in xpcom/, r=bsmedberg 2013-07-18 21:31:26 -05:00
nsThreadUtils.h Bug 895322 - Part 1: Replace the usages of MOZ_STATIC_ASSERT with C++11 static_assert; r=Waldo 2013-07-18 13:59:53 -04:00
nsTraceRefcnt.h
nsVersionComparator.cpp Bug 872127 - Part 2: Replace mozilla/StandardInteger.h with stdint.h; r=Waldo,ted 2013-07-30 10:25:31 -04:00
nsVersionComparator.h
nsVoidArray.cpp Bug 798914 (part 5) - Use newly introduced mozilla::MallocSizeOf instead of nsMallocSizeOfFun. r=njn. 2013-06-23 14:03:39 +02:00
nsVoidArray.h Bug 872127 - Part 2: Replace mozilla/StandardInteger.h with stdint.h; r=Waldo,ted 2013-07-30 10:25:31 -04:00
nsWeakReference.cpp
nsWeakReference.h
nsXPTCUtils.h
objs.mk Bug 894941 - Move SSE.{h,cpp} and arm.{h,cpp} to mozglue/build/. r=glandium 2013-07-26 18:46:31 +02:00
pldhash.cpp Bug 798914 (part 5) - Use newly introduced mozilla::MallocSizeOf instead of nsMallocSizeOfFun. r=njn. 2013-06-23 14:03:39 +02:00
pldhash.h Bug 798914 (part 5) - Use newly introduced mozilla::MallocSizeOf instead of nsMallocSizeOfFun. r=njn. 2013-06-23 14:03:39 +02:00
unused.cpp
unused.h