Граф коммитов

52 Коммитов

Автор SHA1 Сообщение Дата
Nika Layzell b2dc7057a5 Bug 1743012 - Add missing `constexpr` qualifiers in `CheckedInt`, r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D132173
2021-11-26 19:18:49 +00:00
Sylvestre Ledru 0aa6f03cf3 Bug 1519636 - Reformat recent changes to the Google coding style r=jgilbert
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D67574

--HG--
extra : moz-landing-system : lando
2020-04-05 13:34:58 +00:00
André Bargull 13e9ad3137 Bug 1625138 - Part 14: Replace mozilla::IsSigned with std::is_signed. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D68369

--HG--
extra : moz-landing-system : lando
2020-03-28 13:57:15 +00:00
André Bargull 1e4d8b891e Bug 1625138 - Part 4: Replace mozilla::MakeUnsigned with std::make_unsigned. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D68358

--HG--
extra : moz-landing-system : lando
2020-03-28 13:57:12 +00:00
Boris Zbarsky acaa2133b1 Bug 1616684. Remove implicit integer conversion in CheckedInt constructor r=froydnj
When I try to enable -Wconversion, CheckedInt triggers it because it has an
implicit type conversion in its templated two-arg constructor.

That constructor doesn't really need to be templated, as far as I can tell.

Differential Revision: https://phabricator.services.mozilla.com/D63384

--HG--
extra : moz-landing-system : lando
2020-02-20 14:16:03 +00:00
Emilio Cobos Álvarez 278b36aafb Bug 1607816 - Replace mozilla::{Max, Min}Value with std::numeric_limits. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D59153

--HG--
extra : moz-landing-system : lando
2020-01-08 16:30:40 +00:00
Simon Giesecke 3137f60858 Bug 1602749 - Make CheckedInt operations constexpr. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D56682

--HG--
extra : moz-landing-system : lando
2019-12-16 10:22:57 +00:00
Jean-Yves Avenard f558e67dd0 Bug 1548409 - Use MOZ_DIAGNOSTIC_ASSERT. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D29587

--HG--
extra : moz-landing-system : lando
2019-05-02 13:24:31 +00:00
Alex Gaynor 289ff19535 Bug 1533777 - use a release assert in CheckedInt::value; r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D22970

--HG--
extra : source : f9c865b93ecd4d184b50de9a5ca9da15928c27a8
extra : amend_source : 40e1cb24abdde9a49f113ed012d19d830e3a5237
2019-03-27 13:30:23 +00:00
Sebastian Hengst bf943c64c1 Backed out changeset f9c865b93ecd (bug 1533777) because it landed with the wrong patch author. a=backout
--HG--
extra : amend_source : 7e92c9fe511586260e66a739bcecdb8d2e6579df
2019-03-26 21:38:23 +01:00
Sebastian Hengst 380873f20a Bug 1533777 - use a release assert in CheckedInt::value; r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D22970

--HG--
extra : moz-landing-system : lando
2019-03-27 13:30:23 +00:00
Coroiu Cristina c5833bc810 Backed out changeset 2f2a20c16289 (bug 1533777) for crashing youtube on request by jya a=backout 2019-03-13 08:52:21 +02:00
Alex Gaynor ca0c1fc191 Bug 1533777 - use a release assert in CheckedInt::value; r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D22970

--HG--
extra : moz-landing-system : lando
2019-03-11 13:55:28 +00:00
Ehsan Akhgari e5e885ae31 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
# ignore-this-changeset

--HG--
extra : amend_source : 7221c8d15a765df71171099468e7c7faa648f37c
extra : histedit_source : a0cce6015636202bff09e35a13f72e03257a7695
2019-01-18 10:16:18 +01:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Steve Fink b5b78d5525 Bug 1321014 - Respect MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS for the purpose of identifying GC types and pointers, r=jonco
--HG--
extra : topic : hazard
extra : rebase_source : bdaf0ae60a6b45c9d44294aa9c2bc31a8811bdbd
extra : source : c7b32ffa822e353b5479b6224194e3cdfd135e65
2018-07-20 18:36:20 -07:00
Mats Palmgren b00f969bb5 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 729d92dc53 Bug 1350790 - Add constexpr to CheckedInt. r=froydnj
MozReview-Commit-ID: KNJQcYiBlHM

--HG--
extra : rebase_source : 51609420239d195aaf416c1a18ff028894638775
extra : source : 96678f32ac0a09d911088df18fe4e4e95ba52930
2017-03-27 10:59:31 +08:00
Ehsan Akhgari 91324a3c5a Bug 1188204 - Fix more constructors in MFBT; r=froydnj 2015-07-28 12:24:39 -04:00
Ehsan Akhgari 4354953b4f 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 1813ae2d33 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 3d7d4af71d Backed out changesets acb4dd16755c and 40768f723990 (bug 867348) for static analysis bustage.
CLOSED TREE
2014-12-18 15:59:51 -05:00
Ehsan Akhgari 2e80a88820 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 52f69d5963 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 6c3f5d7b8e 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 2a0942be41 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 7e98d1c248 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 006b370dc5 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 9cbc0d3fe9 Bug 980698 - Rename shadowing parameters. r=Waldo 2014-03-12 08:42:39 -04:00
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
Ehsan Akhgari ef4b479714 Bug 872127 - Part 2: Replace mozilla/StandardInteger.h with stdint.h; r=Waldo,ted 2013-07-30 10:25:31 -04:00
Ms2ger 51f391870b Bug 896341 - Update include guards and modelines in MFBT; r=Waldo 2013-07-24 09:41:39 +02:00
Emanuel Hoogeveen c1374919d0 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 3049ca7c76 Bug 881980 - Allow casting CheckedInts to other CheckedInt types. - r=bjacob,waldo 2013-06-14 15:19:40 -07:00
Jeff Gilbert 75ab2ff473 Bug 874764 - Add CheckedInt support for operator%. - r=bjacob,waldo 2013-06-14 15:19:30 -07:00
Benoit Jacob 3701ad32bf Bug 869194 - CheckedInt should consistently reject unsupported types - r=Waldo 2013-05-08 17:25:15 -04:00
Benoit Jacob b6ecd61d8f Bug 869685 - Reintroduce long long support in CheckedInt - r=Waldo 2013-05-08 17:25:03 -04:00
Benoit Jacob cbd3607515 Bug 849667 - Fix/simplify CheckedInt's use-outside-of-MFBT setup - r=Waldo 2013-03-12 15:40:29 -04:00
Jeff Walden 36bb5830c0 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 f22ad604ac 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 17335c2b9e Bug 784309 - CheckedInt.h Intel C++ compilation issue - r=Ms2ger 2012-11-02 11:30:40 -04:00
Benoit Jacob 91e33ba3c6 Bug 768538 - CheckedInt: HasSignBit should return bool - r=Ms2ger 2012-07-08 11:44:22 -04:00
Benoit Jacob 1f740b8204 Bug 768538 - CheckedInt: code simplification; remove the separate operator/ implementation - r=Ms2ger 2012-07-08 11:25:24 -04:00
Benoit Jacob da5aee1123 Bug 768570 - Fix all the warnings in CheckedInt - r=jwalden 2012-07-05 10:13:31 -04:00
Benoit Jacob 9c508f38f4 Bug 768538 - 1/2 - Fix undefined behavior in CheckedInt - r=jwalden 2012-07-05 10:13:13 -04:00
Rafael Ávila de Espíndola fb938b31ab Bug 759208 - CheckedInt.h depends on undefined value of signed arithmetic. r=bjacob. 2012-05-29 12:48:26 -04:00
Benoit Jacob ce077b3952 Bug 732875 - Further CheckedInt tweaks - r=Ms2ger,jwalden 2012-05-17 10:07:24 -04:00
Dão Gottwald 5e32254efb Backed out changeset 45ef0e7b2426 2012-05-17 16:48:06 +02:00
Benoit Jacob d88ddfed0d Bug 732875 - Further CheckedInt tweaks - r=Ms2ger,jwalden 2012-05-17 10:07:24 -04:00
Benoit Jacob 6de3cc03da 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