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
Brian Hackett
bae5179cfb
Bug 1502207 Part 2 - Fix useUse new atomic access API in Gecko, r=froydnj.
...
--HG--
extra : rebase_source : 2b9b5bb77fb53cd9f028912b4ba54136c9066447
2018-10-25 11:42:18 -10:00
Brian Hackett
47ccde0dda
Bug 1207696 Part 2a - Atomics interface changes, r=waldo.
...
--HG--
extra : rebase_source : 39c1910c273357bdacbea7c15d9c49eccd2aeb2c
2018-07-21 14:17:16 +00:00
Jeff Walden
a3d9df23d5
Bug 1407137 - Implement Swap(Atomic<T, Order>&, Atomic<T, Order>&) = delete; to remove an actually-non-atomic footgun. r=froydnj
...
--HG--
extra : rebase_source : 6afed8e85fcf8801144a1a34ea07f590baa0f5e0
2017-10-10 10:19:31 -07:00
Nathan Froyd
e5fbad82a1
Bug 1363426 - part 3 - minor cleanups to Atomics.h; r=erahm
...
We can move the <atomic> #include to its normal place in the file now,
as well as merging some namespace blocks at the toplevel.
2017-05-10 09:58:28 -04:00
Nathan Froyd
c0a40e46f7
Bug 1363426 - part 2 - remove unneeded MOZ_HAVE_CXX1_ATOMICS; r=erahm
...
Now that we can use <atomic> everywhere, we don't need to test whether
the standard library we're using has <atomic> support.
2017-05-10 09:58:28 -04:00
Nathan Froyd
fe42aa0b9d
Bug 1363426 - part 1 - remove #ifdeffery in Atomics.h; r=erahm
...
Every platform where we use GCC has <atomic>, so there's no need to use
GCC-specific __sync* intrinsics anymore. The <atomic> header may
generate better code for several operations, as well.
2017-05-10 09:58:28 -04:00
Chris Peterson
43c2748f66
Bug 1277775 - Replace MOZ_CONSTEXPR{_VAR,_TMPL} with constexpr. r=froydnj
2016-07-08 14:39:53 -07:00
Nathan Froyd
6a5930b454
Bug 1247338 - really make Atomic's constructor constexpr; r=Waldo
...
Atomic's constructor is marked as constexpr, but it calls a
non-constexpr function, ToStorageTypeArgument::convert. For compilers
which require constexpr-ness on constructors to inline away the actual
constructor call, the call to ToStorageTypeArgument::convert completely
disables the constexpr-ness of the constructor. Let's fix this by
marking all relevant instances of ToStorageTypeArgument::convert as
MOZ_CONSTEXPR, thus satisfying the compiler once again.
2016-02-10 11:28:36 -05:00
Jeff Walden
fe5445d030
Bug 1220693 - Make mozilla::Atomic<enum class> work even on compilers that don't have <atomic>. r=froydnj
...
--HG--
extra : rebase_source : 2eb167a1b86a1a93527761a9541ea30ad213785a
2015-11-03 13:03:26 -08:00
Nathan Froyd
78b4b30d08
Bug 1189894 - remove Atomics.h IntrinsicAddSub hack; r=erahm
...
This hack was only required for broken headers in GCC 4.6. Since we
only support GCC 4.7+ now, this hack is no longer necessary.
2015-07-31 22:25:21 -04:00
David Major
ec86960f3c
Bug 1185686: Fix Atomics.h ifdefs for clang-cl. r=froydnj
2015-07-20 17:04:46 -04:00
Ehsan Akhgari
399276d5fc
Bug 1153348 - Add an analysis to prohibit operator bools which aren't marked as either explicit or MOZ_IMPLICIT; r=jrmuizel
...
This is the counterpart to the existing analysis to catch
constructors which aren't marked as either explicit or
MOZ_IMPLICIT.
2015-04-21 21:40:49 -04:00
Wes Kocher
638b28b8e0
Backed out changeset 02e6a50741a9 (bug 1153348) to hopefully fix the static bustage CLOSED TREE
2015-04-21 15:47:40 -07:00
Ehsan Akhgari
3d21a05904
Bug 1153348 - Add an analysis to prohibit operator bools which aren't marked as either explicit or MOZ_IMPLICIT; r=jrmuizel
...
This is the counterpart to the existing analysis to catch
constructors which aren't marked as either explicit or
MOZ_IMPLICIT.
2015-04-21 16:31:58 -04:00
Seth Fowler
36709ff42c
Bug 1155864 - Rip out Windows intrinsics from Atomics.h and allow Atomic to hold 64-bit types everywhere. r=Waldo
2015-04-17 18:40:52 -07:00
David Major
13d9def98b
Bug 1154104 - Clean up atomics code for old Visual Studio versions. r=nfroyd
...
--HG--
extra : rebase_source : 83ed35150a55c26c66994f3f7a6c4ae7ae14ba66
2015-04-13 17:13:00 +02:00
Trevor Saunders
5b86ecf80c
bug 1077549 - remove useless gcc version checks r=glandium
2015-01-15 21:30:05 -05:00
Nicholas Nethercote
e147e4d209
Bug 1057134 - Remove std::_Debug_message linking hack that's no longer needed. r=dmajor.
...
--HG--
extra : rebase_source : 53ee0cebc42269dcc228cfc5a18b0288e13716f3
2015-01-08 21:59:43 -08: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
039292de5d
Bug 1119071 - Clean up some code used for older unsupported MSVC versions in MFBT; r=froydnj
2015-01-08 10:40:15 -05:00
Jan Beich
2e6d8524b0
Bug 1073709 - Disable C++11 <atomic> when using GCC with libc++. r=waldo
2014-09-26 15:15:00 +02:00
Hannes Verschore
e729b5e319
Bug 1061764 - Atomic<bool, Relaxed> should mean no synchronization on windows x86, r=froydnj
2014-09-04 11:08:00 +02: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
Ehsan Akhgari
c2cbd699a1
Bug 1025900 - #include intrin.h directly in Atomics.h instead of declaring functions manually from it; r=froydnj
...
This is basically more of bug 1022049.
--HG--
extra : rebase_source : 39cf2745d47d90ba1684c2c26a38f9781a4d179e
2014-06-16 18:19:49 -04:00
Ehsan Akhgari
ac9615fa0d
Bug 1021290 - More Atomics.h build fixes for clang-cl. r=froydnj
...
This is basically more of bug 932454
2014-06-09 14:49:34 -04:00
Ehsan Akhgari
8b30e40485
Bug 1013662 - Fix bad implicit conversion constructors in MFBT; r=froydnj,Waldo
2014-06-06 23:17:06 -04:00
Nathan Froyd
002c131055
Bug 1020118 - fix atomic add/sub for pointer types on Win64; r=jcranmer
2014-06-04 15:19:51 -04:00
Wes Kocher
8ae9f3fb4a
Backed out changeset 34f371b1024b (bug 1021290) for Windows build bustage on a CLOSED TREE
2014-06-05 17:35:47 -07:00
Jeff Muizelaar
c50b5c14aa
Bug 1021290. More Atomics.h build fixes for clang-cl. r=froydnj
...
This is basically more of bug 932454
--HG--
extra : rebase_source : 0f9a5d43164efb6940d17e406f41691cb3d26435
2014-06-05 19:48:52 -04: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
David Major
926fd8dee8
Bug 982310 - Hack around problems linking std::_Debug_message; r=ehsan
...
--HG--
extra : amend_source : 2e0f6f26823ee5fcce16dfaf8791ae57d8ac62cb
2014-03-21 12:53:00 -07:00
Viktor Stanchev
529b872af2
Bug 965837 - Add bool support to mozilla::Atomic. r=froydnj
2014-02-06 14:57:30 -05:00
Jeff Muizelaar
3ebdf849ba
Bug 932454. Make Atomics.h compilable with clang on Windows. r=nfroyd,jwalden
...
MSVC is sloppy with typedefs leaking. Clang is more strict.
--HG--
extra : rebase_source : e8000f43391f8a32fbde96d54ff11e09e49345f9
2013-10-29 17:55:38 -04:00
Joshua Cranmer
7cc0542786
Bug 906783 - Attempt to detect the standard C++ library version, r=Waldo
2013-08-29 22:44:23 -05:00
Trevor Saunders
523a468b97
bug 905243 - make the constructors for mozilla::Atomic constexpr r=froydnj
2013-08-14 16:28:17 -04:00
Nathan Froyd
23a4a49409
Bug 900965 - compile failures with gcc 4.6.3 on std::atomic enum support from bug 888548 r=waldo
2013-08-02 18:18:41 -07:00
Birunthan Mohanathas
1baab48cb7
Bug 888548 - Part 3: Add enum support to mozilla::Atomic<T>. r=froydnj
...
Due to a bug in GCC, the compareExchange function is not available with enum types.
2013-08-01 21:21:32 -04:00
Birunthan Mohanathas
e58014264e
Bug 888548 - Part 2: Refactor and cleanup mozilla::Atomic<T> implementation. r=froydnj
...
This moves the increment and decrement operators from detail::AtomicBase to
detail::AtomicBaseIncDec and moves the implementation of the assignment
operator into detail::AtomicBase. Additionally, this changes the integral
implementation to use mozilla::EnableIf for its specialization.
2013-08-01 21:21:32 -04:00
Daniel Holbert
f8d5639ac1
backout f607ac59de19 (Bug 888548 part 2) for B2G build bustage
2013-07-31 19:05:05 -07:00
Daniel Holbert
819cbd5af1
backout fc98067f0aa4 (Bug 888548 part 3) for B2G build bustage
2013-07-31 19:04:25 -07:00
Birunthan Mohanathas
6f4e72b203
Bug 888548 - Part 3: Add enum support to mozilla::Atomic<T>. r=froydnj
...
Due to a bug in GCC, the compareExchange function is not available with enum types.
2013-07-31 21:15:25 -04:00
Birunthan Mohanathas
19404c8ec4
Bug 888548 - Part 2: Refactor and cleanup mozilla::Atomic<T> implementation. r=froydnj
...
This moves the increment and decrement operators from detail::AtomicBase to
detail::AtomicBaseIncDec and moves the implementation of the assignment
operator into detail::AtomicBase. Additionally, this changes the integral
implementation to use mozilla::EnableIf for its specialization.
2013-07-31 21:15:25 -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
Nathan Froyd
86df43c75a
Bug 898491 - use the four argument form of compare_exchange_strong in Atomics.h; r=Waldo
...
The C++ standard (29.6p20-22 in N3337) specifies limitations on the failure ordering
for atomic compare-and-exchange. Specifically, you can't pass memory_order_acq_rel or
memory_order_release. For the (T&, T, std::memory_order) version, which we use, the
standard specifies that the provided argument should be "lowered" to comply with the
above restrictions on the failure ordering (29.6p21).
However, it seems that some versions of GCC's <atomic> header don't follow the spec
for the generic versions of std::atomic<>, though they do follow the spec with the
appropriate specializations (bool, integer, and pointer) of std::atomic<>. This
results in mysterious failures when using atomic enums, as bug 888548 purports to
do, and ReleaseAcquire ordering.
Happily, we can work around this by using the more explicit version of
compare-and-exchange. I've chosen to add another member to AtomicOrderConstraints,
even though it'd be the same as LoadOrder. I feel explicitness is to be preferred
here.
2013-07-26 12:31:19 -04:00
Ms2ger
51f391870b
Bug 896341 - Update include guards and modelines in MFBT; r=Waldo
2013-07-24 09:41:39 +02:00
Timothy B. Terriberry
a5f847a092
Bug 881163 - Require gcc 4.5.2 for C++11 atomics, r=froydnj
2013-06-10 09:17:00 -07:00
Landry Breuil
fae08ebf77
Bug 876156: Don't try using <atomic> on OpenBSD which uses an old libstdc++ r=nfroyd
2013-06-01 00:23:01 +02:00
Nathan Froyd
443c507139
Bug 873649 - don't assume <atomic> is usable with clang on a Linux system; r=Waldo
2013-05-17 17:04:30 -04:00
Justin Lebar
7729e7ff63
Bug 876691 - Unbreak mfbt/Atomics.h for Windows x64. r=me
2013-05-28 15:26:25 -04:00