folly.git
11 years agofolly: adjust more headers to be -Wshadow-clean
Jim Meyering [Sat, 24 Aug 2013 02:46:09 +0000 (19:46 -0700)]
folly: adjust more headers to be -Wshadow-clean

Summary:
This is part of what's required to make mcrouter compile warning-free
with gcc -Wshadow.  In case it's not obvious why this is worth doing,
see t2719164.

I've used two techniques:
rename one of the shadowed variables
bracket offending code with #pragma directives to disable the warning there.

* folly/Bits.h (BitIterator): Guard this function with #pragma
to avoid a warning about its member-shadowing "bitOffset" parameter.
* folly/Memory.h (StlAllocator): Rename parameter in trivial, one-line
function definition, s/alloc/a/, to avoid shadowing the member function.
Let me know if you'd prefer #pragma directives instead.
* folly/io/Cursor.h (pull,skip,clone): Rename parameter, s/length/len/,
not to shadow the member function name.

Test Plan:
build and run tests of a few tools that use these headers

Reviewed By: jon.coens@fb.com

FB internal diff: D940493

11 years agounbreak build
Tudor Bosman [Sat, 24 Aug 2013 00:14:08 +0000 (17:14 -0700)]
unbreak build

Test Plan: built producer_consumer_queue_test with gcc 4.7.1
@override-unit-failures

Reviewed By: chip@fb.com

FB internal diff: D942465

11 years agoUse boost:has_trivial_destructor instead of std::...
Sara Golemon [Fri, 23 Aug 2013 23:22:09 +0000 (16:22 -0700)]
Use boost:has_trivial_destructor instead of std::...

Summary: Boost's version is 4.8 safe.  std's version changes name

Test Plan: hhvm builds

Reviewed By: andrei.alexandrescu@fb.com

FB internal diff: D883508

11 years agostd::map and std::set are not relocatable
Tudor Bosman [Thu, 22 Aug 2013 14:26:48 +0000 (07:26 -0700)]
std::map and std::set are not relocatable

Summary: https://github.com/facebook/folly/issues/35

@override-unit-failures
hphp tests independently broken

Test Plan: test added

Reviewed By: delong.j@fb.com

FB internal diff: D939323

11 years agofolly: improve Subprocess::enforce() error message
Lucian Grijincu [Tue, 20 Aug 2013 22:50:39 +0000 (15:50 -0700)]
folly: improve Subprocess::enforce() error message

Summary: Previous implementation only printed the desired state, not the actual runtime state. Fix that.

Test Plan: n/a

Reviewed By: tudorb@fb.com

FB internal diff: D936279

11 years agomake StringGen clang-compatible
Philip Pronin [Tue, 20 Aug 2013 10:18:39 +0000 (03:18 -0700)]
make StringGen clang-compatible

Test Plan:
fbconfig -r folly/test && fbmake opt -j32

Reviewed By: tjackson@fb.com

FB internal diff: D935182

11 years agoretry flock() if interrupted (EINTR)
Philip Pronin [Sat, 17 Aug 2013 09:06:35 +0000 (02:06 -0700)]
retry flock() if interrupted (EINTR)

Test Plan: fbconfig folly/test:file_test && fbmake runtests_opt

Reviewed By: soren@fb.com

FB internal diff: D932782

11 years agoFix overeager assertion
Tudor Bosman [Thu, 15 Aug 2013 21:49:47 +0000 (14:49 -0700)]
Fix overeager assertion

Summary: Also important spelling mistakes.
@override-unit-failures

Test Plan: string_test

Reviewed By: tjackson@fb.com

FB internal diff: D930037

11 years agoAdd Varint-length-prefixed flavor of LZ4
Tudor Bosman [Thu, 15 Aug 2013 02:37:40 +0000 (19:37 -0700)]
Add Varint-length-prefixed flavor of LZ4

Test Plan: test added

Reviewed By: alandau@fb.com

FB internal diff: D928836

11 years agoVarint in folly
Tudor Bosman [Thu, 15 Aug 2013 02:17:09 +0000 (19:17 -0700)]
Varint in folly

Test Plan: test added

Reviewed By: alandau@fb.com

FB internal diff: D928835

11 years agoFix a ThreadLocal bug: hold the meta lock when resizing the element vector
Jordan DeLong [Thu, 15 Aug 2013 00:03:04 +0000 (17:03 -0700)]
Fix a ThreadLocal bug: hold the meta lock when resizing the element vector

Summary:
There appears to be a race here.  leizha reported issues with
a heavily recycled AtomicHashMap (ThreadCachedInt inside).  It looks
like what's happening is this:

- Thread A: ~ThreadCachedInt from an AHM
- meta lock is taken, and the ThreadElement list is iterated
- all entries are zerod, and the id is marked free
- then releases the lock
- Thread B: someone is calling get() on an unrelated id
- hit reserve: rallocm on the pointer or unsynchronized memcpy from
the element vector
- waits on the lock
- when it gets the lock, it stores back the value that it read that
was zero'd by A.

Later, someone reuses the id from the freelist, and reuses the
previously freed pointer, and eventually double-freeing it.  (nullptr
is the signifier for "this thread doesn't have an instance of the
threadlocal yet").

Test Plan:
leizha's test case doesn't segv after this diff---it was
reliably breaking with corruption in malloc before it.  I'm working on
making that test case into a unit test to add to this diff, but I'm
putting it up early in case there's something wrong with the theory
above or in case someone has an idea for a better fix.

Reviewed By: tudorb@fb.com

FB internal diff: D928534

11 years agofolly: attribute-aligned-arg must now be constant (not enum)
Jim Meyering [Tue, 13 Aug 2013 16:31:45 +0000 (09:31 -0700)]
folly: attribute-aligned-arg must now be constant (not enum)

Summary:
With gcc-4.8.[01], the argument to __attribute__((__aligned__(...)))
must be a literal;  using an enum member evokes this:

./folly/MPMCQueue.h:341:63: error: requested alignment is not an \
integer constant
size_t capacity_ FOLLY_ON_NEXT_CACHE_LINE;

Changing the enum member to this made no difference:

static constexpr size_t kFalseSharingRange = 64;

Test Plan: compile tao and run test suite

Reviewed By: andrei.alexandrescu@fb.com

FB internal diff: D926221

@override-unit-failures

11 years agofolly/Conv.h: remove unused local typedef
Andrew Gallagher [Mon, 12 Aug 2013 20:13:05 +0000 (13:13 -0700)]
folly/Conv.h: remove unused local typedef

Test Plan: compiled using gcc-4.8

Reviewed By: meyering@fb.com

FB internal diff: D923895

11 years agofolly: avoid use of has_trivial_destructor in FBVector.h
Jim Meyering [Wed, 29 May 2013 01:06:16 +0000 (18:06 -0700)]
folly: avoid use of has_trivial_destructor in FBVector.h

Summary:
This is required for gcc-4.8.x.
Use boost::has_trivial_destructor, not std::has_trivial_destructor.
The latter was never standard, and the now-std name (and the only one
supported in gcc-4.8.0) is std::is_trivially_destructible.

Test Plan:
fbmake runtests and then
run_unit_tests.sh with -r and again with -d

Reviewed By: njormrod@fb.com

FB internal diff: D923359

@override-unit-failures

11 years agoIOBuf compression
Tudor Bosman [Wed, 7 Aug 2013 00:01:37 +0000 (17:01 -0700)]
IOBuf compression

Summary: davejwatson: you asked

Test Plan: test added

Reviewed By: davejwatson@fb.com

FB internal diff: D917336

11 years agoRevert "[clang support] removed superfluous declarations from header files"
Andrew Gallagher [Mon, 5 Aug 2013 23:42:39 +0000 (16:42 -0700)]
Revert "[clang support] removed superfluous declarations from header files"

Summary: This reverts commit 49b197dfd02443e958906bac45059cea460e4e10.

Test Plan: contbuild

Reviewed By: akhilravidas@fb.com

FB internal diff: D915386

@override-unit-failures

11 years agoremoved superfluous declarations from header files
Bob Haarman [Mon, 5 Aug 2013 23:06:50 +0000 (16:06 -0700)]
removed superfluous declarations from header files

Summary:
Clang doesn't like the same member of a class being defined more than once,
or default argument values being defined more than once. This diff removes some
instances.

@override-unit-failures

Test Plan: Compiled the code with Clang and GCC

Reviewed By: andrewjcg@fb.com

FB internal diff: D913226

11 years agodereference
Tom Jackson [Sun, 4 Aug 2013 21:30:06 +0000 (14:30 -0700)]
dereference

Summary:
For dealing with sequences of pointers. Works with pointer wrappers,
and filters out nullptrs, see tests.

Test Plan: Unit tests

Reviewed By: tulloch@fb.com

FB internal diff: D914069

11 years agoFixing Until, Take
Tom Jackson [Fri, 2 Aug 2013 20:51:47 +0000 (13:51 -0700)]
Fixing Until, Take

Summary:
`apply()` returns false if and only if the handler it was //directly//
passed returned false. `Take` didn't do this right, and `Until` was just broken.

Test Plan: More thorough unit tests.

Reviewed By: kittipat@fb.com

FB internal diff: D913185

11 years agomake folly/Bits.h clang-compatible
Philip Pronin [Thu, 1 Aug 2013 08:42:27 +0000 (01:42 -0700)]
make folly/Bits.h clang-compatible

Summary: In clang (as of 3.2) intrinsics aren't `constexpr`.

Test Plan:
fbconfig folly/test:bits_test && fbmake opt -j32
fbconfig --clang folly/test:bits_test && fbmake opt -j32

Reviewed By: lucian@fb.com

FB internal diff: D910310

11 years agoBatch
Kittipat Virochsiri [Fri, 2 Aug 2013 20:25:35 +0000 (13:25 -0700)]
Batch

Summary: Convert stream of elements to stream of fixed-sized vectors.

Test Plan: unit tests

Reviewed By: tjackson@fb.com

FB internal diff: D912290

11 years agoUpdate build for Ubuntu 12.10. 12.04 seems to no longer compile
Dave Watson [Mon, 22 Apr 2013 22:05:36 +0000 (15:05 -0700)]
Update build for Ubuntu 12.10. 12.04 seems to no longer compile

Summary: Dave Watson put this in github a few months ago.

Test Plan: None

Reviewed By: delong.j@fb.com

FB internal diff: D912681

11 years agoMake ThreadLocalPtr behave sanely around fork()
Tudor Bosman [Thu, 1 Aug 2013 21:21:52 +0000 (14:21 -0700)]
Make ThreadLocalPtr behave sanely around fork()

Summary:
Threads and fork still don't mix, but we shouldn't help you shoot yourself in
the foot if you decide to do it.

Test Plan: test added

Reviewed By: mshneer@fb.com

FB internal diff: D911224

11 years agoCycle
Tom Jackson [Thu, 1 Aug 2013 20:54:24 +0000 (13:54 -0700)]
Cycle

Summary: For repeating a generator's values endlessly.

Test Plan: Unit tests

Reviewed By: kittipat@fb.com

FB internal diff: D911178

11 years agoFix build break for Clang builds.
Andrew Tulloch [Thu, 1 Aug 2013 21:26:12 +0000 (14:26 -0700)]
Fix build break for Clang builds.

Summary:
Complains about

```
In file included from crypto/lib/cpp/CryptoException.cpp:1:
In file included from crypto/lib/cpp/CryptoException.h:5:
In file included from ./folly/Conv.h:30:
./folly/Range.h:573:19: error: redefinition of default argument
Comp eq = Comp()) {
^    ~~~~~~
./folly/Range.h:55:26: note: previous definition is here
Comp eq = Comp());
^    ~~~~~~
```

Redefinition of default arguments is not allowed in C++.

Test Plan:
```
fbconfig --clang admarket/adpublisher && fbmake dbg
```

contbuild, etc.

Reviewed By: lucian@fb.com

FB internal diff: D910800

11 years agoUse std::equal<> as qfind default comparator
Josh Metzler [Tue, 30 Jul 2013 17:36:58 +0000 (10:36 -0700)]
Use std::equal<> as qfind default comparator

Summary:
qfind(haystack, needle) is templated, but used a non-templated
default comparator that cast everything to char.  This works find for
8-bit types, but not for others such as the uint32_t Ranges we are
using.  Replace the default comparator with std::equal<> to use a
working comparator for whatever type is being searched.

Test Plan:
Compiles, unit tests (including a new one that fails with the
old code) pass.  Not sure how to test other users of this, or measure
performance impact. :(

Reviewed By: andrei.alexandrescu@fb.com

FB internal diff: D906311

11 years agofix folly Range compilation on FreeBSD
Sean Cannella [Mon, 29 Jul 2013 19:36:55 +0000 (12:36 -0700)]
fix folly Range compilation on FreeBSD

Summary: - memrchr is GNU + Linux specific, it turns out

Test Plan: - compiled on FreeBSD, contbuild

Reviewed By: delong.j@fb.com

FB internal diff: D900935

11 years agofix folly compilation on FreeBSD
Sean Cannella [Tue, 23 Jul 2013 18:25:13 +0000 (11:25 -0700)]
fix folly compilation on FreeBSD

Summary:
- fix folly compilation on FreeBSD

Github Author: Martin Matuska <martin@matuska.org>

Test Plan: - compiled

Reviewed By: tudorb@fb.com

FB internal diff: D896747

11 years agoMulti-Producer, Multi-Consumer pipeline
Tudor Bosman [Fri, 19 Jul 2013 01:05:51 +0000 (18:05 -0700)]
Multi-Producer, Multi-Consumer pipeline

Summary:
A bunch of MPMCQueues linked together. Stage i produces exactly Ki (default 1)
outputs for each input. Ordering is preserved, even though stages might
produce (intermediate or final) results in parallel and in any order; we do
this by abusing the enqueueing mechanism in MPMCQueue. (Read the code for
details)

Test Plan: test added, more tests to be written before commit

Reviewed By: ngbronson@fb.com

FB internal diff: D892388

11 years agofolly/MPMCQueue sizeGuess should return a signed int
Nathan Bronson [Fri, 19 Jul 2013 18:12:59 +0000 (11:12 -0700)]
folly/MPMCQueue sizeGuess should return a signed int

Summary:
Like size(), sizeGuess() is allowed to return a negative value,
so it should be ssize_t instead of uint64_t.

Test Plan: fbmake, wait for contbuild

Reviewed By: tudorb@fb.com

FB internal diff: D893075

11 years agofolly/Hash.h add a test to ensure different hashes
Hans Fugal [Thu, 18 Jul 2013 00:40:41 +0000 (17:40 -0700)]
folly/Hash.h add a test to ensure different hashes

Summary:
"Wouldn't this test case still pass if the hash function didn't depend on the value?

It would be nice to verify that different tuple values produce different hash values (or maybe there's another test that verifies that), especially since this is a tricky thing to get right."

I think there's not much chance of this failing since it's just leveraging hash_combine and that's already tested. But it's easy to add another sanity check, so here we are.

Test Plan: runtests

Reviewed By: tulloch@fb.com

FB internal diff: D890448

Blame Revision: D888796

11 years agotuple hashing
Hans Fugal [Wed, 17 Jul 2013 01:34:51 +0000 (18:34 -0700)]
tuple hashing

Summary:
Add hash support for std::tuple.
See also D490478 (where a first attempt was made) and D543586 (where that attempt was deemed broken and removed).

Test Plan: unit test

Reviewed By: chip@fb.com

FB internal diff: D888796

11 years agoOSX compat fixes
Sean Cannella [Mon, 15 Jul 2013 15:32:29 +0000 (08:32 -0700)]
OSX compat fixes

Summary:
fix OSX compat issues

Github Author: Daniel Sloof <goapsychadelic@gmail.com>

Test Plan: - compiled

Reviewed By: pt@fb.com

FB internal diff: D877309

11 years agoAdd initializer_list support to folly::join
Chip Turner [Mon, 8 Jul 2013 19:36:53 +0000 (12:36 -0700)]
Add initializer_list support to folly::join

Summary:
Apparently the templates don't like to match the initlializer
list, so this needed to be added.  This allows for things like:

auto s = join(":", {val1, val2, val3, val4, val4});

Test Plan: run tests

Reviewed By: andrei.alexandrescu@fb.com

FB internal diff: D878032

11 years agoguard<Exception>() (redo)
Tom Jackson [Mon, 8 Jul 2013 19:41:11 +0000 (12:41 -0700)]
guard<Exception>() (redo)

Summary:
For handling exceptions from downstream operations.

Now with cleaner build.

Test Plan: Unit tests, including those outside `folly`.

Reviewed By: marcelo.juchem@fb.com

FB internal diff: D877795

Blame Revision: https://phabricator.fb.com/D872581

11 years agoFix folly/FBString.h build error
Chip Turner [Wed, 10 Jul 2013 21:05:49 +0000 (14:05 -0700)]
Fix folly/FBString.h build error

Summary:
Looks like D880140 left off this part when it was committed.

This fixes the build.

Test Plan: runtests

Reviewed By: vini@fb.com

FB internal diff: D881445

11 years agoFix build breakage in hphp
Andrei Alexandrescu [Tue, 9 Jul 2013 23:11:19 +0000 (16:11 -0700)]
Fix build breakage in hphp

Summary:
This should fix the build breakage in hphp caused by the latest fbstring changes (after being ported to engshare). Note that I'm flying blind here; I couldn't test with the hphp build because I don't have write access to engshare. @agallagher could you please make sure that this works after the fix?

fbconfig -r hphp && fbmake dbg

Test Plan: tested on folly

Reviewed By: tudorb@fb.com

FB internal diff: D880140

11 years agofbstring::shrink_to_fit
Andrei Alexandrescu [Fri, 28 Jun 2013 01:40:35 +0000 (18:40 -0700)]
fbstring::shrink_to_fit

Summary: Adds the eponymous C++11 capability to fbstring.

Test Plan: fbstring runtests

Reviewed By: tudorb@fb.com

FB internal diff: D867995

11 years agoAllowing trailing comma in folly::parseJson
Tom Jackson [Tue, 2 Jul 2013 19:29:10 +0000 (12:29 -0700)]
Allowing trailing comma in folly::parseJson

Summary:
Introduced a new serialization option, `allow_trailing_comma`, which allows trailing commas to be included in strings when they are parsed. This isn't strictly allowed by RFC 4627, but we're allowing more than that anyway.

I've run into this dozens of times, especially while using SMC.

Test Plan: Unit tests

Reviewed By: delong.j@fb.com

FB internal diff: D872581

11 years agoRevert D874344 (it broke the build)
Chip Turner [Mon, 8 Jul 2013 18:05:36 +0000 (11:05 -0700)]
Revert D874344 (it broke the build)

Summary:
Clean revert.  Please be more careful; phabricator warned you
these would break the build.

Test Plan: build something that wasn't working

Reviewed By: myang@fb.com

FB internal diff: D877526

11 years agoguard<Exception>()
Tom Jackson [Wed, 3 Jul 2013 18:38:32 +0000 (11:38 -0700)]
guard<Exception>()

Summary: For handling exceptions from downstream operations.

Test Plan: Unit tests

Reviewed By: marcelo.juchem@fb.com

FB internal diff: D874344

11 years agomove assignment operators for folly::Synchronized
Philip Pronin [Fri, 5 Jul 2013 03:01:37 +0000 (20:01 -0700)]
move assignment operators for folly::Synchronized

Summary:
* added move assignment operators,
* fixed `operator=(const Synchronized& rhs)` (it had a typo),
* fixed deadlock on self-assignment,
* changed `swap` to call `swap(lhs.datum_, rhs.datum_)` instead of `lhs.datum_.swap(rhs.datum_)`.

Test Plan: fbconfig -r folly/test && fbmake opt -j32 && fbmake runtests_opt

Reviewed By: delong.j@fb.com

FB internal diff: D875977

11 years agomemrchr and *timed_mutex are platform-specific
Sean Cannella [Wed, 3 Jul 2013 20:36:28 +0000 (13:36 -0700)]
memrchr and *timed_mutex are platform-specific

Summary:
- conditionally compile rfind overrides
- conditionally add support for timed_mutex/recursive_timed_mutex

Test Plan:
- compiled on OSX
- unit tests

Reviewed By: andrei.alexandrescu@fb.com

FB internal diff: D872272

11 years agostrerror_r is XSI compliant on Apple/FreeBSD
Sean Cannella [Mon, 1 Jul 2013 15:06:12 +0000 (08:06 -0700)]
strerror_r is XSI compliant on Apple/FreeBSD

Summary:
- Noticed this due to an -fpermissive compiler warning while compiling
HHVM for OSX (complaint of trying to cast int to char*)

Test Plan:
- Compiled
- Confirmed the build warning is fixed by this on the Mac OS X build

Reviewed By: tudorb@fb.com

FB internal diff: D865169

11 years agotoDynamic(T)
Tom Jackson [Tue, 23 Apr 2013 17:02:07 +0000 (10:02 -0700)]
toDynamic(T)

Summary: It only makes sense to be able to go the other direction, too.

Test Plan: Unit tests

Reviewed By: delong.j@fb.com

FB internal diff: D785282

11 years agoRange<T>::rfind()
Tom Jackson [Wed, 26 Jun 2013 23:53:58 +0000 (16:53 -0700)]
Range<T>::rfind()

Test Plan: Unit tests

Reviewed By: andrei.alexandrescu@fb.com

FB internal diff: D865951

11 years agoMulti-producer multi-consumer queue with optional blocking
Nathan Bronson [Fri, 28 Jun 2013 20:42:14 +0000 (13:42 -0700)]
Multi-producer multi-consumer queue with optional blocking

Summary:
MPMCQueue<T> is a high-performance bounded concurrent queue that
supports multiple producers, multiple consumers, and optional blocking.
The queue has a fixed capacity, for which all memory will be allocated
up front.  The bulk of the work of enqueuing and dequeuing can be
performed in parallel.

To make an MPMCQueue<T>, T must satisfy either of two conditions:
- it has been tagged FOLLY_ASSUME_FBVECTOR_COMPATIBLE; or
- both the constructor used during enqueue and the move operator are
marked noexcept.

This diff extracts the generic component from tao/queues/ConcurrentQueue
and renames identifiers to match those of existing folly queues.
It also includes an extraction of Futex, which wraps the futex syscall,
and DeterministicScheduler, which allows for deterministic exploration
of thread interleavings for components built from std::atomic and Futex.

Test Plan: new unit tests

Reviewed By: tudorb@fb.com

FB internal diff: D866566

11 years agoconst'ing sorted_vector_map::count()
Tom Jackson [Wed, 26 Jun 2013 19:32:28 +0000 (12:32 -0700)]
const'ing sorted_vector_map::count()

Test Plan: Use it

Reviewed By: tudorb@fb.com

FB internal diff: D865211

11 years agofix tautological comparisons in Conv.h
Louis Brandy [Thu, 20 Jun 2013 00:01:38 +0000 (17:01 -0700)]
fix tautological comparisons in Conv.h

Summary:
We have an off-by-one in our enable_if/sfinae logic here. We do not want to actually do the comparison in `less_than` when the rhs is exactly the minimum possible lhs. This results in a tautological comparison.

I added a unit test for these traits that test all the various sfinae cases.

Test Plan: See the clang tautological warnings go away. Under gcc, rerun all tests. All pass.

Reviewed By: marcelo.juchem@fb.com

FB internal diff: D856869

11 years agoSpeed up EventCount, now 64-bit only
Tudor Bosman [Fri, 21 Jun 2013 03:14:35 +0000 (20:14 -0700)]
Speed up EventCount, now 64-bit only

Summary:
Don't use two atomic variables when only one will suffice (otherwise, the
increments in doNotify() and prepareWait() would require memory_model_seq_cst,
because they need to globally order a store before a load, and no weaker
model allows you to do that)

Of course, this makes this 64-bit only, but I don't care.

Test Plan: eventcount_test, tests outside of folly

Reviewed By: delong.j@fb.com

FB internal diff: D858963

11 years agoStringPiece comparisons are broken
Tudor Bosman [Mon, 24 Jun 2013 19:48:43 +0000 (12:48 -0700)]
StringPiece comparisons are broken

Summary:
8-bit StringPiece comparisons are broken.
The reason is char_traits is magic for 'char', but not 'const char'.

Test Plan: test added

Reviewed By: chip@fb.com

FB internal diff: D861521

11 years agoadd Chrono.h to patch around a gcc 4.6 issue
Tudor Bosman [Fri, 21 Jun 2013 16:18:37 +0000 (09:18 -0700)]
add Chrono.h to patch around a gcc 4.6 issue

Test Plan: used it

Reviewed By: soren@fb.com

FB internal diff: D859244

11 years agoUse libunwind instead of the heavyweight thing from libgcc
Tudor Bosman [Thu, 20 Jun 2013 21:15:17 +0000 (14:15 -0700)]
Use libunwind instead of the heavyweight thing from libgcc

Test Plan: exception_tracer_test

Reviewed By: bmaurer@fb.com

FB internal diff: D858195

11 years agoAdd MultiLevelTimeSeries to folly.
Stephen Chen [Fri, 14 Jun 2013 22:46:44 +0000 (15:46 -0700)]
Add MultiLevelTimeSeries to folly.

Summary:
Add MultiLevelTimeSeries class which represents a timeseries which keeps several
levels of data granularity (similar in principle to the loads reported by the
UNIX 'uptime' command).  It uses several instances (one per level) of
BucketedTimeSeries as the underlying storage.

This can easily be used to track sums (and thus rates or averages) over several
predetermined time periods, as well as all-time sums.  For example, you would
use to it to track query rate or response speed over the last 5, 15, 30, and 60
minutes.

Test Plan: unittest included.

Reviewed By: simpkins@fb.com

FB internal diff: D851444

11 years agorename template parameters in folly::greater_than
Louis Brandy [Wed, 19 Jun 2013 23:39:45 +0000 (16:39 -0700)]
rename template parameters in folly::greater_than

Summary: This template is only used in folly::Conv (to avoid tautological comparisons) and as best as I can tell, the rhs/lhs names are not correct as it's currently used (and not consistent with `less_than`). Just swap rhs/lhs variable names.

Test Plan:
Test Results Summary:
Passed: 471
100% successful

Reviewed By: marcelo.juchem@fb.com

FB internal diff: D856785

11 years agofolly: accommodate use of -Wshadow in other projects
Jim Meyering [Thu, 13 Jun 2013 16:54:17 +0000 (09:54 -0700)]
folly: accommodate use of -Wshadow in other projects

Summary:
Without this change, any folly-using project that attempts to enable
gcc's -Wshadow option will be overwhelmed by warnings about violations
in folly's class definitions.  Violations are often due to local
variable or parameter names shadowed by a member function.

Bracket offending content with directives like this:

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
...
#pragma GCC diagnostic pop

This set of modified files is the minimal set to allow tao
to use -Wshadow with no folly-related warning.

Test Plan:
fbmake folly/test && fbmake opt

Reviewed By: simpkins@fb.com

FB internal diff: D848455

11 years agorework the Subprocess::communicate() API
Adam Simpkins [Thu, 16 May 2013 02:03:40 +0000 (19:03 -0700)]
rework the Subprocess::communicate() API

Summary:
This eliminates the CommunicateFlags argument to communicate().  It now
always reads from both stdout and stderr if they were set up a pipes.
If a non-empty input buffer was supplied, it always writes that to
stdin.

This mimics the communicate() behavior of python's subprocess.py module.
This also makes it impossible to have buffering deadlocks by forgetting
to call communicate() with readStderr().

Test Plan:
Ran the existing subprocess tests, and also added a more complicated
duplex test that requires communication on stdin, stdout, and stderr all
at the same time.

Also grepped for all existing users of Subprocess::communicate(), and
made sure they will work correctly with the new behavior.

Reviewed By: tudorb@fb.com

FB internal diff: D814405

11 years agoFolly Changes for Clang, revision 1
Todd Nowacki [Tue, 4 Jun 2013 21:43:22 +0000 (14:43 -0700)]
Folly Changes for Clang, revision 1

Summary:
Depends on D829162 and D830052

A few changes are needed to get folly compiling with clang.
There are likely more changes to compile all of folly

---folly/Bits.cpp
+++folly/folly-config.h
Moved ifunc check, and added an additional check for clang, instead of hard
coding it to be 1

~~~folly/Range.cpp
Moved the declaration of a function to get rid of clang's unused function
warning.

Test Plan:
This bit of code was a dependency in another project.
That code compiled as it needed to

See other diff for more test details

Reviewed By: oyamauchi@fb.com

FB internal diff: D830075

11 years agoFix some issues in allocator_delete
Jordan DeLong [Mon, 3 Jun 2013 23:14:50 +0000 (16:14 -0700)]
Fix some issues in allocator_delete

Summary:
The unique_ptr implementation was getting confused about how
to determine the pointer type, so just tell it.

Facebook: Broke the fxl build; test plan included recompiling it.

Test Plan: Built.

Reviewed By: marcelo.juchem@fb.com

FB internal diff: D834371

11 years agoMake folly::allocator_delete take advantage of EBO
Jordan DeLong [Sun, 2 Jun 2013 03:55:24 +0000 (20:55 -0700)]
Make folly::allocator_delete take advantage of EBO

Summary: It wasn't.

Test Plan:
I have a case using this that now passes a static_assert
that it's the same size as the default_deleter version.  I didn't add
a static_assert in folly's tests because right now
is_simple_allocator<int,std::allocator<int>>::value is true (I think
because the tested members come from a base class), which breaks easy
test cases.

Reviewed By: andrei.alexandrescu@fb.com

FB internal diff: D833142

11 years agoosx on folly take 2
Paul Tarjan [Fri, 31 May 2013 22:01:14 +0000 (15:01 -0700)]
osx on folly take 2

Summary: using ULL broke everything. Lets try the case @danslo originally suggested.

Test Plan: will check errors for this file

Reviewed By: delong.j@fb.com

FB internal diff: D832165

11 years agorevert folly/Benchmark.cpp
Paul Tarjan [Fri, 31 May 2013 21:55:52 +0000 (14:55 -0700)]
revert folly/Benchmark.cpp

Summary: revert the breaking change

Test Plan: none

Reviewed By: delong.j@fb.com

FB internal diff: D832143

Blame Revision: D830883

11 years agomake folly build on OSX
Daniel Sloof [Tue, 28 May 2013 08:17:55 +0000 (10:17 +0200)]
make folly build on OSX

Summary:
A squash of https://github.com/danslo/folly/compare/master

Github Author: danslo

Test Plan: he said it compiles on OSX

Reviewed By: oyamauchi@fb.com

FB internal diff: D830883

11 years agoadd missing include
Owen Yamauchi [Thu, 30 May 2013 20:24:04 +0000 (13:24 -0700)]
add missing include

Summary:
Newer versions of boost fail without this. I guess mutex.hpp doesn't
include lock_guard.hpp indirectly anymore, or something.

Test Plan:
built on OS X. This was part of what I had to do for my OS
X-building attempts from a few weeks ago.

Reviewed By: delong.j@fb.com

FB internal diff: D830157

11 years agoeachToTuple<Types...>()
Tom Jackson [Wed, 29 May 2013 01:17:37 +0000 (18:17 -0700)]
eachToTuple<Types...>()

Summary: For parsing records. `eachToPair` might be a worthwhile specialization.

Test Plan: Unit tests, benchmarks maybe?

Reviewed By: antoine@fb.com

FB internal diff: D827441

11 years agoHACK: New Gen operators: zip, interleave
Mike Curtiss [Sat, 2 Mar 2013 06:27:56 +0000 (22:27 -0800)]
HACK: New Gen operators: zip, interleave

Summary:
Zip: inspired by python's zip()
o Combine a generator with the contents of a container to form
a tuple.  Note that we combine with a container (and not
another generator) because of a fundamental constraint
in how control-flow in Generators works.  Containers give us 90%
of the utility without all the hassle.  We could theoretically
also add a version of zip where the extra source is generated
concurrently in another thread.

Interleave: similar to zip, but inspired by Clojure's interleave()
o Instead of creating a tuple like zip, just flatten the values.

Added some tuple creation/concatenation functions.  These are mostly
meant as a way to enable zip'ing multiple containers together into an
N-tuple. (My variadic-fu was not strong enough to get this working
within a single Zip function).

Test Plan: Added unit-tests

Reviewed By: tjackson@fb.com

FB internal diff: D740518

11 years agocorrect broken testcase
John Fremlin VII [Tue, 28 May 2013 18:28:14 +0000 (11:28 -0700)]
correct broken testcase

Summary:
Turns out that phabricator and arc unit do not actually run
tests in our internal repo and this one had a bunch of syntax errors.

doh

No test cases were changed, just fixing syntax.

Test Plan:
- fbconfig folly/test

- fbmake runtests

- saw all ok

- _bin/folly/test/json_test

[==========] Running 10 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 10 tests from Json
[ RUN      ] Json.Unicode
[       OK ] Json.Unicode (0 ms)
[ RUN      ] Json.Parse
[       OK ] Json.Parse (1 ms)
[ RUN      ] Json.JavascriptSafe
[       OK ] Json.JavascriptSafe (0 ms)
[ RUN      ] Json.Produce
[       OK ] Json.Produce (0 ms)
[ RUN      ] Json.JsonEscape
[       OK ] Json.JsonEscape (0 ms)
[ RUN      ] Json.JsonNonAsciiEncoding
[       OK ] Json.JsonNonAsciiEncoding (0 ms)
[ RUN      ] Json.UTF8Retention
WARNING: Logging before InitGoogleLogging() is written to STDERR
I0528 11:29:43.879976 17977 JsonTest.cpp:257] input: ♥ => json: "♥"
I0528 11:29:43.880077 17977 JsonTest.cpp:259] output: ♥ => json: "♥"
[       OK ] Json.UTF8Retention (1 ms)
[ RUN      ] Json.UTF8EncodeNonAsciiRetention
I0528 11:29:43.880122 17977 JsonTest.cpp:284] input: ♥ => json: "\u2665"
I0528 11:29:43.880131 17977 JsonTest.cpp:286] output: ♥ => json: "\u2665"
[       OK ] Json.UTF8EncodeNonAsciiRetention (0 ms)
[ RUN      ] Json.UTF8Validation
[       OK ] Json.UTF8Validation (0 ms)
[ RUN      ] Json.ParseNonStringKeys
[       OK ] Json.ParseNonStringKeys (0 ms)
[----------] 10 tests from Json (2 ms total)

[----------] Global test environment tear-down
[==========] 10 tests from 1 test case ran. (2 ms total)
[  PASSED  ] 10 tests.

Reviewed By: delong.j@fb.com

FB internal diff: D826413

Blame Revision: D805218

11 years agoallow reading maps from number -> value
John Fremlin VII [Tue, 21 May 2013 23:04:40 +0000 (16:04 -0700)]
allow reading maps from number -> value

Summary:
The serialization of PHP values often uses integer -> value
maps in JSON arrays. These are emitted by the standard stream <<
operator on dynamics but cannot be read. This diff fixes that.

Test Plan: - read in serialized value with array "bucketing":{"days_stale":{0:{2:null,1:14.01,0:"more_than_two_weeks_stale"}}}

Reviewed By: delong.j@fb.com

FB internal diff: D805218

11 years agoadd openNoInt, truncateNoInt, ftruncateNoInt
Tudor Bosman [Wed, 15 May 2013 04:28:50 +0000 (21:28 -0700)]
add openNoInt, truncateNoInt, ftruncateNoInt

Test Plan: it compiles

Reviewed By: soren@fb.com

FB internal diff: D825286

11 years agoAdd QueueAppender
Tudor Bosman [Tue, 21 May 2013 17:59:39 +0000 (10:59 -0700)]
Add QueueAppender

Summary:
Add an Appender that appends to a IOBufQueue.  You can pass in the maximum
append size if you know it, and it will throw on overflow, and will never
allocate IOBufs larger than the remaining size.

Test Plan: test added

Reviewed By: davejwatson@fb.com

FB internal diff: D820160

11 years agomake folly:make_unique support customized deleter
Xu Ning [Fri, 24 May 2013 23:02:12 +0000 (16:02 -0700)]
make folly:make_unique support customized deleter

Summary: just follow the same template arguments as unique_ptr

Test Plan: compile

Reviewed By: marcelo.juchem@fb.com

FB internal diff: D825025

11 years agomember(&Foo::getter), field(&Foo::field)
Tom Jackson [Thu, 23 May 2013 22:34:03 +0000 (15:34 -0700)]
member(&Foo::getter), field(&Foo::field)

Summary: For easily calling a getter on every item in a sequence.

Test Plan: Unit tests, benchmarks

Reviewed By: mmcurtiss@fb.com

FB internal diff: D651206

11 years agoSome documentation updates in lazy
Jordan DeLong [Wed, 22 May 2013 21:23:51 +0000 (14:23 -0700)]
Some documentation updates in lazy

Summary: Per discussion after commit on the previous diff.

Test Plan: Compiled.

Reviewed By: tjackson@fb.com

FB internal diff: D821985

11 years agoAdd folly::lazy
Jordan DeLong [Sun, 19 May 2013 21:47:39 +0000 (14:47 -0700)]
Add folly::lazy

Summary:
A thin wrapper around Optional for terse creation of
lazily-initialized values.

Test Plan: New tests, and a use case in hphp.

Reviewed By: tjackson@fb.com

FB internal diff: D817906

11 years agoAllow escapeString in folly/json.cpp to be called by other methods.
Maxime Boucher [Mon, 20 May 2013 08:26:55 +0000 (01:26 -0700)]
Allow escapeString in folly/json.cpp to be called by other methods.

Summary: See title.

Test Plan:
From fbocde, type:
fbconfig folly/test; fbmake opt -j 32; fbmake runtests_opt -j 32

Reviewed By: delong.j@fb.com

FB internal diff: D818077

11 years agoGen apply comment
Mike Curtiss [Thu, 16 May 2013 18:16:37 +0000 (11:16 -0700)]
Gen apply comment

Summary: Comment

Test Plan: Builds

Reviewed By: tjackson@fb.com

FB internal diff: D814986

11 years agodelete unused variable
Paul Tarjan [Mon, 20 May 2013 18:33:17 +0000 (11:33 -0700)]
delete unused variable

Test Plan: none

Reviewed By: tjackson@fb.com

FB internal diff: D818326

11 years agogen::sample
Mike Curtiss [Tue, 14 May 2013 05:05:06 +0000 (22:05 -0700)]
gen::sample

Summary:
Take a random sample of size N from a range.  Clients
can also pass in a custom random number generator.

Test Plan: Added test and benchmark.

Reviewed By: tjackson@fb.com

FB internal diff: D811260

11 years agoUpdate Subprocess to throw if exec() fails
Adam Simpkins [Tue, 16 Apr 2013 00:58:47 +0000 (17:58 -0700)]
Update Subprocess to throw if exec() fails

Summary:
Add a new SubprocessSpawnError, and change the Subprocess constructor to
throw this if the child process encounters an error before calling
execve().  Error information is passed back to the parent process over a
pipe.

Previosly in this case the Subprocess constructor would fail, and
clients would simply get a return code of 126 or 127 when waiting on the
process.  There was no way to distinguish this from a successful
execve() followed by the child process exiting with status 127.

Test Plan:
Added tests to check the exception behavior, and also to check for file
descriptor leaks in the parent process.

Reviewed By: tudorb@fb.com

FB internal diff: D776273

11 years agoExpose a human-readable type name for a dynamic
Chip Turner [Tue, 14 May 2013 23:44:27 +0000 (16:44 -0700)]
Expose a human-readable type name for a dynamic

Summary: Aids in debugging dynamic types, etc.

Test Plan: unit tests

Reviewed By: delong.j@fb.com

FB internal diff: D812385

11 years agoNew feature support in folly::AtomicHash*
Mark Williams [Thu, 9 May 2013 18:41:55 +0000 (11:41 -0700)]
New feature support in folly::AtomicHash*

Summary:
AtomicHashMap/AtomicHashArray didn't support a custom equality
function, and didnt support pointer keys. We only ever do
compare-and-swap against the 3 "magic" keys, so as long as we're
careful we can continue to do that, while using the equality
function elsewhere.

Also add a user-configurable growth rate, independent of
maxLoadFactor.

Test Plan: automated tests

Reviewed By: delong.j@fb.com

FB internal diff: D806936

11 years agoAdd fsyncNoInt, fdatasyncNoInt
Tudor Bosman [Sat, 11 May 2013 21:35:43 +0000 (14:35 -0700)]
Add fsyncNoInt, fdatasyncNoInt

Test Plan: compiled file_util_test

Reviewed By: soren@fb.com

FB internal diff: D809250

11 years agoReplace CHECK in Range.h by throw std::out_of_range
Maxime Boucher [Sun, 12 May 2013 04:33:07 +0000 (21:33 -0700)]
Replace CHECK in Range.h by throw std::out_of_range

Summary:
Calling CHECK() in folly will force the program to abort in case of a failure.
On the other hand, for range checking, the standard library throws std::out_of_range for many functions.

Thus it could be a good idea to throw the same exception in folly so that errors can be handled using try {} catch (...) {} blocks.

Test Plan:
from fbcode, type:
fbconfig -r folly; fbmake opt -j32; fbmake runtests_opt -j 32

What other tests should I run?

Reviewed By: tudorb@fb.com

FB internal diff: D808204

11 years agoReplace CHECK in Range.h by throw std::out_of_range
Maxime Boucher [Fri, 10 May 2013 18:42:20 +0000 (11:42 -0700)]
Replace CHECK in Range.h by throw std::out_of_range

Summary:
Calling CHECK() in folly will force the program to abort in case of a failure.
On the other hand, for range checking, the standard library throws std::out_of_range for many functions.

Thus it could be a good idea to throw the same exception in folly so that errors can be handled using try {} catch (...) {} blocks.

Test Plan:
from fbcode, type:
fbconfig -r folly; fbmake opt -j32; fbmake runtests_opt -j 32

What other tests should I run?

Reviewed By: tudorb@fb.com

FB internal diff: D808204

11 years agoUnbreak build on glibc 2.5.1
Tudor Bosman [Thu, 9 May 2013 22:50:02 +0000 (15:50 -0700)]
Unbreak build on glibc 2.5.1

Summary:
Also move manually-generated stuff away from folly-config.h and into
Portability.h.  This should be only for things that differs between the
various (compiler, library) pairs used internally at FB; everything else
should be autoconf-ed and therefore go into folly-config.h.

Test Plan: built and ran file_util_test on various platforms

Reviewed By: delong.j@fb.com

FB internal diff: D807067

Blame Revision: D806781

11 years agofix segfault on fb platform
Tudor Bosman [Thu, 9 May 2013 22:17:13 +0000 (15:17 -0700)]
fix segfault on fb platform

Summary: Strings can be moved around while the vector grows.

Test Plan: file_util_test

Reviewed By: lucian@fb.com

FB internal diff: D806966

Blame Revision: D806781

11 years agoconvert RecordIO to pwritev
Tudor Bosman [Thu, 9 May 2013 21:27:56 +0000 (14:27 -0700)]
convert RecordIO to pwritev

Summary: zero-copy

Test Plan: record_io_test

Reviewed By: lucian@fb.com

FB internal diff: D806813

11 years agoAdd missing FileUtil functions (p?readvFull, p?writevFull) , add test
Tudor Bosman [Thu, 9 May 2013 21:16:35 +0000 (14:16 -0700)]
Add missing FileUtil functions (p?readvFull, p?writevFull) , add test

Summary:
Testing incomplete reads / writes is hard, so I'm only testing the wrappers
(template functions that take the underlying operation and retry it in
case of incomplete operations).  Note the cute hack of using variadic
templates to use the same wrapper for both file pointer- and explicit-position
flavors of the functions (the offset argument becomes optional).

Test Plan: test added

Reviewed By: lucian@fb.com

FB internal diff: D806781

11 years agoMake folly::AsyncIO thread safe
Tudor Bosman [Wed, 8 May 2013 21:40:10 +0000 (14:40 -0700)]
Make folly::AsyncIO thread safe

Summary:
You can now submit to the same AsyncIO object from different threads, but you
must still reap from only one thread at a time.

Test Plan: async_io_test, added MT test

Reviewed By: philipp@fb.com

FB internal diff: D804914

11 years agoBreak dependency on endian.h
Owen Yamauchi [Fri, 3 May 2013 19:16:14 +0000 (12:16 -0700)]
Break dependency on endian.h

Summary:
gcc and clang both give you these three macros pre-defined. I've found a
reference on the interweb to this being broken
(http://gcc.gnu.org/ml/gcc/2011-08/msg00152.html) but that was with gcc
4.4. I've tested with 4.6, 4.7 and clang 3.2 and they all do the right
thing on little-endian (internal build and OS X). Alas, I don't have a
big-endian system handy to test with.

Test Plan: fbconfig/fbmake runtests.

Reviewed By: simpkins@fb.com

FB internal diff: D799416

11 years agoBreak dependency on byteswap.h
Owen Yamauchi [Fri, 3 May 2013 17:43:36 +0000 (10:43 -0700)]
Break dependency on byteswap.h

Summary:
Unfortunately, this doesn't exist on all platforms. Fortunately, both
gcc and clang support builtins that do the same thing as the bswap_*
functions we were including byteswap.h for.

I changed the test file to hardcode expected results for the swapping
functions. Is that OK? It seemed a little silly to be testing the
Endian::whatever functions by comparing them against the functions that
they're implemented in terms of.

Test Plan:
fbconfig/fbmake runtests with gcc 4.6 and 4.7. Verified
separately that clang supports these builtins.

Reviewed By: simpkins@fb.com

FB internal diff: D799244

11 years agoBreak dependency on features.h
Owen Yamauchi [Fri, 3 May 2013 16:25:39 +0000 (09:25 -0700)]
Break dependency on features.h

Summary:
It doesn't exist on some systems (at least Mac OS X). We're only using
it for __GNUC_PREREQ, which is easy to provide our own definition for.

I moved the definitions of FOLLY_FINAL and FOLLY_OVERRIDE into
folly-config.h so we can autoconf them in the open-source build. The
hardcoded stuff for the internal build is a little ugly, unfortunately.

folly can't be built with gcc versions earlier than 4.6, so that check
in ThreadLocal.h is pointless by now. (Plus we use noexcept without a
macro wrapper all over the place.) That stuff was also not
clang-friendly. clang has supported static_assert since 2.9 and noexcept
since... I'm not sure but at least 3.0.

Test Plan:
fbconfig/fbmake runtests, with gcc 4.6 and 4.7. clang can't
build folly right now, but I verified separately that it supports
noexcept and static_assert.

Reviewed By: simpkins@fb.com

FB internal diff: D799143

11 years ago(Folly) Remove unused variable according to -Wunused-variable
Hannes Roth [Fri, 3 May 2013 16:37:17 +0000 (09:37 -0700)]
(Folly) Remove unused variable according to -Wunused-variable

Summary:
I am trying to move more code into a HPHP extension, and it's complaining about
this.

Test Plan: `fbconfig -r folly && fbmake runtests`

Reviewed By: delong.j@fb.com

FB internal diff: D799096

11 years agoFail the configure script if you don't have boost
Owen Yamauchi [Tue, 30 Apr 2013 21:33:21 +0000 (14:33 -0700)]
Fail the configure script if you don't have boost

Summary:
Discovered this while trying to build folly on OS X. It would print a
warning about Boost being missing that got drowned out in the rest of
the configure output, and then the build would fail. This makes the
failure more friendly.

Test Plan:
`autoreconf; ./configure` on a system without boost
installed; make sure configure fails and the last thing it prints is the
boost error message.

Reviewed By: delong.j@fb.com

FB internal diff: D797389

11 years agoAdd read*String() methods to Cursor
Peter Griess [Wed, 1 May 2013 03:06:55 +0000 (20:06 -0700)]
Add read*String() methods to Cursor

Summary:
- Add some convenience methods for reading std::string objects via
folly::Cursor

Test Plan: - Unit tests

Reviewed By: simpkins@fb.com

FB internal diff: D795428

11 years agoFixed-size split()
Tom Jackson [Tue, 30 Apr 2013 20:13:34 +0000 (13:13 -0700)]
Fixed-size split()

Summary:
There are quite a few places where we split strings into a fixed number
of fields. This enables this to be done a bit faster by not using any
variable-length structures at runtime.

Test Plan: Unit tests, Benchmarks

Reviewed By: philipp@fb.com

FB internal diff: D794523

11 years agoRecordIO: robust record-based streaming I/O
Tudor Bosman [Thu, 25 Apr 2013 03:29:08 +0000 (20:29 -0700)]
RecordIO: robust record-based streaming I/O

Summary:
RecordIO provides an interface to write and read streams of variable-length
records that is resilient in the face of failure and data corruption.  If
the stream is corrupted in any way, you will lose records, but the stream
will resynchronize.

We have one implementation of RecordIO reader/writer that reads from / writes
to regular files (using mmap(), even for writes, so we can preserve state
even in case of process death -- the buffer cache will flush things to disk
eventually) and we expose enough of the guts (in a reasonably clean way)
so you can build your own on top of other backends.

Test Plan: test added

Reviewed By: mmcurtiss@fb.com

FB internal diff: D790275

11 years agoflock locks in folly::File, FileUtil, Exception.h fixes and tests
Tudor Bosman [Fri, 26 Apr 2013 22:32:36 +0000 (15:32 -0700)]
flock locks in folly::File, FileUtil, Exception.h fixes and tests

Summary:
Test required a separate process, as fcntl locks are always re-granted to
a process that holds the lock.

Test Plan: new tests, all tests under folly

Reviewed By: lucian@fb.com

FB internal diff: D791370

11 years agoFix build for folly_fb_platform
Jordan DeLong [Sun, 28 Apr 2013 16:27:03 +0000 (09:27 -0700)]
Fix build for folly_fb_platform

Summary:
This wasn't building with an error from a warning about
narrowing conversions---probably we didn't notice because it was
previously broken due to folly docs being broken forever.  Folly tests
should always pass.  (I want to add it to the fbcode-tests-must-pass
commit hook.)

Test Plan:
fbmake runtests_opt in this platform, except with stl_tests
turned off because it takes years to compile.

Reviewed By: andrewjcg@fb.com

FB internal diff: D792059

11 years agoMaking from(dynamic.items()) work
Tom Jackson [Tue, 30 Apr 2013 01:46:29 +0000 (18:46 -0700)]
Making from(dynamic.items()) work

Summary: It was broken because the `dynamic`'s iterator wasn't complete.

Test Plan: Unit test

Reviewed By: jbrewer@fb.com

FB internal diff: D793618