Commit Graph

42 Commits

Author SHA1 Message Date
David Major
b575d56915 Bug 1185686: Fix Atomics.h ifdefs for clang-cl. r=froydnj 2015-07-20 17:04:46 -04:00
Ehsan Akhgari
0915a15420 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
5c13924153 Backed out changeset 02e6a50741a9 (bug 1153348) to hopefully fix the static bustage CLOSED TREE 2015-04-21 15:47:40 -07:00
Ehsan Akhgari
783d64de67 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
4f4dac309f 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
a7c442b84d Bug 1154104 - Clean up atomics code for old Visual Studio versions. r=nfroyd 2015-04-13 17:13:00 +02:00
Trevor Saunders
d4606517a6 bug 1077549 - remove useless gcc version checks r=glandium 2015-01-15 21:30:05 -05:00
Nicholas Nethercote
18091a4ab9 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
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
2379621af0 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
a3ad22f376 Bug 1073709 - Disable C++11 <atomic> when using GCC with libc++. r=waldo 2014-09-26 15:15:00 +02:00
Hannes Verschore
a027299d54 Bug 1061764 - Atomic<bool, Relaxed> should mean no synchronization on windows x86, r=froydnj 2014-09-04 11:08:00 +02: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
Ehsan Akhgari
812dd4b759 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
570bcb4788 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
d0ca596588 Bug 1013662 - Fix bad implicit conversion constructors in MFBT; r=froydnj,Waldo 2014-06-06 23:17:06 -04:00
Nathan Froyd
7905be6fef Bug 1020118 - fix atomic add/sub for pointer types on Win64; r=jcranmer 2014-06-04 15:19:51 -04:00
Wes Kocher
676b8051d8 Backed out changeset 34f371b1024b (bug 1021290) for Windows build bustage on a CLOSED TREE 2014-06-05 17:35:47 -07:00
Jeff Muizelaar
f3a94f181e 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
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
David Major
f334dea13c 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
055b6ccc3a Bug 965837 - Add bool support to mozilla::Atomic. r=froydnj 2014-02-06 14:57:30 -05:00
Jeff Muizelaar
694006a826 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
a08dd455fa Bug 906783 - Attempt to detect the standard C++ library version, r=Waldo 2013-08-29 22:44:23 -05:00
Trevor Saunders
ff80a9c55c bug 905243 - make the constructors for mozilla::Atomic constexpr r=froydnj 2013-08-14 16:28:17 -04:00
Nathan Froyd
a53f776d48 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
74d86ab8ae 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
99ea7ddf76 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
f072f8adf2 backout f607ac59de19 (Bug 888548 part 2) for B2G build bustage 2013-07-31 19:05:05 -07:00
Daniel Holbert
3d1a17c2ef backout fc98067f0aa4 (Bug 888548 part 3) for B2G build bustage 2013-07-31 19:04:25 -07:00
Birunthan Mohanathas
99ffeabe6b 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
70a5f02910 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
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
Nathan Froyd
2508cb7970 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
f4ac238f7a Bug 896341 - Update include guards and modelines in MFBT; r=Waldo 2013-07-24 09:41:39 +02:00
Timothy B. Terriberry
2440908070 Bug 881163 - Require gcc 4.5.2 for C++11 atomics, r=froydnj 2013-06-10 09:17:00 -07:00
Landry Breuil
7907fc92ff 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
d3a89ae699 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
69c80eae47 Bug 876691 - Unbreak mfbt/Atomics.h for Windows x64. r=me 2013-05-28 15:26:25 -04:00
Justin Lebar
20471613d3 Bug 873800 - Add compare-and-exchange to mfbt/Atomics.h. r=froydnj
--HG--
extra : rebase_source : c9e455ed249e6b3cd0f532d240abfb602e2e88a8
2013-05-24 13:10:47 -04:00
Justin Lebar
7f0fcf5b49 Bug 873799 - Add an explicit barrier before __sync_lock_test_and_set in mfbt/Atomics.h r=froydnj
--HG--
extra : rebase_source : 64d23f1df2fef8719413800ebb0afe6f51d1e3af
2013-05-24 13:10:47 -04:00
Nathan Froyd
87fe45e687 Bug 732043 - part 1 - add mfbt/Atomics.h; r=Waldo; original-author=jcranmer 2013-04-22 14:12:03 -04:00