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

94 Коммитов

Автор SHA1 Сообщение Дата
Jeremy Chen 722ad026a3 Bug 1297306 - part4:rename IsEnumFittingWithin with EnumTypeFitsWithin and move it to mfbt/EnumTypeTraits.h. r=froydnj
With this change, we could share this EnumTypeTraits between files easily.

MozReview-Commit-ID: 9Q2augati7l

--HG--
extra : rebase_source : b7d9fc95d9d7722ba3eb99ec9798a64ebdbeb484
2016-09-07 10:20:16 +08:00
Kan-Ru Chen b6d880aca1 Bug 1297276 - Rename mfbt/unused.h to mfbt/Unused.h for consistency. r=froydnj
The patch is generated from following command:

  rgrep -l unused.h|xargs sed -i -e s,mozilla/unused.h,mozilla/Unused.h,

MozReview-Commit-ID: AtLcWApZfES


--HG--
rename : mfbt/unused.h => mfbt/Unused.h
2016-08-24 14:47:04 +08:00
Igor 175543fda8 Bug 1293384 - Part 2: Rename Snprintf.h header to Sprintf.h. r=froydnj 2016-08-14 23:43:21 -07:00
Nathan Froyd 0a6a801dc2 Bug 1294537 - introduce a non-null-checking placement operator new; r=sunfish,nbp
The default placement operator new is defined to always require that its
result be null-checked.  A sufficiently smart compiler can remove this
check, but not all compilers are sufficiently smart.  Better to have a
custom placement operator new that will remove null checks in a way
defined by the standard.
2016-08-12 22:43:49 -04:00
Andi-Bogdan Postelnicu 79a0735001 Bug 1283395 - add markup functions for static analysis builds. r=froydnj
MozReview-Commit-ID: 6dFygYzTYfN
2016-07-25 16:57:30 +03:00
Wes Kocher 1feda59958 Backed out changeset 9c839b1d1397 (bug 1283395) for static build bustage CLOSED TREE 2016-07-25 08:54:47 -07:00
Andi-Bogdan Postelnicu 440264fed8 Bug 1283395 - add markup functions for static analysis builds. r=froydnj
MozReview-Commit-ID: 6dFygYzTYfN
2016-07-25 17:43:14 +03:00
Chris Peterson b0efbe0ef8 Bug 1288603 - Remove NumericLimits.h because all platforms have numeric_limits<char16_t>. r=froydnj 2016-07-22 22:05:45 -07:00
Tom Tromey 5538d692d3 Bug 1286877 - do not set c-basic-offset for python-mode; r=gps
This removes the unnecessary setting of c-basic-offset from all
python-mode files.

This was automatically generated using

    perl -pi -e 's/; *c-basic-offset: *[0-9]+//'

... on the affected files.

The bulk of these files are moz.build files but there a few others as
well.

MozReview-Commit-ID: 2pPf3DEiZqx

--HG--
extra : rebase_source : 0a7dcac80b924174a2c429b093791148ea6ac204
2016-07-14 10:16:42 -06:00
Nicholas Nethercote b3d842431f Bug 1272203 (part 1) - Add mozilla::NotNull to MFBT. r=froydnj.
This patch implements mozilla::NotNull, which is similar but not identicial to
gsl::not_null.

The current draft(?) implementation of gsl::not_null is at
https://github.com/Microsoft/GSL/blob/master/include/gsl.h.

The main difference is that not_null allows implicit conversion from T to
not_null<T>. In contrast, NotNull only allows explicit conversion from T to
NotNull<T> via WrapNotNull().

The rationale for this is that when converting from a less-constrained type to
a more constrained type, implicit conversion is undesirable. For example, if I
changed a function f from this:

  f(int* aPtr);

to this:

  f(gsl::not_null<int*> aPtr);

no call sites would have to be modified. But if I changed it to this:

  f(mozilla::NotNull<int*> aPtr);

call sites *would* need to be modified. This is a good thing! It forces the
author to audit the call sites for non-nullness, and encourages them to
back-propagate NotNull throughout the code.

The other difference between not_null and NotNull is that not_null disables
pointer arithmetic, which means it cannot be used with array pointers. I have
not implemented this restriction for NotNull because it seems arbitrary and
unnecessary.
2016-05-12 14:21:16 +10:00
Chris Peterson 11ef78ae89 Bug 1275016 - Rename Endian.h to EndianUtils.h to avoid #include confusion with Android's endian.h stdlib header. r=froydnj
--HG--
rename : mfbt/Endian.h => mfbt/EndianUtils.h
2016-05-22 13:31:11 -07:00
Bill McCloskey 308608ab39 Bug 1262671 - Introduce MFBT BufferList class (r=froydnj) 2016-05-27 09:57:40 -07:00
Chris Peterson 353ee65255 Bug 1272513 - Part 1: Suppress -Wshadow warnings-as-errors in some directories. r=glandium 2016-05-11 00:00:01 -07:00
Jeff Walden 1dd8dbc3f7 Bug 1246061. r=jandem, r=bz, r=luke, r=froydnj
--HG--
extra : rebase_source : 5b314d4c4c6e0b553290884be7338f8e79c22f71
2016-03-09 00:37:20 -08:00
Thomas Zimmermann ad6d42d817 Bug 1194721: Add |Saturate| template for saturation arithmetics, r=nfroyd
|Saturate<T>| implements saturation arithmetics for arbitrary basic
types. Operations on its value won't over- or underflow the type's
range.
2016-02-04 12:35:12 +01:00
Carsten "Tomcat" Book 4ff72292de Backed out changeset 8d6c228ef008 (bug 1194721) on developers request 2016-02-03 16:25:00 +01:00
Thomas Zimmermann 3d9f64bb3e Bug 1194721: Add |Saturate| template for saturation arithmetics, r=nfroyd
|Saturate<T>| implements saturation arithmetics for arbitrary basic
types. Operations on its value won't over- or underflow the type's
range.
2016-02-03 15:16:00 +01:00
Chris Peterson e92b68d840 Bug 1236413 - Suppress -Wimplicit-fallthrough warning in third-party code mfbt/decimal/. r=Waldo
mfbt/decimal/Decimal.cpp:762:9 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
2015-11-24 23:12:44 -08:00
Jeff Muizelaar b29099ae6d Bug 1228641. Add a polyfill of std::initializer_list. r=froydnj 2016-01-06 22:06:35 -05:00
Chris Peterson 46bb7c80dd Bug 1228947 - Replace mfbt/Constants.h with math.h. r=roc
--HG--
extra : rebase_source : 4ab2c4a917ea90055e48bd6adcb53904f2266ee0
2015-11-27 20:49:55 -08:00
Mike Hommey 2a82df055d Bug 1229293 - Enforce order when setting a HierarchicalStringList, and forbid reassignment. r=gps
The current implementation of HierarchicalStringList allows the following:

   FOO.bar = [
       'foo',
       'bar',
   ]

while

   FOO.bar += [
       'foo',
       'bar',
   ]

would be invalid because of the StrictOrderingOnAppendList enforcement.

It also allows to overwrite the entire list with a subsequent

   FOO.bar = [
	'baz',
   ]

while we've explicitly forbidden such things for every other list.

While in the vicinity, fix HierarchicalStringList._get_export_variable to not
call the HierarchicalStringList constructor uselessly.
2015-12-02 11:04:37 +09:00
Mike Hommey 572059374e Bug 1178266 - Link against libatomic when necessary. r=froydnj 2015-12-02 11:04:37 +09:00
Nathan Froyd e763192040 Bug 1216611 - add mozilla::MakeUniqueFallible and convert uses throughout the tree; r=Waldo 2015-11-05 16:24:24 -05:00
Mike Hommey c3385563ef Backout changeset 3ced6f84960c (bug 1178266) because it was not reviewed by a peer and isn't a complete fix. 2015-10-31 07:36:49 +09:00
Mike Hommey beffa7ff42 Bug 1178266 - Link against libatomic when necessary r=huangwenjun06
---
 build/autoconf/toolchain.m4 | 26 ++++++++++++++++++++++++++
 mfbt/moz.build              |  3 +++
 2 files changed, 29 insertions(+)
2015-10-29 22:19:35 +08:00
Nathan Froyd 01583602a9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 01:24:48 -04:00
Nathan Froyd 483783681e Bug 1207245 - part 4 - remove RefPtr.h; r=ehsan
It has been superseded by the availability of nsRefPtr.h.
2015-10-18 00:40:16 -04:00
Jim Blandy cd209ab0b5 Bug 1206357: Add mfbt/FastBernoulliTrial.h, implementing efficient random sampling. r=waldo
--HG--
extra : rebase_source : 63de57cd3fb3317c752f58fb7a0a71f050f198a3
2015-10-08 13:05:31 -07:00
Nathan Froyd 5761751aa3 Bug 1207245 - part 1 - move RefCounted<T> to its own file
Various bits depend on RefPtr.h to provide RefCounted<T> and RefPtr<T>.
It will be easier to manage an automatic conversion from RefPtr<T> to
nsRefPtr<T> if we split out the dependency on RefCounted<T> first.
2015-09-22 21:27:34 -04:00
Jim Blandy e1252e4e42 Bug 1206356: Add mfbt/Random.h, implementing the xorshift128+ random number generator. r=waldo
--HG--
extra : rebase_source : 3eb009156765b341e6a2dcee9f0287ce198c439f
2015-09-23 13:59:28 -07:00
Phil Ringnalda dba9d5afc5 Back out 835853a88b03 (bug 1206356) for at least Android/B2G bustage
CLOSED TREE
2015-09-22 18:21:32 -07:00
Jim Blandy 68cb70e9c4 Bug 1206356: Add mfbt/Random.h, implementing the xorshift128+ random number generator. r=waldo
--HG--
extra : rebase_source : 8694eae8a75a1b56be81826e3d9567d33a9fcdfe
2015-09-22 16:34:51 -07:00
Botond Ballo 9985fe899c Bug 1198451 - Add a type-erased callable wrapper, mozilla::Function, to MFBT. r=froydnj
--HG--
extra : source : 90ac08992195f6e818a83019567e55e17a350901
2015-09-11 14:40:09 -04:00
Nicholas Nethercote f44287005f Bug 1198334 (part 1) - Replace the opt-in FAIL_ON_WARNINGS with the opt-out ALLOW_COMPILER_WARNINGS. r=glandium.
The patch removes 455 occurrences of FAIL_ON_WARNINGS from moz.build files, and
adds 78 instances of ALLOW_COMPILER_WARNINGS. About half of those 78 are in
code we control and which should be removable with a little effort.

--HG--
extra : rebase_source : 82e3387abfbd5f1471e953961d301d3d97ed2973
2015-08-27 20:44:53 -07:00
Bobby Holley 97b9240b34 Bug 1188696 - Hoist nsRefPtr.h into MFBT. r=froydnj 2015-07-29 10:44:59 -07:00
Steve Fink fda6cabeb6 Bug 1180299 - Implement ScopeExit for running actions at the end of a scope, r=Waldo
--HG--
extra : commitid : JVZx97WUQxy
extra : rebase_source : 5cef069fd3071ad305a3e3f04e0addff577b1093
2015-07-03 14:20:55 -07:00
Xidorn Quan 5ce6110994 Bug 1175485 part 3 - Remove unused operators, typedefs and IteratorTraits. r=waldo
--HG--
extra : source : c1d3256e987c25935cc8bd321c413a1e0c7586b3
2015-07-02 13:31:07 +10:00
Nick Fitzgerald 474c4d36e3 Bug 1174906 - Add a mozilla::Variant<T1, T2, ...> template class; r=Waldo 2015-06-30 10:01:00 -07:00
Mike Hommey ea7750bcb1 Bug 991983 - Define SOURCES as SourcePath. r=gps 2015-05-28 07:34:15 +09:00
Kartikaya Gupta ddec892671 Bug 1160285 - Add a staticruntime version of mfbt and link some stuff against it. r=glandium 2015-05-27 17:22:29 -04:00
Botond Ballo 2e2a504271 Bug 1119980 - Use 'snprintf' instead of 'sprintf' to avoid a warning on Lollipop-based builds. r=froydnj
--HG--
extra : source : 7468f9a3aa03520a29e138d4df431f0b5d90967c
2015-05-26 14:33:55 -04:00
Phil Ringnalda 49dd872168 Back out 3 changesets (bug 1119980) for emulator-l bustage
CLOSED TREE

Backed out changeset 12ce98475c6e (bug 1119980)
Backed out changeset bdb8d05f8870 (bug 1119980)
Backed out changeset a68a18840492 (bug 1119980)
2015-05-25 18:48:51 -07:00
Botond Ballo 9934d127c1 Bug 1119980 - Use 'snprintf' instead of 'sprintf' to avoid a warning on Lollipop-based builds. r=froydnj
--HG--
extra : rebase_source : 4e915a12ba662ed45788238a5f0a45533888bd92
2015-05-25 20:45:17 -04:00
Cameron McCormack 8f0b97017a Bug 1147766 - Part 1: Add a mozilla::RangedArray class, for fixed length arrays with a non-zero base index. r=waldo 2015-05-23 12:50:44 +10:00
Cameron McCormack 93417eae1e Backed out changeset a6fa096f9853 and ec1c41143ff6 (bug 1147766) since I messed up the warning fix. 2015-05-23 15:51:14 +10:00
Cameron McCormack 6b806699ce Bug 1147766 - Part 1: Add a mozilla::RangedArray class, for fixed length arrays with a non-zero base index. r=waldo 2015-05-23 12:50:44 +10:00
Phil Ringnalda d63c42b6f0 Back out 2 changesets (bug 1147766) for -Werror bustage
CLOSED TREE

Backed out changeset 10d6fcd9a4e0 (bug 1147766)
Backed out changeset 5754455de846 (bug 1147766)
2015-05-22 20:24:08 -07:00
Cameron McCormack bee32f1c18 Bug 1147766 - Part 1: Add a mozilla::RangedArray class, for fixed length arrays with a non-zero base index. r=waldo 2015-05-23 12:50:44 +10:00
Botond Ballo eaf6e90eb3 Bug 1163329 - Add a utility for expanding a tuple into a variadic argument list to MFBT. r=froydnj
--HG--
extra : rebase_source : e6aaf87a75bfcbebdbd93824a0927ac89a9d2f78
extra : source : d2ccca76a74b83715edefb4414661f4a265021a3
2015-05-11 17:23:33 -04:00
Botond Ballo 872cd27412 Bug 1163328 - Add a Tuple class to MFBT. r=froydnj
--HG--
extra : source : f12a4369d58e8ed5acb244b10ce749849d61f60c
2015-05-21 22:33:49 -04:00