gecko-dev/mfbt
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
..
decimal Bug 1245414, part 10 - Apply the Mozilla patches via mfbt/decimal/update.sh. r=Waldo 2016-02-11 19:43:14 +00:00
double-conversion
staticruntime
tests Bug 1272203 (part 1) - Add mozilla::NotNull to MFBT. r=froydnj. 2016-05-12 14:21:16 +10:00
Alignment.h Bug 1269319 - Make AlignedStorage/AlignedStorage2 non-copyable to fix strict aliasing issues. r=Waldo 2016-05-19 20:57:36 +02:00
AllocPolicy.h Bug 1262671 - Introduce MFBT BufferList class (r=froydnj) 2016-05-27 09:57:40 -07:00
AlreadyAddRefed.h Bug 1267550 (part 2) - Rename MOZ_WARN_UNUSED_RESULT as MOZ_MUST_USE. r=froydnj. 2016-04-27 14:16:50 +10:00
Array.h
ArrayUtils.h
Assertions.h Bug 1267550 (part 2) - Rename MOZ_WARN_UNUSED_RESULT as MOZ_MUST_USE. r=froydnj. 2016-04-27 14:16:50 +10:00
Atomics.h Bug 1247338 - really make Atomic's constructor constexpr; r=Waldo 2016-02-10 11:28:36 -05:00
Attributes.h Bug 1267550 (part 2) - Rename MOZ_WARN_UNUSED_RESULT as MOZ_MUST_USE. r=froydnj. 2016-04-27 14:16:50 +10:00
BinarySearch.h Bug 1247835 (part 0) - Minor comment and style tweaks in BinarySearch.h. r=luke. 2016-02-23 15:41:39 +11:00
BloomFilter.h
BufferList.h Bug 1262671 - Introduce MFBT BufferList class (r=froydnj) 2016-05-27 09:57:40 -07:00
Casting.h
ChaosMode.cpp
ChaosMode.h Bug 1260247. In chaos mode randomly decide to start a new image load even if the image is in the image cache when allowed by spec. r=seth 2016-04-02 13:53:12 -05:00
Char16.h
CheckedInt.h
Compiler.h Bug 1175546 - Update GCC to 4.8.5 and bump minimum GCC version required to build. r=froydnj 2016-03-12 09:03:37 +09:00
Compression.cpp
Compression.h Bug 1268754 - Tweak some MFBT return values. r=Ms2ger. 2016-04-29 13:14:34 +10:00
DebugOnly.h Bug 1253094, part 11 - Make DebugOnly a MOZ_STACK_CLASS. r=Waldo 2016-02-26 15:52:08 +00:00
EndianUtils.h Bug 1275016 - Rename Endian.h to EndianUtils.h to avoid #include confusion with Android's endian.h stdlib header. r=froydnj 2016-05-22 13:31:11 -07:00
EnumeratedArray.h
EnumeratedRange.h
EnumSet.h Bug 1266404 - Allow construction of an EnumSet<T> using an initializer list r=Waldo 2016-04-28 14:25:05 +01:00
FastBernoulliTrial.h Bug 1231378 - part 3 - Fix uninitialized members of classes in modules/libjar and mfbt, r=smaug 2016-01-12 18:16:59 +00:00
FloatingPoint.cpp
FloatingPoint.h Bug 1267550 (part 2) - Rename MOZ_WARN_UNUSED_RESULT as MOZ_MUST_USE. r=froydnj. 2016-04-27 14:16:50 +10:00
Function.h Bug 1263342 - don't use REFCOUNTED_VIRTUAL_TYPENAME for mfbt FunctionImplBase. r=froydnj 2016-04-08 23:14:59 -04:00
GuardObjects.h
HashFunctions.cpp
HashFunctions.h Bug 1267550 (part 2) - Rename MOZ_WARN_UNUSED_RESULT as MOZ_MUST_USE. r=froydnj. 2016-04-27 14:16:50 +10:00
IndexSequence.h
InitializerList.h Bug 1228641 - Rename begin/size to aBegin/aSize to avoid shadow warnings; r=botond 2016-01-13 07:54:53 +09:00
IntegerPrintfMacros.h
IntegerRange.h
IntegerTypeTraits.h
JSONWriter.cpp
JSONWriter.h
Likely.h
LinkedList.h Add an assertion message to the assert-is-empty in LinkedList::~LinkedList, to indicate to users who hit it that it's the fault of the caller, not the fault of MFBT code. No bug, rs=froydnj 2016-02-16 13:06:20 -08:00
LinuxSignal.h
lz4.c
lz4.h
MacroArgs.h
MacroForEach.h
MathAlgorithms.h Bug 1271972: wasm: Implement i64.ctz, i64.clz, i64.popcount; r=sunfish 2016-05-11 19:00:53 +02:00
Maybe.h
MaybeOneOf.h
MemoryChecking.h
MemoryReporting.h
Move.h
moz.build Bug 1272203 (part 1) - Add mozilla::NotNull to MFBT. r=froydnj. 2016-05-12 14:21:16 +10:00
NotNull.h Bug 1272203 (part 1) - Add mozilla::NotNull to MFBT. r=froydnj. 2016-05-12 14:21:16 +10:00
NullPtr.h
NumericLimits.h
objs.mozbuild
Opaque.h Bug 1246061. r=jandem, r=bz, r=luke, r=froydnj 2016-03-09 00:37:20 -08:00
Pair.h
PodOperations.h
Poison.cpp Bug 1247535 - Fix -Wunreachable-code warning in mfbt/Poison.cpp. r=froydnj 2016-02-10 22:09:53 -08:00
Poison.h Bug 1268246 - Add a simple Poison class lifetime checker. r=froydnj 2016-04-29 13:54:54 -04:00
Range.h
RangedArray.h
RangedPtr.h
ReentrancyGuard.h
RefCounted.h Bug 1251769 - Remove remaining references to MOZILLA_XPCOMRT_API from mfbt. r=froydnj 2016-02-27 11:12:07 -08:00
RefCountType.h
RefPtr.h Bug 1269968 - Remove unnecessary deduction on RefPtr.h. r=froydnj 2016-05-03 20:45:00 +02:00
ReverseIterator.h
RollingMean.h
Saturate.h Bug 1194721: Add |Saturate| template for saturation arithmetics, r=nfroyd 2016-02-04 12:35:12 +01:00
Scoped.h Bug 1252902 - remove ScopedFreePtr; r=Waldo 2016-03-02 11:44:27 -05:00
ScopeExit.h
SegmentedVector.h Bug 1267550 (part 2) - Rename MOZ_WARN_UNUSED_RESULT as MOZ_MUST_USE. r=froydnj. 2016-04-27 14:16:50 +10:00
SHA1.cpp Bug 1275016 - Rename Endian.h to EndianUtils.h to avoid #include confusion with Android's endian.h stdlib header. r=froydnj 2016-05-22 13:31:11 -07:00
SHA1.h
SizePrintfMacros.h
Snprintf.h
SplayTree.h Bug 1268754 - Tweak some MFBT return values. r=Ms2ger. 2016-04-29 13:14:34 +10:00
STYLE
TaggedAnonymousMemory.cpp
TaggedAnonymousMemory.h
TemplateLib.h
ThreadLocal.h Bug 1267550 (part 2) - Rename MOZ_WARN_UNUSED_RESULT as MOZ_MUST_USE. r=froydnj. 2016-04-27 14:16:50 +10:00
ToString.h
Tuple.h Bug 1232418 - Allow mozilla::Tuple to support equality comparison; r=Waldo 2015-12-14 12:01:17 -08:00
TypedEnumBits.h
Types.h Bug 1251769 - Remove remaining references to MOZILLA_XPCOMRT_API from mfbt. r=froydnj 2016-02-27 11:12:07 -08:00
TypeTraits.h Bug 1243876 - fix ConvertibleTester to not cause incomplete type errors with UniquePtr and Skia. r=nfroyd 2016-01-28 16:08:27 -05:00
UniquePtr.h Bug 1267550 (part 2) - Rename MOZ_WARN_UNUSED_RESULT as MOZ_MUST_USE. r=froydnj. 2016-04-27 14:16:50 +10:00
UniquePtrExtensions.h Bug 1252195 - part 1 - implement UniqueFreePtr; r=Waldo 2016-02-29 10:29:13 -05:00
unused.cpp
unused.h
Variant.h Bug 1209227 - Part 2: Mark mfbt::Variant as MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS, r=froydnj 2016-05-19 09:34:01 -04:00
Vector.h Bug 1271022 - add Vector::podResizeToFit (r=njn) 2016-05-09 08:59:10 -05:00
WeakPtr.h
WindowsVersion.h bug 1239166 - platform work to support Microsoft Family Safety functionality r=froydnj,mgoodwin,mhowell,rbarnes,vladan 2016-01-12 15:39:43 -08:00
XorShift128PlusRNG.h Bug 1239479: Add comments to mfbt/XorShift128PlusRNG.h from the RNG's designer. DONTBUILD r=Waldo 2016-01-13 12:46:40 -08:00