Future<T>::then([](T&&)), aka next()

Summary:
variants of then() that bypass Try and forward any exceptions up to the next future. like next() from http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3865.pdf

this could go a long way towards reducing spurious rethrows wherever people don't ever actually catch exceptions in their continuations, which is probably often enough.

anyone know if there's something in folly or standard library that does what my silly VoidWrapper struct does?

there's a lot of copypasta here but i'm not sure consolidating into helpers would actually be useful considering the amount of template crap, i don't feel strongly about it though.

Test Plan: added unit

Reviewed By: hans@fb.com

Subscribers: trunkagent, sammerat, fugalh, njormrod, folly-diffs@, bmatheny

FB internal diff: D1641776

Signature: t1:1641776:1414610434:c742563b8061a748fca9292fc2765081edcf9d52
Move constructors should be noexcept

Summary:
The compiler is able to make some nice optimizations when it
knows that move constructors are noexcept. (In particular, it helps a
lot inside of std::vector if you don't need to worry about the
possibility of exception during reallocation.) Some move constructors in
folly are obviously moveable: change them.

Test Plan: unit tests

Reviewed By: delong.j@fb.com

Subscribers: trunkagent, sdwilsh, njormrod, folly-diffs@

FB internal diff: D1644296

Tasks: 5486739

Signature: t1:1644296:1414618605:d9a0db5193c82650b96e9c62b019d5da218b15c5
Allow catch-int to be nolinted

Summary:
Add a hidden nolint option to suppress this lint warning. It is
appropriate in this case.

Test Plan:
Build flint, run it on ExceptionWrapperTest.cpp, see no catch
lint failure

Reviewed By: andrei.alexandrescu@fb.com

Subscribers: sdwilsh, louisk, njormrod, folly-diffs@

FB internal diff: D1644165

Tasks: 5486739

Signature: t1:1644165:1414616664:a6b9dc34660df84b33ed8faaf48ec048a02bad01
Override for include-guard

Summary:
In certain circumstances, it is appropriate to omit and include
guard. Add an option to allow this to be overriden.

Test Plan: Build flint, run it on folly, see no include-guard errors.

Reviewed By: andrei.alexandrescu@fb.com

Subscribers: sdwilsh, louisk, njormrod, folly-diffs@

FB internal diff: D1644170

Tasks: 5486739

Signature: t1:1644170:1414616595:7ac52f474c1312a0c28e89255b1151d56c680acf
Override #define of keyword

Summary:
Add a hidden option to suppress ###define [keyword]##, which is
occasionally appropriate.

Test Plan:
Build flint, run it on FBString.h, see no error.
Ran flint tests locally, see no errors.

Reviewed By: andrei.alexandrescu@fb.com

Subscribers: sdwilsh, louisk, njormrod, folly-diffs@

FB internal diff: D1644182

Tasks: 5486739

Signature: t1:1644182:1414616294:4b6004d358cba865455366f5a943644b3542ae51
Fix -Wsign-compare

Summary:
Fixed unsigned/signed compares.

I had to suppress the warning in one place, but don't worry, clang
supports `#pragma GCC diagnostic ...` (see http://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-via-pragmas)

Test Plan: unit tests

Reviewed By: afrind@fb.com

Subscribers: alandau, mshneer, trunkagent, doug, jdperlow, bmatheny, njormrod, cgheorghe, folly-diffs@

FB internal diff: D1624249

Tasks: 5140804

Signature: t1:1624249:1414620209:5399e8d90d8ca32b30794a7b2a4a7c2d7d437dda
Make dynamic noexcept

Summary:
Many dynamic operations, including its move constructor, are
noexcept but not labeled so. Labeled some important functions as
noexcept.

Test Plan: run unit tests

Reviewed By: delong.j@fb.com

Subscribers: tudorb, philipp, sdwilsh, njormrod, folly-diffs@

FB internal diff: D1644380

Tasks: 5486739

Signature: t1:1644380:1414618757:fb910d8a3fe3e634da4215c432577edf7371be61
operator::* needs implicit

Summary:
operator::* needs to be explicit, or explicitly labeled
implicit. The build breaks with explicit, so label.

Test Plan: run unit tests

Reviewed By: andrei.alexandrescu@fb.com

Subscribers: sdwilsh, njormrod, folly-diffs@

FB internal diff: D1644176

Tasks: 5486739

Signature: t1:1644176:1414693471:e3a08e27ba27a5ae0e4b9a5e009acf0a16728c45
(wangle-test) fix double ifndef in thens.rb

Summary: Looks like a bad git merge

Test Plan: builds

Reviewed By: hannesr@fb.com

Subscribers: hannesr, net-systems@, fugalh, exa, njormrod, folly-diffs@

FB internal diff: D1649773

Tasks: 5501131

Signature: t1:1649773:1414700920:cc691283884e9654803bba3ffe78f4553194752d
save/restore request context in future

Summary:
Generic 'threadlocal' like object that follows async calls around.

Note: Finagle's futures do this also.  It is super useful.

Test Plan: I should write a unittest?

Reviewed By: haijunz@fb.com, hans@fb.com

Subscribers: trunkagent, dawidp, doug, fugalh, njormrod, folly-diffs@

FB internal diff: D1650843

Tasks: 4698780

Signature: t1:1650843:1414711295:c7439733680ab4903eb9c05dcf8bf52100bf3f07
SSLContext

Summary:
Move SSLContext to folly.

Test Plan: It builds.

Reviewed By: dcsommer@fb.com

Subscribers: jdperlow, atlas2-eng@, wormhole-diffs@, bwester, trunkagent, doug, ps, bmatheny, ssl-diffs@, alikhtarov, njormrod, mshneer, folly-diffs@, andrewcox, alandau, jsedgwick, fugalh

FB internal diff: D1631924

Signature: t1:1631924:1414616562:9a67dbf20f00eb8fbcb35880efcb94c0fae07dcc
Fix folly lint errors

Summary:
Fix EOF whitespace
for file in `find folly -type f` ; do if [ -z "`tail -n1 $file`" ] ; then sed -i '$d' $file ; fi ; done

Test Plan: run unit tests

Reviewed By: robbert@fb.com

Subscribers: trunkagent, sdwilsh, njormrod, folly-diffs@

FB internal diff: D1644130

Tasks: 5486739

Signature: t1:1644130:1414715392:b6c783851aa030ad1148f84a98139a5dca207da0
throw() specs deprecated

Summary: Switch to noexcept

Test Plan: run unit tests

Reviewed By: robbert@fb.com, andrei.alexandrescu@fb.com

Subscribers: aalexandre, sdwilsh, njormrod, folly-diffs@

FB internal diff: D1644135

Tasks: 5486739

Signature: t1:1644135:1414715537:22e1baf91ab7e3250b0b2a460a12d56783f2baed
Comparing the same tokens

Summary:
Avoid comparing-the-same-tokens error by parenthesizing one
side.

This diff only touches folly tests

Test Plan: run unit tests

Reviewed By: robbert@fb.com

Subscribers: sdwilsh, njormrod, folly-diffs@

FB internal diff: D1650386

Tasks: 5486739

Signature: t1:1650386:1414713837:cbb578d23f759aa049f4246113d9da6d40504da4
Fix/override bad symbol names

Summary:
Symbols containing two underscores, or starting with underscore
followed by a capital letter, are reserved by the implementation. Fix
the inappropriate cases, and nolint the ones which we are using
correctly

Test Plan: run unit tests

Reviewed By: robbert@fb.com

Subscribers: trunkagent, sdwilsh, njormrod, folly-diffs@

FB internal diff: D1650435

Tasks: 5486739

Signature: t1:1650435:1414713329:7844e7802ebabcac7ef21aef0becf71ba513afb0
SocketAddress logging

Summary:
Better logging in SocketAddress

Test Plan: run it

Reviewed By: qwu@fb.com

Subscribers: ps, bmatheny, xning

FB internal diff: D1644573

Tasks: 5406091

Signature: t1:1644573:1414626398:1e23ee85ec8ee0be89cb6bdc07da23978b4d988a
Fix large size class category handling in folly::goodMallocSize()

Summary:
jemalloc seems to now use `4064 * 1024` as `arena_maxclass`. Therefore,
allocations that fall in the range `(4064*1024, 4072*1024]` will trigger an
assert in `folly::goodMallocSize()` (`nallocx()` will round up sizes within
that range up to the next multiple of 4 MB (chunk size)).

Test Plan: Call to `folly::goodMallocSize(4161568)` no longer triggeres an assert.

Reviewed By: je@fb.com

Subscribers: aalexandre, trunkagent, njormrod, folly-diffs@

FB internal diff: D1638370

Signature: t1:1638370:1414703429:f3ed2cc8dcb183ff4e8367e2c1f884e122605cba
fix build

Summary: add missing ssl dep

Test Plan: build it

Reviewed By: dcsommer@fb.com

Subscribers: doug, njormrod, folly-diffs@

FB internal diff: D1652234

Signature: t1:1652234:1414778507:4504ea06c3076e0cdfa7772166cf48bc564c9076
volatile override

Summary:
Some uses of volatile are legit. Add a hidden override.

Test Plan: run unit tests

Run flint against folly/Malloc.cpp, see no more volatile warning.

Reviewed By: andrei.alexandrescu@fb.com

Subscribers: sdwilsh, louisk, njormrod, folly-diffs@

FB internal diff: D1644493

Tasks: 5486739

Signature: t1:1644493:1414715317:491d0f631d8152a5b7ec66237e00c404530ab590
Undo a local change

Summary: I had committed a change by mistake. Reverting it.

Test Plan: build it.

Reviewed By: lakshmiganesh@fb.com

Subscribers: njormrod, folly-diffs@

FB internal diff: D1652341

Signature: t1:1652341:1414779013:9f363acba95fbac1988200081659edf71ac63eec