gecko/xpcom/string/public
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
..
moz.build bug 883350: move SDK_HEADERS to mozbuild (file batch #1) r=mshal 2013-07-01 17:24:53 -04:00
nsAlgorithm.h
nsAString.h
nsCharTraits.h Bug 866988 - Remove the HAVE_CPP_PARTIAL_SPECIALIZATION autoconf define, and the test for template specialization working at all. Any compiler not supporting either of these is so incredibly doomed it's not worth the pain of testing them. Plus we use both features liberally without testing these defines first, so they're basically pointless. r=ted 2013-04-13 19:04:38 -07:00
nsDependentString.h
nsDependentSubstring.h
nsEmbedString.h
nsLiteralString.h
nsPrintfCString.h
nsPromiseFlatString.h
nsReadableUtils.h Bug 845374 - Part r: Stop including nsTArray.h in nsReadableUtils.h; r=khuey 2013-03-17 08:55:16 +01:00
nsString.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
nsStringBuffer.h Bug 798914 (part 5) - Use newly introduced mozilla::MallocSizeOf instead of nsMallocSizeOfFun. r=njn. 2013-06-23 14:03:39 +02:00
nsStringFwd.h
nsStringIterator.h
nsSubstring.h
nsSubstringTuple.h
nsTDependentString.h
nsTDependentSubstring.h
nsTPromiseFlatString.h
nsTString.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
nsTSubstring.h Bug 798914 (part 5) - Use newly introduced mozilla::MallocSizeOf instead of nsMallocSizeOfFun. r=njn. 2013-06-23 14:03:39 +02:00
nsTSubstringTuple.h
nsUTF8Utils.h
nsXPCOMStrings.h Bug 852950 - Kill libxpcom. r=bsmedberg 2013-03-20 14:56:41 +01:00
nsXPIDLString.h
string-template-def-char.h
string-template-def-unichar.h
string-template-undef.h