Mats Palmgren
336a8fd5fc
Bug 1356936 - Use __builtin_add/sub/mul_overflow() where available to optimize CheckedInt. r=waldo,ehsan
...
MozReview-Commit-ID: ARw6zNelpSk
2017-09-21 18:24:10 +02:00
JW Wang
baf584d148
Bug 1350790 - Add constexpr to CheckedInt. r=froydnj
...
MozReview-Commit-ID: KNJQcYiBlHM
2017-03-27 10:59:31 +08:00
Ehsan Akhgari
c910cbd9c5
Bug 1188204 - Fix more constructors in MFBT; r=froydnj
2015-07-28 12:24:39 -04:00
Ehsan Akhgari
a7f747ec15
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
d605781da6
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
58ed70696e
Backed out changesets acb4dd16755c and 40768f723990 (bug 867348) for static analysis bustage.
...
CLOSED TREE
2014-12-18 15:59:51 -05:00
Ehsan Akhgari
17f8f4dd78
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.
2014-12-18 15:27:05 -05:00
Matthew Gregan
7561f07a58
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
c0e8a3e8c5
Bug 1041914 - Convert the fourth quarter of MFBT to Gecko style. r=Ms2ger.
2014-07-22 20:54:41 -07:00
Nicholas Nethercote
e286b23cb3
Bug 1036789 - Convert the third quarter of MFBT to Gecko style. r=Ms2ger.
2014-07-10 19:10:17 -07:00
Nicholas Nethercote
3f9a355d7e
Bug 1014377 - Convert the first quarter of MFBT to Gecko style. r=froydnj.
2014-05-29 22:40:33 -07:00
Benoit Jacob
8138d324ae
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
663cd76ee3
Bug 980698 - Rename shadowing parameters. r=Waldo
2014-03-12 08:42:39 -04:00
Ehsan Akhgari
1ab9c7bcb4
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])
2013-07-18 13:59:53 -04:00
Ehsan Akhgari
6d396d8bcb
Bug 872127 - Part 2: Replace mozilla/StandardInteger.h with stdint.h; r=Waldo,ted
2013-07-30 10:25:31 -04:00
Ms2ger
d1c985e201
Bug 896341 - Update include guards and modelines in MFBT; r=Waldo
2013-07-24 09:41:39 +02:00
Emanuel Hoogeveen
eac5c02514
Bug 886128 - Fix various clang warnings and some potential bugs in nonstandard configurations. r=nnethercote,terrence.
2013-06-24 21:32:05 -07:00
Jeff Gilbert
784867259a
Bug 881980 - Allow casting CheckedInts to other CheckedInt types. - r=bjacob,waldo
2013-06-14 15:19:40 -07:00
Jeff Gilbert
d8f157b7c7
Bug 874764 - Add CheckedInt support for operator%. - r=bjacob,waldo
2013-06-14 15:19:30 -07:00
Benoit Jacob
fd6b47b49a
Bug 869194 - CheckedInt should consistently reject unsupported types - r=Waldo
2013-05-08 17:25:15 -04:00
Benoit Jacob
928f87215f
Bug 869685 - Reintroduce long long support in CheckedInt - r=Waldo
2013-05-08 17:25:03 -04:00
Benoit Jacob
796526a307
Bug 849667 - Fix/simplify CheckedInt's use-outside-of-MFBT setup - r=Waldo
2013-03-12 15:40:29 -04:00
Jeff Walden
f33bf72725
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
b78bb6b238
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
2013-03-01 21:49:25 -08:00
Benoit Jacob
0244c2c4db
Bug 784309 - CheckedInt.h Intel C++ compilation issue - r=Ms2ger
2012-11-02 11:30:40 -04:00
Benoit Jacob
6ba8c06c83
Bug 768538 - CheckedInt: HasSignBit should return bool - r=Ms2ger
2012-07-08 11:44:22 -04:00
Benoit Jacob
4afb7a75a3
Bug 768538 - CheckedInt: code simplification; remove the separate operator/ implementation - r=Ms2ger
2012-07-08 11:25:24 -04:00
Benoit Jacob
bf618321ce
Bug 768570 - Fix all the warnings in CheckedInt - r=jwalden
2012-07-05 10:13:31 -04:00
Benoit Jacob
95e0cd53b7
Bug 768538 - 1/2 - Fix undefined behavior in CheckedInt - r=jwalden
2012-07-05 10:13:13 -04:00
Rafael Ávila de Espíndola
9ac60f819d
Bug 759208 - CheckedInt.h depends on undefined value of signed arithmetic. r=bjacob.
2012-05-29 12:48:26 -04:00
Benoit Jacob
e835c061a6
Bug 732875 - Further CheckedInt tweaks - r=Ms2ger,jwalden
2012-05-17 10:07:24 -04:00
Dão Gottwald
8449251224
Backed out changeset 45ef0e7b2426
2012-05-17 16:48:06 +02:00
Benoit Jacob
4fea6505af
Bug 732875 - Further CheckedInt tweaks - r=Ms2ger,jwalden
2012-05-17 10:07:24 -04:00
Benoit Jacob
757f9307e3
Bug 732875 - 8/8 - move CheckedInt to MFBT, enable unit tests in mfbt/tests - r=jwalden
2012-05-14 15:50:20 -04:00
Ed Morley
b8a9f687c8
Backout 345ae68f15f4, b3b40121ac8d, 0d18b7a246d7, 9dbb6064ab58, dee9d7fa8eb6, 63eec6bfa948, 323c6be7cfe8 & f4aac7523a48 (bug 732875) for compilation failures
2012-05-14 21:05:24 +01:00
Benoit Jacob
25f87b5ed0
Bug 732875 - 8/8 - move CheckedInt to MFBT, enable unit tests in mfbt/tests - r=jwalden
2012-05-14 15:50:20 -04:00