Commit Graph

33 Commits

Author SHA1 Message Date
Ehsan Akhgari
bd52bd3f4e Bug 1118486 - Part 1: Use = delete instead of MOZ_DELETE directly; r=Waldo
Most of this patch (with the exception of dom/bindings/Codegen.py) was
generated by the following bash script:

#!/bin/bash

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*/.hg*" \
       ! -wholename "*/.git*" \
       ! -wholename "obj-*" \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_DELETE '= delete'
2015-01-08 23:19:05 -05:00
Ehsan Akhgari
85b0d6dac6 Bug 867348 - Part 2: Apply MOZ_NO_ARITHMETIC_EXPR_IN_ARGUMENT to CheckedInt's constructor; r=jrmuizel,cpearce
Note that the analysis currently just looks at the AST subtree of the
function call site and is therefore unable to correctly deal with cases
such as the last two hunks of the change to OggCodecState.cpp.  Fixing
the analysis to deal with that would be very difficult, so we currently
adjust the code so that it compiles.  The first hunk in that file though
is a real bug that this analysis found.
2014-12-18 15:27:05 -05:00
Ryan VanderMeulen
c51c7d8b9a Backed out changesets acb4dd16755c and 40768f723990 (bug 867348) for static analysis bustage.
CLOSED TREE
2014-12-18 15:59:51 -05:00
Ehsan Akhgari
eef6ef9805 Bug 867348 - Part 2: Apply MOZ_NO_ARITHMETIC_EXPR_IN_ARGUMENT to CheckedInt's constructor; r=jrmuizel
Note that the analysis currently just looks at the AST subtree of the
function call site and is therefore unable to correctly deal with cases
such as the last two hunks of the change to OggCodecState.cpp.  Fixing
the analysis to deal with that would be very difficult, so we currently
adjust the code so that it compiles.  The first hunk in that file though
is a real bug that this analysis found.

--HG--
extra : rebase_source : b44bb6d90d95551d860e0b5a1afcf2bb35cde084
2014-12-18 15:27:05 -05:00
Matthew Gregan
002c42bb98 Bug 1097512 - Allow using compound operators where the LHS and RHS are both CheckedInt<T>. r=jwalden+bmo 2014-11-14 16:13:23 +13:00
Nicholas Nethercote
9ea0bb6b8a Bug 1041914 - Convert the fourth quarter of MFBT to Gecko style. r=Ms2ger.
--HG--
extra : rebase_source : 588fa9c0d1e819e1826835c4ef4a1428a927bf93
2014-07-22 20:54:41 -07:00
Nicholas Nethercote
ab815d0c3b Bug 1036789 - Convert the third quarter of MFBT to Gecko style. r=Ms2ger.
--HG--
extra : rebase_source : 668cd394806203ddfa34bd4f226335ff26c846b5
2014-07-10 19:10:17 -07:00
Nicholas Nethercote
eea4b77322 Bug 1014377 - Convert the first quarter of MFBT to Gecko style. r=froydnj.
--HG--
extra : rebase_source : b3b2da775e2c0e8a6ecbed70e7bd0c8f7af67b47
2014-05-29 22:40:33 -07:00
Benoit Jacob
e195e8f5d3 Bug 987274 - Add IntegerTypeTraits.h to MFBT for additional integer traits and helpers that don't have type_traits equivalents - r=Waldo 2014-04-01 09:38:42 -04:00
Xidorn Quan
e43c49d443 Bug 980698 - Rename shadowing parameters. r=Waldo 2014-03-12 08:42:39 -04:00
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
Ehsan Akhgari
3717325909 Bug 872127 - Part 2: Replace mozilla/StandardInteger.h with stdint.h; r=Waldo,ted 2013-07-30 10:25:31 -04:00
Ms2ger
f4ac238f7a Bug 896341 - Update include guards and modelines in MFBT; r=Waldo 2013-07-24 09:41:39 +02:00
Emanuel Hoogeveen
6dc713326b Bug 886128 - Fix various clang warnings and some potential bugs in nonstandard configurations. r=nnethercote,terrence.
--HG--
extra : rebase_source : 0d833ecc9879f5d9fd0a28f9b4eca7793d01aa40
2013-06-24 21:32:05 -07:00
Jeff Gilbert
9ec81d1921 Bug 881980 - Allow casting CheckedInts to other CheckedInt types. - r=bjacob,waldo 2013-06-14 15:19:40 -07:00
Jeff Gilbert
ec449b8b0b Bug 874764 - Add CheckedInt support for operator%. - r=bjacob,waldo 2013-06-14 15:19:30 -07:00
Benoit Jacob
9a704bce1c Bug 869194 - CheckedInt should consistently reject unsupported types - r=Waldo 2013-05-08 17:25:15 -04:00
Benoit Jacob
b489efa372 Bug 869685 - Reintroduce long long support in CheckedInt - r=Waldo 2013-05-08 17:25:03 -04:00
Benoit Jacob
aa302576ad Bug 849667 - Fix/simplify CheckedInt's use-outside-of-MFBT setup - r=Waldo 2013-03-12 15:40:29 -04:00
Jeff Walden
b7bf374ed3 Bug 849666 - Make CheckedInt<T>::operator-() not depend on undefined behavior when negating minimum signed values, and add a test for this. Patch is something of a tag-team effort by bjacob and me. r=bjacob 2013-03-11 18:45:22 -07:00
Jeff Walden
115fda56e6 Bug 847521 - Allow CheckedInt<signed char> in addition to char/unsigned char. char != signed char (but is guaranteed to have the same representation as either signed char or unsigned char, for backwards-compatibility reasons), so we have to handle signed char as a third character type. r=bjacob
--HG--
rename : content/html/content/src/HTMLObjectElement.h => content/html/content/src/HTMLObjectElement.cpp
extra : rebase_source : d07d72b78fcbae31483d726703b3605561295684
2013-03-01 21:49:25 -08:00
Benoit Jacob
70bb650cf8 Bug 784309 - CheckedInt.h Intel C++ compilation issue - r=Ms2ger 2012-11-02 11:30:40 -04:00
Benoit Jacob
15b31c23df Bug 768538 - CheckedInt: HasSignBit should return bool - r=Ms2ger 2012-07-08 11:44:22 -04:00
Benoit Jacob
8c74d60e26 Bug 768538 - CheckedInt: code simplification; remove the separate operator/ implementation - r=Ms2ger 2012-07-08 11:25:24 -04:00
Benoit Jacob
48592034dc Bug 768570 - Fix all the warnings in CheckedInt - r=jwalden 2012-07-05 10:13:31 -04:00
Benoit Jacob
457f2bf3b9 Bug 768538 - 1/2 - Fix undefined behavior in CheckedInt - r=jwalden 2012-07-05 10:13:13 -04:00
Rafael Ávila de Espíndola
cf3f87b0ac Bug 759208 - CheckedInt.h depends on undefined value of signed arithmetic. r=bjacob. 2012-05-29 12:48:26 -04:00
Benoit Jacob
0afae2df4f Bug 732875 - Further CheckedInt tweaks - r=Ms2ger,jwalden 2012-05-17 10:07:24 -04:00
Dão Gottwald
0a2cf5a8ce Backed out changeset 45ef0e7b2426 2012-05-17 16:48:06 +02:00
Benoit Jacob
b7699a5247 Bug 732875 - Further CheckedInt tweaks - r=Ms2ger,jwalden 2012-05-17 10:07:24 -04:00
Benoit Jacob
6598b33e08 Bug 732875 - 8/8 - move CheckedInt to MFBT, enable unit tests in mfbt/tests - r=jwalden
--HG--
rename : xpcom/ds/CheckedInt.h => mfbt/CheckedInt.h
2012-05-14 15:50:20 -04:00
Ed Morley
d38b916352 Backout 345ae68f15f4, b3b40121ac8d, 0d18b7a246d7, 9dbb6064ab58, dee9d7fa8eb6, 63eec6bfa948, 323c6be7cfe8 & f4aac7523a48 (bug 732875) for compilation failures 2012-05-14 21:05:24 +01:00
Benoit Jacob
43d4449b09 Bug 732875 - 8/8 - move CheckedInt to MFBT, enable unit tests in mfbt/tests - r=jwalden
--HG--
rename : xpcom/ds/CheckedInt.h => mfbt/CheckedInt.h
2012-05-14 15:50:20 -04:00