gecko/xpcom/ds
Ehsan Akhgari 085494b95d 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
..
CharTokenizer.h
Makefile.in Bug 892861 - Remove useless -D flags 'IMPL_THEBES,_IMPL_NS_GFX,...'. r=glandium 2013-07-12 08:56:54 -04:00
moz.build Bug 893444 - wine-gecko fails to compile when using mingw-w64+winpthreads r=glandium 2013-07-16 14:08:44 +02:00
nsArray.cpp
nsArray.h
nsAtomService.cpp Bug 884061 - Part 3y: Use NS_DECL_THREADSAFE_ISUPPORTS in xpcom/, r=bsmedberg 2013-07-18 21:31:26 -05:00
nsAtomService.h Bug 884061 - Part 3y: Use NS_DECL_THREADSAFE_ISUPPORTS in xpcom/, r=bsmedberg 2013-07-18 21:31:26 -05:00
nsAtomTable.cpp 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
nsAtomTable.h Bug 798914 (part 5) - Use newly introduced mozilla::MallocSizeOf instead of nsMallocSizeOfFun. r=njn. 2013-06-23 14:03:39 +02:00
nsByteBuffer.cpp
nsByteBuffer.h
nsCharSeparatedTokenizer.h
nsCheapSets.h Bug 872127 - Part 2: Replace mozilla/StandardInteger.h with stdint.h; r=Waldo,ted 2013-07-30 10:25:31 -04:00
nsCppSharedAllocator.h Bug 892401 - Remove NEW_H. r=ted 2013-07-12 09:16:41 +09:00
nsCRT.cpp
nsCRT.h
nsExpirationTracker.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
nsHashPropertyBag.cpp Bug 884061 - Part 3y: Use NS_DECL_THREADSAFE_ISUPPORTS in xpcom/, r=bsmedberg 2013-07-18 21:31:26 -05:00
nsHashPropertyBag.h Bug 884061 - Part 3y: Use NS_DECL_THREADSAFE_ISUPPORTS in xpcom/, r=bsmedberg 2013-07-18 21:31:26 -05:00
nsHashtable.cpp Bug 884061 - Part 4: Remove nsAtomicRefcnt.h, r=jlebar 2013-07-11 15:21:45 -05:00
nsHashtable.h
nsIArray.idl
nsIAtom.idl Bug 859817 - Make NS_NewAtom return already_AddRefed; r=bz 2013-04-22 14:13:22 +03:00
nsIAtomService.idl
nsIByteBuffer.h
nsICollection.idl
nsIEnumerator.idl
nsIHashable.idl
nsIINIParser.idl
nsIMutableArray.idl
nsINIParserImpl.cpp
nsINIParserImpl.h
nsINIProcessor.js
nsINIProcessor.manifest
nsIObserver.idl
nsIObserverService.idl
nsIPersistentProperties2.idl
nsIPersistentProperties.h
nsIProperties.idl Bug 331566 - Change idl interfaces to use @throws instead of @return NS_. r=bsmedberg 2013-05-16 08:26:55 -04:00
nsIProperty.idl
nsIPropertyBag2.idl
nsIPropertyBag.idl
nsISerializable.idl
nsISimpleEnumerator.idl Bug 331566 - Change idl interfaces to use @throws instead of @return NS_. r=bsmedberg 2013-05-16 08:26:55 -04:00
nsIStringEnumerator.idl
nsISupportsArray.idl
nsISupportsIterators.idl
nsISupportsPrimitives.idl
nsIUnicharBuffer.h
nsIVariant.idl
nsIWindowsRegKey.idl
nsIWritablePropertyBag2.idl
nsIWritablePropertyBag.idl
nsManifestLineReader.h
nsMathUtils.h
nsObserverList.cpp
nsObserverList.h
nsObserverService.cpp Bug 884061 - Part 3y: Use NS_DECL_THREADSAFE_ISUPPORTS in xpcom/, r=bsmedberg 2013-07-18 21:31:26 -05:00
nsObserverService.h Bug 884061 - Part 3y: Use NS_DECL_THREADSAFE_ISUPPORTS in xpcom/, r=bsmedberg 2013-07-18 21:31:26 -05:00
nsPersistentProperties.cpp Bug 884061 - Part 3y: Use NS_DECL_THREADSAFE_ISUPPORTS in xpcom/, r=bsmedberg 2013-07-18 21:31:26 -05:00
nsPersistentProperties.h Bug 884061 - Part 3y: Use NS_DECL_THREADSAFE_ISUPPORTS in xpcom/, r=bsmedberg 2013-07-18 21:31:26 -05:00
nsProperties.cpp
nsProperties.h
nsStaticAtom.h
nsStaticNameTable.cpp Bug 872678: Mark nsStaticNameTable immutable after initialization to fix assertions r=dbaron 2013-05-21 18:22:45 +08:00
nsStaticNameTable.h
nsStringEnumerator.cpp
nsStringEnumerator.h
nsSupportsArray.cpp Bug 884061 - Part 3y: Use NS_DECL_THREADSAFE_ISUPPORTS in xpcom/, r=bsmedberg 2013-07-18 21:31:26 -05:00
nsSupportsArray.h Bug 884061 - Part 3y: Use NS_DECL_THREADSAFE_ISUPPORTS in xpcom/, r=bsmedberg 2013-07-18 21:31:26 -05:00
nsSupportsArrayEnumerator.cpp
nsSupportsArrayEnumerator.h
nsSupportsPrimitives.cpp Bug 884061 - Part 3y: Use NS_DECL_THREADSAFE_ISUPPORTS in xpcom/, r=bsmedberg 2013-07-18 21:31:26 -05:00
nsSupportsPrimitives.h Bug 884061 - Part 3y: Use NS_DECL_THREADSAFE_ISUPPORTS in xpcom/, r=bsmedberg 2013-07-18 21:31:26 -05:00
nsUnicharBuffer.cpp
nsUnicharBuffer.h
nsVariant.cpp
nsVariant.h
nsWhitespaceTokenizer.h
nsWindowsRegKey.cpp
nsWindowsRegKey.h Bug 892861 - Remove useless -D flags 'IMPL_THEBES,_IMPL_NS_GFX,...'. r=glandium 2013-07-12 08:56:54 -04:00
StringBuilder.h
TimeStamp_darwin.cpp Bug 793735 - Add functionality to create TimeStamp instances representing the process creation time, r=nfroyd 2013-03-28 11:28:09 +01:00
TimeStamp_posix.cpp Bug 793735 - Add functionality to create TimeStamp instances representing the process creation time, r=nfroyd 2013-03-28 11:28:09 +01:00
TimeStamp_windows.cpp Bug 879703 - Make TimeStampValue(_SomethingVeryRandomHere*) inline. r=tbsaunde 2013-06-06 12:59:18 +02:00
TimeStamp_windows.h Bug 879703 - Make TimeStampValue(_SomethingVeryRandomHere*) inline. r=tbsaunde 2013-06-06 12:59:18 +02:00
TimeStamp.h Bug 864447 - Move timing tracking out of APZC; r=BenWa 2013-07-10 11:26:08 +12:00