gecko-dev/xpcom/build
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
..
BinaryPath.h Bug 796119 - part 2: don't #include prtypes.h in xpcom/ unless absolutely necessary; r=ehsan 2012-10-01 17:01:01 -04:00
FileLocation.cpp Bug 883729 - Fix -Wnull-conversion warnings in xpcom. r=bsmedberg 2013-06-13 20:57:47 -07:00
FileLocation.h Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg 2012-08-22 11:56:38 -04:00
FrozenFunctions.cpp 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
Makefile.in Bug 889787 - Define XP_LINUX globally; r=ted 2013-07-16 17:10:10 -04:00
Omnijar.cpp Bug 773151: Convert nsCAutoString->nsAutoCString CLOSED TREE r=bsmedberg 2012-09-01 22:35:17 -04:00
Omnijar.h Bug 777292 part 2 - Change all nsnull to nullptr 2012-07-30 17:20:58 +03:00
ServiceList.h Bug 772807 - Clean up editor/ includes with include-what-you-use; r=ehsan 2012-07-13 09:33:42 +03:00
Services.cpp Bug 859817 - Remove implicit conversions from raw pointer to already_AddRefed; r=Ms2ger 2013-04-22 14:15:59 +03:00
Services.h Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
XPCOM.h Bug 856238 - Remove unused includes of the obsolete nsISupportsArray and nsIEnumerator. r=Neil, r=bsmedberg 2013-04-08 14:35:31 -04:00
XPCOMModule.inc Backed out changesets 073791f33ab7 and 7ac5779a426c (bug 859756) for causing intermittent Windows build failures. 2013-05-17 17:30:20 -04:00
mach_override.c Bug 797340 - Upgrade mach_override. r=ted. 2012-10-03 10:10:08 -04:00
mach_override.h Bug 732173 - poison write during shutdown in a debug build. r=ted. 2012-07-03 09:15:34 -04:00
moz.build bug 883350: move SDK_HEADERS to mozbuild (file batch #1) r=mshal 2013-07-01 17:24:53 -04:00
mozPoisonWrite.h Bug 840758 - Get the profile directory earlier. r=BenWa. 2013-02-13 13:53:21 -05:00
mozPoisonWriteBase.cpp Bug 846471 - Poison NtWriteFile. r=BenWa. 2013-03-06 10:11:57 -05:00
mozPoisonWriteBase.h Bug 846471 - Poison NtWriteFile. r=BenWa. 2013-03-06 10:11:57 -05:00
mozPoisonWriteMac.cpp Bug 846471 - Poison NtWriteFile. r=BenWa. 2013-03-06 10:11:57 -05:00
mozPoisonWriteStub.cpp Bug 840758 - Get the profile directory earlier. r=BenWa. 2013-02-13 13:53:21 -05:00
mozPoisonWriteWin.cpp Bug 848020 - Do we really have to poison NtFlushBuffersFile? r=BenWa. 2013-03-07 15:28:05 -05:00
nsXPCOM.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
nsXPCOMCID.h Bug 806473 - Expose MemoryInfoDumper methods via a nsIMemoryInfoDumper service. r=jlebar 2012-10-29 20:41:14 -04:00
nsXPCOMCIDInternal.h Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
nsXPCOMPrivate.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
nsXPCOMStrings.cpp Bug 791906: Replace NSPR integer limit constants with stdint ones; r=ehsan 2012-09-28 01:57:33 -05:00
nsXPComInit.cpp Bug 896124 - Implement a JS_Init() JSAPI function, to be called before any other JSAPI operations (except JS_SetICUMemoryFunctions) are performed, to centralize whole-engine initialization tasks. r=bsmedberg for the XPCOM bits, r=luke for the JS bits 2013-07-19 20:14:34 -07:00
nsXREAppData.h Bug 872127 - Part 2: Replace mozilla/StandardInteger.h with stdint.h; r=Waldo,ted 2013-07-30 10:25:31 -04:00
nsXULAppAPI.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
perfprobe.cpp Bug 806618 - rewrite PR_NewLogModule calls to not generate static initializers; r=ehsan 2012-10-29 19:32:10 -04:00
perfprobe.h Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
xpcom_alpha.def Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
xrecore.h Bug 892861 - Remove useless -D flags 'IMPL_THEBES,_IMPL_NS_GFX,...'. r=glandium 2013-07-12 08:56:54 -04:00