Commit Graph

41 Commits

Author SHA1 Message Date
Justin Lebar
a12ca3e4e8 Bug 909514 - Include <new> before mozilla::Maybe (and move Maybe into mfbt/Maybe.h). r=waldo
--HG--
rename : mfbt/Util.h => mfbt/Maybe.h
2013-08-27 15:10:28 -07:00
Ms2ger
6d567ab3cc Bug 904110 - Move alignment features out of Util.h into a new header; r=Waldo 2013-08-14 09:00:52 +02:00
Ehsan Akhgari
5ee21d6d3f 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
Ms2ger
28a9e7aa20 Bug 896341 - Update include guards and modelines in MFBT; r=Waldo 2013-07-24 09:41:39 +02:00
Brian Hackett
ddbb9d9519 Bug 678037 - Add (disabled) ability to parse script bytecode lazily, r=luke. 2013-05-30 06:29:56 -06:00
Chris Peterson
0c00315d90 Bug 785918 - Part 2: Add MOZ_HAVE_CXX11_CONSTEXPR check and constexpr version of ArrayLength(). r=waldo
--HG--
extra : rebase_source : e826347bfdedc949614c9cca294858b7150dfda1
2013-01-07 23:29:00 -08:00
Chris Peterson
4c4bf85b10 Bug 785918 - Part 1: Replace PR_ARRAY_SIZE() with mozilla::ArrayLength() and MOZ_ARRAY_LENGTH(). r=ehsan 2013-01-05 23:37:25 -08:00
Jeff Walden
7146c23e80 Bug 820570 - Move mozilla::DebugOnly into DebugOnly.h to pare down the grab-baggish Util.h. r=Ms2ger 2012-12-14 18:58:45 -05:00
Kyle Huey
df5a32b6e5 Bug 812824: Use a clean struct for inheritance on root nodes. r=dbaron,Waldo 2012-11-28 13:21:36 -08:00
Jeff Walden
03b6751e09 Style patrol to make everything conform to mfbt/STYLE. No bug, r=sparky 2012-06-03 20:36:43 -07:00
Gervase Markham
ca171eec44 Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
Luke Wagner
f80844498f Bug 650353 - Implement Compartment-Per-Global in XPConnect. r=mrbkap 2012-05-03 09:10:12 +02:00
Robert O'Callahan
9371edde80 Bug 726894. Add a copy constructor to DebugOnly so it can be used in more situations. r=cjones 2012-02-14 17:39:20 +13:00
Phil Ringnalda
9f50602120 Back out 7f81109133b5 (bug 725221), 135721f3720b (bug 726891), aef4ead175b4 (bug 726894) for orange 2012-02-13 22:31:22 -08:00
Robert O'Callahan
aa9fa6a0c3 Bug 726894. Add a copy constructor to DebugOnly so it can be used in more situations. r=cjones 2012-02-14 17:39:20 +13:00
Jeff Walden
157c2375be Add introductory comments to the files in mfbt/ that aren't copied from elsewhere, to facilitate easier MXR directory skimming. No bug, r=lumpy
--HG--
extra : rebase_source : dd834c64e625a0184b64d13e2a2e6fd8960ca832
2011-12-28 10:48:54 -06:00
Jeff Walden
6dab78f2df Bug 712129 - Move MOZ*INLINE macros from Util.h into Attributes.h, where they make more sense. r=luke
--HG--
extra : rebase_source : f62a21c8833c9d5eb7351b18ba14f14d4286b3c0
2011-12-19 14:45:52 -05:00
Jeff Walden
8fcbabe9e8 Bug 712129 - Move assertion code into a new mfbt/Assertions.h header. r=luke
--HG--
extra : rebase_source : 6587b6aa4180493c48b0663bc627543020a21deb
2011-12-19 14:28:35 -05:00
Jeff Walden
19508c446b Bug 711775 - Implement MOZ_NORETURN to encapsulate this-function-doesn't-return semantics. r=cjones
--HG--
extra : rebase_source : d56f3ef47e11c42b5fe6a442e13fd6202208914f
2011-12-17 16:45:29 -05:00
Jeff Walden
7f153524ef Bug 711672 - Break mfbt's dependency on jstypes.h by moving various API macros out of JS and into mfbt. r=luke, r=cjones
--HG--
extra : rebase_source : f18993e1eec1a5e5bcdb9cd97fa7d7c6ad261e2c
2011-12-13 14:26:58 -05:00
Jeff Walden
87d3f92e61 Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin 2011-12-08 22:54:10 -05:00
Jeff Walden
efbbb37472 Change preprocessor-directive indentation to be two-space, not one-space. rs=cjones in bug 702437 2011-11-15 22:26:55 -08:00
Jeff Walden
b7753477cf Bug 693469 - Implement mozilla::ArrayLength and mozilla::ArrayEnd, and replace uses of NS_ARRAY_LENGTH whenever possible. (Exceptions: assigning to static initializers, use in static assertions, as template parameters, etc. These will go away when the relevant compilers have C++11 constexpr support.) r=cjones
--HG--
extra : rebase_source : b4bae9a0f85abf2feb828609b50e756916b99a6f
2011-10-10 22:50:08 -07:00
Chris Leary
0d6adcf81f Bug 693928: Fix random orange from LifoAlloc debug memset. (r=luke)
--HG--
extra : rebase_source : 314ebeb6364ad0bb45baa6b7d7f09b9603e47b27
2011-10-12 15:32:40 -07:00
Jeff Walden
eb2cb918a4 Back out everything since 5435ee09cf7b. Tinderbox compilers hate me. r=epic-fail 2011-10-12 12:21:53 -07:00
Jeff Walden
77ebbde4ab Bug 639469 - Implement mozilla::ArrayLength and mozilla::ArrayEnd, and replace uses of NS_ARRAY_LENGTH whenever possible. r=cjones
--HG--
extra : rebase_source : 860a8271bf7e51cde358f2a4185c410de1fc2960
2011-10-10 22:50:08 -07:00
Justin Lebar
16aac235d7 Bug 689433 - Followup. Remove unused MOZ_STATIC_ASSERT macro. r=roc 2011-10-06 17:51:24 -04:00
Justin Lebar
83e3821db7 Bug 689433 - Align nsAutoTArray<E> to E's natural alignment. r=roc
--HG--
extra : rebase_source : f7062f251f6905a58145ed6d94680f076dabbef7
2011-10-05 09:11:17 -04:00
Chris Leary
14bc4cf54d Bug 684039: rewrite JS LIFO allocator, avoids thrashing. (r=luke)
--HG--
rename : js/src/jsarena.h => js/src/ds/LifoAlloc.h
extra : rebase_source : 098bf9561114f82363ebd0862213acf952709257
2011-09-22 13:22:30 -07:00
Terrence Cole
8dfb9edbc9 Bug: 685041 - convert #ifdef DEBUG vars in jsgc.cpp to DebugOnly; r=luke
This adds operation++ and operator-- to DebugOnly in support of the two uses
cleaned up here.
2011-09-07 11:32:35 -07:00
Terrence Cole
9e219e8b92 Bug 646597 - Remove unneeded #ifdef DEBUG: use DebugOnly instead; r=bhackett
Assignment to a DebugOnly variable results in a call to either the empty
'operator =' or to an empty implicit 1-arg constructor and empty copy
constructor when in non-debug mode.  Either of these get inlined and
eliminated as dead code above -00, so there is no benefit to skipping
this assignment for non-debug builds.
2011-09-04 13:58:00 +01:00
Chris Leary
0780a149be Bug 649576: Extricate JSHashTable from JSAtomList death grip. (r=luke) 2011-06-24 14:22:30 -07:00
Ehsan Akhgari
14a79314b1 Bug 662971 - Silence the clang warnings issued because of alignment requirements increase when compiling mfbt/Util.h; r=Waldo
--HG--
extra : rebase_source : a2bb6f588674602993c6603abda01487b72b6923
2011-06-17 15:59:47 -04:00
Jeff Walden
87ccff3aa5 Bug 662001 - Move js::RangeCheckedPointer<T> to mozilla::RangedPtr<T>, make it no longer implicitly convert to T*, and adjust users accordingly. r=cjones 2011-06-06 11:02:34 -07:00
David Mandelin
2299c54162 Bug 656282: Remove redundant declaration that causes an MSVC warning, r=luke
--HG--
extra : rebase_source : 42c6e9594f36fd7320bdea90fdb01c955bf07f4d
2011-05-16 16:17:19 -07:00
Jeff Walden
ac8938a32d Bug 656059 - Add operator-> to mozilla::DebugOnly<T> so it can store pointers. r=cjones
--HG--
extra : rebase_source : 3d7aeec93f1ae1e5bbd4b03c30216e70fe15eb6a
2011-05-10 14:56:49 -07:00
Daniel Holbert
582e13726b Bug 654346: Fix C++-style comments in mfbt headers included by .c files, to fix build warnings. r=cjones comment-only=DONTBUILD 2011-05-03 10:24:01 -07:00
Chris Jones
a61c26e2c0 Bug 642381, part 3: Hoist Maybe into mfbt and eliminate Gecko's use of jstl. r=jorendorff,luke 2011-04-28 17:48:52 -05:00
Chris Jones
ea1f5e599c Bug 647011: Sprinkle some DebugOnly in js/src. r=luke 2011-04-20 18:27:30 -05:00
Chris Jones
9520dec9fe Bug 577899, part 2: Add a DebugOnly helper to mfbt, which only contains a value in debug builds. r=luke 2011-03-31 20:46:35 -05:00
Chris Jones
02c5d89688 Bug 577899, part 1: Add mfbt, to contain code shared between SpiderMonkey and Gecko. r=luke,ted sr=brendan,bsmedberg,roc 2011-03-31 20:46:35 -05:00