folly.git
5 years agoExplicitly initialize AsyncSocket in MockAsyncSSLSocket
Mingtao Yang [Tue, 22 Aug 2017 17:36:32 +0000 (10:36 -0700)]
Explicitly initialize AsyncSocket in MockAsyncSSLSocket

Summary:
Even though MockAsyncSSLSocket's initializes AsyncSSLSocket, which should
initialize AsyncSocket, this does not actually happen because AsyncSSLSocket
virtually inherits from AsyncSocket.

Because of this, prior to this diff, the MockAsyncSSLSocket was not properly
setting its EventBase.

Reviewed By: knekritz

Differential Revision: D5676596

fbshipit-source-id: 5f3c0e848179cb5eb4d2dc4921a11e7c04d7c0e0

5 years agoUse exception_wrapper::from_exception_ptr in Try and Promise
Yedidya Feldblum [Tue, 22 Aug 2017 04:10:34 +0000 (21:10 -0700)]
Use exception_wrapper::from_exception_ptr in Try and Promise

Summary:
[Folly] Use `exception_wrapper::from_exception_ptr` in `Try` and `Promise`.

It does just what we need; DRY.

Reviewed By: andrewjcg

Differential Revision: D5674663

fbshipit-source-id: 73e46df62c06736c4eaf013d05dfea819cbec515

5 years agoAdd zlib-specific codec initialization
Stella Lau [Tue, 22 Aug 2017 01:15:27 +0000 (18:15 -0700)]
Add zlib-specific codec initialization

Summary:
- Create interface to initialize zlib codec using specific parameters
- This enables the raw inflate/deflate and auto inflate options
- Add tests for option initialization

Reviewed By: terrelln, yfeldblum

Differential Revision: D5649980

fbshipit-source-id: fd36e8edc0e8c528cd6c9d8f39e8ef839b6acfef

5 years agoexception_wrapper::from_exception_ptr
Yedidya Feldblum [Mon, 21 Aug 2017 18:38:39 +0000 (11:38 -0700)]
exception_wrapper::from_exception_ptr

Summary:
[Folly] `exception_wrapper::from_exception_ptr`.

A handry helper for converting from `std::exception_ptr` to `folly::exception_wrapper`.

Reviewed By: ericniebler

Differential Revision: D5668179

fbshipit-source-id: a81a60cb22a2a697714268e027af62dd8825d2c3

5 years agoSynchronizedPtr
Phil Willoughby [Mon, 21 Aug 2017 12:07:57 +0000 (05:07 -0700)]
SynchronizedPtr

Summary: Fairly minimal API to start with. Refer to the comments for the rationale/usage.

Reviewed By: yfeldblum

Differential Revision: D5554854

fbshipit-source-id: 173bf7c40e70b55bf6afb8c4bc9e83d48f90b6ee

5 years agoRecommended cipher list for server side. v2017.08.21.00
Xiangyu Bu [Fri, 18 Aug 2017 23:59:18 +0000 (16:59 -0700)]
Recommended cipher list for server side.

Summary: A SSLOptions recommended for cipher use.

Reviewed By: yfeldblum

Differential Revision: D5614280

fbshipit-source-id: a6b1adfa8d168f35c7bc7d4088c4073c3f4084a5

5 years agoLet SSLContext::setCipherList accept generic container type.
Xiangyu Bu [Fri, 18 Aug 2017 23:35:27 +0000 (16:35 -0700)]
Let SSLContext::setCipherList accept generic container type.

Summary:
Make SSLContext::setCipherList() and SSLContext::setSignatureAlgorithms()
accept std::array besides std::vector so that cipher lists in SSLOptions
can be initialized POD.

Reviewed By: yfeldblum

Differential Revision: D5578758

fbshipit-source-id: 7e5c2e9a75600e93c89e7b13a9042434a4189384

5 years agoDrop jemalloc specific smartRealloc integration
Dave Watson [Fri, 18 Aug 2017 15:45:44 +0000 (08:45 -0700)]
Drop jemalloc specific smartRealloc integration

Summary:
This was added several jemalloc versions ago, and is no longer a win.

From microbenches in folly/test, this codepath is successful less than .5% of the time.

There are a handful of other places directly using this (fbvector, IOBuf, ThreadLocal),
but should probably change them individually.

Reviewed By: interwq

Differential Revision: D5596678

fbshipit-source-id: 354d7204f61df0eace4d98d930d0f6e06a90ffde

5 years agoRemove outdated comments referencing removed TAsyncSSLServerSocket
David Lam [Fri, 18 Aug 2017 05:59:58 +0000 (22:59 -0700)]
Remove outdated comments referencing removed TAsyncSSLServerSocket

Summary:
TAsyncSSLServerSocket was deleted in D1806807, so we should remove
these comments.

Reviewed By: yfeldblum

Differential Revision: D5657431

fbshipit-source-id: ca875293737ad8ba0a8c028c9bfa5651f4a6065f

5 years agoFix incorrect format in Overview markdown
darrenl [Fri, 18 Aug 2017 05:41:29 +0000 (22:41 -0700)]
Fix incorrect format in Overview markdown

Summary:
The format is incorrect in [Overview.md](https://github.com/facebook/folly/blob/master/folly/docs/Overview.md)
Closes https://github.com/facebook/folly/pull/661

Reviewed By: eduardo-elizondo

Differential Revision: D5657083

Pulled By: yfeldblum

fbshipit-source-id: a9cedb413cbb3d455f4c1e5f785d05a33f8182c8

5 years agoFix undefined behavior when decoding varint
Stella Lau [Thu, 17 Aug 2017 23:34:56 +0000 (16:34 -0700)]
Fix undefined behavior when decoding varint

Summary: Left shifting `0x7f` by `63` is undefined behavior (i.e. when decoding `0xFFFF...`)

Reviewed By: yfeldblum, terrelln

Differential Revision: D5653353

fbshipit-source-id: c74c9f43a9bc82d15a2223df853dc533cea1478b

5 years agoAdd getSSLContext() to AsyncSSLSocket
Mingtao Yang [Thu, 17 Aug 2017 20:54:11 +0000 (13:54 -0700)]
Add getSSLContext() to AsyncSSLSocket

Reviewed By: knekritz

Differential Revision: D5632201

fbshipit-source-id: 5db380379ab6cb608922c77dd716bfc4410b2cd8

5 years agoChange AsyncSSLSocket getSecurityProtocol to handle unencrypted mode
Neel Goyal [Thu, 17 Aug 2017 17:59:06 +0000 (10:59 -0700)]
Change AsyncSSLSocket getSecurityProtocol to handle unencrypted mode

Summary: Return empty string for `getSecurityProtocol` if the socket is good and the handshake failed, otherwise "TLS"

Reviewed By: knekritz

Differential Revision: D5647637

fbshipit-source-id: b95cbf39e4bb7f89b1ebcbc0238c2becba7ad42a

5 years agoRemove a use of SFINAE in the Range constructor.
Phil Willoughby [Thu, 17 Aug 2017 08:27:07 +0000 (01:27 -0700)]
Remove a use of SFINAE in the Range constructor.

Summary:
Specifically, the constructor `implicit Range(Iter)` is now declared and defined for all `Range` specializations. It is an error to use it, and we `static_assert`, unless `Iter` is `char const *` or `char *`.

Performance effect
 ---
Measuring compilation-time on a file that just make ~40k StringPieces, compiled with -O3. All compilers produced identical code before/after this change.

* clang-trunk: 4% improvement
* gcc-5: no change
* gcc-4.9: 11% improvement
* gcc-7.1: 5% improvement

Could this possibly break any existing code?
 ---
Yes. If you have a function that's overloaded for both `Range<char const*>` and `Range<X>` and your input object is not `char const*` and is implicitly convertible to both `char const*` and `X`: that is now ambiguous whereas before it would unambiguously pick the `Range<char const*>` overload. I don't consider this scenario likely.

Why should this work?
 ---
Using SFINAE is more expensive at compile time (with some compilation environments) than not using it. It's necessary to use SFINAE when there is an alternative function which will be used in preference when the substitution fails, but when that is not the case it is on average cheaper to make the function always exist and use static_assert to disallow the bad uses of it. A bonus is that the caller gets a more comprehensible error message.

Reviewed By: nbronson

Differential Revision: D5639502

fbshipit-source-id: 13469f2995a487398734f86108087fdc8e32ad71

5 years agoOptionally run autoconf
Philip Jameson [Thu, 17 Aug 2017 00:46:52 +0000 (17:46 -0700)]
Optionally run autoconf

Summary:
This makes it so that the //folly:config rule can run autoconf to create folly-config

- Uses cxx_genrule get compiler settings and paths to dependent libraries
- Goes around a couple of oddities in the way that buck exports some of its macros
- While it uses buck_cxx_library, that's okay to use outside of facebook's internal repos.

Reviewed By: meyering

Differential Revision: D5620729

fbshipit-source-id: 0d2d8e3bda92182dcdcd3e80cb12a3756b3816ac

5 years agoAdd prepareSkipTo() method to EliasFanoReader
Rushy Panchal [Thu, 17 Aug 2017 00:19:03 +0000 (17:19 -0700)]
Add prepareSkipTo() method to EliasFanoReader

Summary:
`prepareSkipTo(x`) allows the client of EliasFanoReader to "hint" that
`skipTo(x)` will be called in the near future. The primary benefit of doing so
is that memory which is needed for `skipTo(x)` can be prefetched to minimize
cache misses incurred when calling `skipTo(x)`.

Reviewed By: ot, philippv

Differential Revision: D5508995

fbshipit-source-id: 4876b566256849f76193db3dc0404768aeeeb30d

5 years agoAdd ConcurrentHashMap installable
Shu Zhang [Wed, 16 Aug 2017 20:17:13 +0000 (13:17 -0700)]
Add ConcurrentHashMap installable

Summary:
ConcurrentHashMap is a newly added feature and we wanted to test it in our enviornment, making it installable.

Built & Installed on ubuntu 14 env.
Closes https://github.com/facebook/folly/pull/659

Reviewed By: djwatson

Differential Revision: D5629159

Pulled By: yfeldblum

fbshipit-source-id: 8a40e768f3db7918a3b284059f2efa0b7ecb9aca

5 years agofolly::ElfFile - add support to iterate over program headers
Mirek Klimos [Wed, 16 Aug 2017 04:04:27 +0000 (21:04 -0700)]
folly::ElfFile - add support to iterate over program headers

Summary: Adding iterateProgramHeaders, similar to iterateSections, just iterates over program headers instead of section headers. I want this to get the size of the first PT_LOAD header.

Differential Revision: D5602575

fbshipit-source-id: f73989cade20214f884571c1099761ecaa4841f7

5 years agoFix destruction order
Maged Michael [Wed, 16 Aug 2017 01:01:19 +0000 (18:01 -0700)]
Fix destruction order

Summary:
- Added `hazptr.cpp` and `memory_resource.cpp`. Moved singleton code to source.
  - Changed the singleton for the default `hazptr_domain` to a global.
  - Changed hazptr_stats singleton to a global.
  - Moved the thread caching calls from the hazptr_domain functions to the constructor/destructor of hazptr_holder.
  - Changed the TLS singletons to TLS globals.
  - Changed some inlining directives.
  - Leak the hazptr_rec-s in the default domain

Reviewed By: davidtgoldblatt, djwatson

Differential Revision: D5553753

fbshipit-source-id: da69eecec55c0f78fb8ef5591f9aeffee99ff3fa

5 years agotry to fix folly, wangle, etc open-source build
Alexey Spiridonov [Tue, 15 Aug 2017 17:52:45 +0000 (10:52 -0700)]
try to fix folly, wangle, etc open-source build

Summary: add missing source files to Makefile

Reviewed By: andriigrynenko

Differential Revision: D5630758

fbshipit-source-id: 0f04c11b65fd3a6f4f33e34ae57c0fcba8671e97

5 years agoAdd hooks to track which threads belong to which thread pools
Peter DeLong [Mon, 14 Aug 2017 23:40:47 +0000 (16:40 -0700)]
Add hooks to track which threads belong to which thread pools

Summary:
Keep track of which threads belong to which thread pools for use when debugging.
This will be paired with a gdb script that associates threads with their thread pools

Reviewed By: andriigrynenko

Differential Revision: D5514729

fbshipit-source-id: 57ada4dd1aaaec5d7026e4eee05b0ec4e7434c77

5 years agoallow comparing Optional<T> with none
Nick Wolchko [Mon, 14 Aug 2017 19:49:06 +0000 (12:49 -0700)]
allow comparing Optional<T> with none

Summary:
`std::optional` supports comparing with `std::nullopt`, so
`folly::Optional` should do the same with `folly::none`.
This also involves marking hasValue() noexcept to be the same as `std::optional`.

Reviewed By: yfeldblum, WillerZ

Differential Revision: D5617825

fbshipit-source-id: a4b863dd61c3a86223fb21a5b7759e7c295fd272

5 years agoAsyncSSLSocket::get/setClientCertValidationResult API.
Xiangyu Bu [Mon, 14 Aug 2017 17:13:58 +0000 (10:13 -0700)]
AsyncSSLSocket::get/setClientCertValidationResult API.

Summary:
The added API will be used for storing and retrieving validation result of client cert.

At some point we may change "client" to "peer" to make it generic.

Reviewed By: anirudhvr

Differential Revision: D5610404

fbshipit-source-id: 2feb03abc0594af4c68db33d8885ea214867148a

5 years agosmall_vector default constructor shouldn't be explicit v2017.08.14.00
Nathan Bronson [Thu, 10 Aug 2017 19:35:20 +0000 (12:35 -0700)]
small_vector default constructor shouldn't be explicit

Summary:
Containers should not tag their default constructor explicit,
because it means that you can't return an empty one with "return {};".
This diff removes the explicit tag from small_vector's default
constructor.

Reviewed By: meyering

Differential Revision: D5602749

fbshipit-source-id: 2a4a356134c69d01e3b040719dc6ffca0fe97e75

5 years agofix sorted_vector_{set,map} bulk_insert deduplication
Nick Jiang [Wed, 9 Aug 2017 22:23:24 +0000 (15:23 -0700)]
fix sorted_vector_{set,map} bulk_insert deduplication

Summary: this fixes the case where bulk inserting a range where the smallest element is equal to the largest element of the current set/map fails to deduplicate that element.

Reviewed By: mlogan, yfeldblum

Differential Revision: D5593284

fbshipit-source-id: 487500ee7a5e33f27c24321ad4a3c07a669fc26c

5 years agoExplicitly handle gcc in FOLLY_MAYBE_UNUSED
Yedidya Feldblum [Wed, 9 Aug 2017 21:55:17 +0000 (14:55 -0700)]
Explicitly handle gcc in FOLLY_MAYBE_UNUSED

Summary:
[Folly] Explicitly handle gcc in `FOLLY_MAYBE_UNUSED`.

Fixes build break from {D5562220}.

Reviewed By: Orvid

Differential Revision: D5594288

fbshipit-source-id: 5aa2dcb6133d53a0eb20d34b67c8e4407dd2b7ca

5 years agoCut unnecessary parens in IPAddress.h
Yedidya Feldblum [Wed, 9 Aug 2017 18:21:38 +0000 (11:21 -0700)]
Cut unnecessary parens in IPAddress.h

Summary: [Folly] Cut unnecessary parens in `IPAddress.h`.

Reviewed By: meyering

Differential Revision: D5589756

fbshipit-source-id: 6499e0db2aeb232356e2808fc59a35869b5dad0a

5 years agoLet IPAddressV4::bitCount and IPAddressV6::bitCount be constexpr
Yedidya Feldblum [Wed, 9 Aug 2017 03:27:39 +0000 (20:27 -0700)]
Let IPAddressV4::bitCount and IPAddressV6::bitCount be constexpr

Summary: [Folly] Let `IPAddressV4::bitCount` and `IPAddressV6::bitCount` be `constexpr`.

Reviewed By: meyering

Differential Revision: D5589954

fbshipit-source-id: f4208efd62e71f47a7c87bdc8ddd421f93413c29

5 years agoApply clang-format to folly/**/*Address*.*
Yedidya Feldblum [Tue, 8 Aug 2017 21:40:04 +0000 (14:40 -0700)]
Apply clang-format to folly/**/*Address*.*

Summary: [Folly] Apply `clang-format` to `folly/**/*Address*.*`.

Reviewed By: Orvid

Differential Revision: D5581523

fbshipit-source-id: 97b5270e43e279e7deb9606524d5fee844a50649

5 years agoAdd a UDL suffix to define a StringPiece
Phil Willoughby [Tue, 8 Aug 2017 10:19:16 +0000 (03:19 -0700)]
Add a UDL suffix to define a StringPiece

Summary:
Use it like this:
```
using namespace folly::string_piece_literals;
StringPiece p = "A literal string"_sp;
```

In some compilation environments it can be more efficient than the implicit
conversion from `char const *` to `StringPiece`.

Reviewed By: yfeldblum

Differential Revision: D5562782

fbshipit-source-id: ce715edc65b1510761e127bf89a6936370253a68

5 years agoDon't allow Future::onError([](exception_wrapper&){}) to compile
Sargun Vohra [Mon, 7 Aug 2017 20:29:40 +0000 (13:29 -0700)]
Don't allow Future::onError([](exception_wrapper&){}) to compile

Summary: `Future::onError` does not work with a function that takes `exception_wrapper&`, so it should not compile. `exception_wrapper`, `const exception_wrapper&`, and `exception_wrapper&&` are unaffected.

Reviewed By: yfeldblum

Differential Revision: D5556083

fbshipit-source-id: 45d096d9fee00322eeec6b9b9b1dcbef55cced03

5 years agoConsistent use of sformat in address-related files v2017.08.07.00
Yedidya Feldblum [Sun, 6 Aug 2017 05:09:13 +0000 (22:09 -0700)]
Consistent use of sformat in address-related files

Summary:
[Folly] Consistent use of `sformat` in address-related files.

V.s. `format(/*...*/).str()` and v.s. `to<std::string>`.

Reviewed By: meyering

Differential Revision: D5570334

fbshipit-source-id: 83aedf9a694721fb209e62e94f1a5c5ecd355e81

5 years agoApply clang-format to folly/**/*Range*.*
Yedidya Feldblum [Sun, 6 Aug 2017 05:00:20 +0000 (22:00 -0700)]
Apply clang-format to folly/**/*Range*.*

Summary: [Folly] Apply `clang-format` to `folly/**/*Range*.*`.

Reviewed By: meyering

Differential Revision: D5570553

fbshipit-source-id: 230aa8557c2d402d741aaa541f96f4634dd13d3b

5 years agoTest server-side getPeerCert().
Xiangyu Bu [Fri, 4 Aug 2017 21:32:14 +0000 (14:32 -0700)]
Test server-side getPeerCert().

Summary: Make sure server can get client cert using AsyncSSLSocket::getPeerCert() call.

Reviewed By: anirudhvr

Differential Revision: D5557303

fbshipit-source-id: d95696f592e3b3f67acba9f92add32b91c29a000

5 years agoClang-format AsyncSSLSocketTest.cpp.
Xiangyu Bu [Fri, 4 Aug 2017 17:54:29 +0000 (10:54 -0700)]
Clang-format AsyncSSLSocketTest.cpp.

Summary: ... as titled.

Reviewed By: yfeldblum

Differential Revision: D5558742

fbshipit-source-id: b63b121cde8db93de4cabc80563539297611d600

5 years agoReplacing instances of __CLANG__ with __clang__
Marko Novakovic [Fri, 4 Aug 2017 06:02:17 +0000 (23:02 -0700)]
Replacing instances of __CLANG__ with __clang__

Summary:
Clang compiler does not define `__CLANG__` macro and
only defines `__clang__`, but we use `__CLANG__` in a
few places in the code which was probably done by mistake.
This should make the code behave in the intended way.

Reviewed By: yfeldblum

Differential Revision: D5542162

fbshipit-source-id: 74d24ba9464d8faec160d73e6c582967d3c80c19

5 years agoAdd X509_EXTENSION unique pointer
Alex Guzman [Thu, 3 Aug 2017 21:18:34 +0000 (14:18 -0700)]
Add X509_EXTENSION unique pointer

Summary: Adds unique pointer type for X509_EXTENSION

Reviewed By: knekritz

Differential Revision: D5556504

fbshipit-source-id: b84190f20dd0a2ee9f5f07f197caf53a9a063af7

5 years agoReduce Code Duplication In NotificationQueue With Universal Reference
Adam Norton [Thu, 3 Aug 2017 17:08:17 +0000 (10:08 -0700)]
Reduce Code Duplication In NotificationQueue With Universal Reference

Summary: Remove a bunch of identical code that only exists to provide interfaces for both `const MessageT&` and `MessageT&&` arguments.

Reviewed By: ot

Differential Revision: D5540560

fbshipit-source-id: ae7b9345b64130fc748033be2e0587c4f83345a7

5 years agoFix error in comment.
Martin Martin [Wed, 2 Aug 2017 18:25:45 +0000 (11:25 -0700)]
Fix error in comment.

Summary: Speaking of errors...

Reviewed By: philippv

Differential Revision: D5545916

fbshipit-source-id: cc8471c2f0fc3cefaa9f8493d9b976098f896176

5 years agoFix for building with icc.
Greg Bentley [Wed, 2 Aug 2017 02:15:32 +0000 (19:15 -0700)]
Fix for building with icc.

Summary: Closes https://github.com/facebook/folly/pull/649

Reviewed By: Orvid

Differential Revision: D5535534

Pulled By: yfeldblum

fbshipit-source-id: 641186d6171479755bd9471a484b8b3c2ab62418

5 years agoCreate X509_STORE ptr type
Alex Guzman [Tue, 1 Aug 2017 23:23:36 +0000 (16:23 -0700)]
Create X509_STORE ptr type

Summary: What it says on tin

Reviewed By: knekritz

Differential Revision: D5533819

fbshipit-source-id: e3ba89f02d20d171fbcb8ed2853267d37bd86756

5 years agoCut debugging code from SocketAddress
Yedidya Feldblum [Tue, 1 Aug 2017 22:53:15 +0000 (15:53 -0700)]
Cut debugging code from SocketAddress

Summary:
[Folly] Cut debugging code from `SocketAddress`.

Specifically from its `ExternalUnixAddr` helper class, which is probably not broken.

Reviewed By: simpkins

Differential Revision: D5530685

fbshipit-source-id: adfc46ec1c1a142e9914051e8a97b39f41d71630

5 years agoC++11 support for Replaceable
Phil Willoughby [Tue, 1 Aug 2017 19:20:30 +0000 (12:20 -0700)]
C++11 support for Replaceable

Summary: Also add tests for the `is_replaceable` trait.

Reviewed By: yfeldblum

Differential Revision: D5526317

fbshipit-source-id: 92559d55fbb8d115856ef9e8f86b42e327f74e56

5 years agoAdd TLS 1.2+ version for contexts
Neel Goyal [Tue, 1 Aug 2017 19:18:25 +0000 (12:18 -0700)]
Add TLS 1.2+ version for contexts

Summary: Add an SSL Version that specifies only TLS 1.2 and up.  This prevents any client with less than TLS 1.2 from connecting.

Reviewed By: knekritz

Differential Revision: D5537423

fbshipit-source-id: 131f5b124af379eaa2b443052be9b43290c41820

5 years agoChange AsyncUDP's readCallback to be protected.
Neel Goyal [Tue, 1 Aug 2017 15:37:13 +0000 (08:37 -0700)]
Change AsyncUDP's readCallback to be protected.

Summary: Change AsyncUDPSocket's ReadCallback to be protected so that subclasses can have access to it.

Reviewed By: yangchi

Differential Revision: D5376012

fbshipit-source-id: 7ec21d9bfe6bde525253adea7abf5dea15fb7fa0

5 years agoDRY some methods in IPAddress
Yedidya Feldblum [Tue, 1 Aug 2017 02:42:53 +0000 (19:42 -0700)]
DRY some methods in IPAddress

Summary:
[Folly] DRY some methods in `IPAddress`.

Specifically, the ones which just delegate to either `asV4()` or to `asV6()`.

Reviewed By: mzlee

Differential Revision: D5529797

fbshipit-source-id: 4dd3dc893ab19281325700b85400c1c1aadfd77f

5 years agoMake sendmsg in AsyncUDPSocket overridable
Yang Chi [Mon, 31 Jul 2017 20:48:23 +0000 (13:48 -0700)]
Make sendmsg in AsyncUDPSocket overridable

Summary: Add a protected virtual sendmsg method to AsyncUDPSocket. And make it default to call the system sendmsg function. This enables subclasses of AsyncUDPSocket to be able to override the behavior of sendmseg, also makes AsyncUDPSocket easier to mock and test.

Reviewed By: afrind

Differential Revision: D5459745

fbshipit-source-id: b0227bf7503b1096cb1f0bfc8b9c784db2f2e45d

5 years agoNo need for strncpy in passwordCallback
Yedidya Feldblum [Mon, 31 Jul 2017 19:04:10 +0000 (12:04 -0700)]
No need for strncpy in passwordCallback

Summary:
[Folly] No need for `strncpy` in `passwordCallback`.

Careful reading of the documentation:

> The pem_passwd_cb must write the password into the provided buffer `buf` which is of size `size`.
>
> https://wiki.openssl.org/index.php?title=Manual:SSL_CTX_set_default_passwd_cb(3)&oldid=761

No mention is made of a requirement on the password being written into `buf` that it be null-terminated.

Reviewed By: knekritz, meyering

Differential Revision: D5524814

fbshipit-source-id: 6cfc588cdf3675281ffe39e6af376f3f0631d1b0

5 years agoRemove template helper constants
Phil Willoughby [Mon, 31 Jul 2017 08:35:58 +0000 (01:35 -0700)]
Remove template helper constants

Summary: Not supported by some environments.

Reviewed By: yfeldblum

Differential Revision: D5526180

fbshipit-source-id: 2c2b6f7627860c5f896532b90601c817530e6b69

5 years agoConsistency in namespace-closing comments v2017.07.31.00
Yedidya Feldblum [Mon, 31 Jul 2017 06:14:36 +0000 (23:14 -0700)]
Consistency in namespace-closing comments

Summary: [Folly] Consistency in namespace-closing comments.

Reviewed By: Orvid

Differential Revision: D5524744

fbshipit-source-id: ced4dd2398ed6baa3ad5b68b74eee6a5d6b2b103

5 years agoFormatting for template parameters
Yedidya Feldblum [Mon, 31 Jul 2017 02:40:25 +0000 (19:40 -0700)]
Formatting for template parameters

Summary: [Folly] Formatting for template parameters.

Reviewed By: Orvid

Differential Revision: D5525123

fbshipit-source-id: 4feb772300cfdd6ae3168fe9f59f5a951fb85d0e

5 years agoSimplify the StateSize helper in Random
Yedidya Feldblum [Mon, 31 Jul 2017 00:58:29 +0000 (17:58 -0700)]
Simplify the StateSize helper in Random

Summary:
[Folly] Simplify the `StateSize` helper in `Random`.

* Using member type aliases rather than class constants means we can remove definitions.
* Partially specializing over all RNG types with `state_size` class constants means we can remove the `mersenne_twister` specializations, which have many template parameters and are a pain.

Reviewed By: Orvid

Differential Revision: D5525144

fbshipit-source-id: bc27f112ed0d9b55befe9dabe08c4d345a402435

5 years agoOutline throw statements in format
Yedidya Feldblum [Sun, 30 Jul 2017 21:31:01 +0000 (14:31 -0700)]
Outline throw statements in format

Summary: [Folly] Outline `throw` statements in `format`.

Reviewed By: Orvid

Differential Revision: D5523933

fbshipit-source-id: 371c9ecc707e48dcc05fa4aab4fd326111466161

5 years agoLet MacAddress use a helper hex-table
Yedidya Feldblum [Sun, 30 Jul 2017 21:28:44 +0000 (14:28 -0700)]
Let MacAddress use a helper hex-table

Summary:
[Folly] Let `MacAddress` use a helper hex-table.

The table is in the `folly::detail` namespace so it is non-public to users of folly, but the rules may not be quite as strict in at least some cases within folly.

Also the helper `unhex` function that this replaces is not `clang-format`-clean, so this lets us sidestep that.

Reviewed By: Orvid

Differential Revision: D5524229

fbshipit-source-id: 21d6938e20cd675e65499a5b64d2af934f980222

5 years agoConsistent indentation for class visibility labels
Yedidya Feldblum [Sun, 30 Jul 2017 03:09:05 +0000 (20:09 -0700)]
Consistent indentation for class visibility labels

Summary: [Folly] Consistent indentation for class visibility labels (`public:`, `protected:`, `private:`). Style is +1 column relative to the `class` keyword.

Reviewed By: andrewjcg

Differential Revision: D5524869

fbshipit-source-id: 53e4b6cbda10d5b63bafbd535794a8b7ae01a8e0

5 years agotemplate< -> template <
Yedidya Feldblum [Sun, 30 Jul 2017 02:30:13 +0000 (19:30 -0700)]
template< -> template <

Summary:
[Folly] `template<` -> `template <`.

And then apply `clang-format` style to affected `template <...>` lines.

Reviewed By: andrewjcg

Differential Revision: D5524792

fbshipit-source-id: 6614eecf384bf3e3ccc2f0cc7c5334a0cb9c76af

5 years agoMark two implicit ctors as explicit
Yedidya Feldblum [Sun, 30 Jul 2017 00:54:14 +0000 (17:54 -0700)]
Mark two implicit ctors as explicit

Summary:
[Folly] Mark two implicit ctors as `explicit`.

They did not need to be implicit.

Reviewed By: andrewjcg

Differential Revision: D5524798

fbshipit-source-id: a50bc6bfc9da2642891faf0aa38a19f46e75b9da

5 years agoDefine IPAddressV6 comparison ops in terms of its fields
Yedidya Feldblum [Sat, 29 Jul 2017 19:52:49 +0000 (12:52 -0700)]
Define IPAddressV6 comparison ops in terms of its fields

Summary: [Folly] Define `IPAddressV6` comparison ops in terms of its fields using `std::tie`.

Reviewed By: andrewjcg

Differential Revision: D5524248

fbshipit-source-id: 5f5f2acd6e9cfd6dfd148cc7d95bda720bf81ee9

5 years agoMerge IPAddressTest.h into the IPAddressTest.cpp
Yedidya Feldblum [Sat, 29 Jul 2017 19:51:53 +0000 (12:51 -0700)]
Merge IPAddressTest.h into the IPAddressTest.cpp

Summary:
[Folly] Merge `IPAddressTest.h` into the `IPAddressTest.cpp`.

There is no real need to split anything out into a header file.

Reviewed By: andrewjcg

Differential Revision: D5524267

fbshipit-source-id: e128c69c7da38663f19d0ccd73edaae36c3f469a

5 years agoOutline throw statements in folly/futures/
Yedidya Feldblum [Sat, 29 Jul 2017 19:19:18 +0000 (12:19 -0700)]
Outline throw statements in folly/futures/

Summary: [Folly] Outline `throw` statements in `folly/futures/`.

Reviewed By: ericniebler

Differential Revision: D5522791

fbshipit-source-id: 545185bc580ea8628075b9ecae46c2f19308e937

5 years agoCompute masks in IPAddressV4
Yedidya Feldblum [Sat, 29 Jul 2017 18:51:38 +0000 (11:51 -0700)]
Compute masks in IPAddressV4

Summary: [Folly] Compute masks in `IPAddressV4`. Just like in `IPAddressV6`.

Reviewed By: WillerZ

Differential Revision: D5524197

fbshipit-source-id: ebeeab28304bff4f6150cf76216d170908e62aa4

5 years agoFix the copy constructor in Replaceable
Phil Willoughby [Sat, 29 Jul 2017 07:08:27 +0000 (00:08 -0700)]
Fix the copy constructor in Replaceable

Summary:
Fix the copy constructor, and add the missing testcase which would have found
this problem.

Reviewed By: yfeldblum

Differential Revision: D5516628

fbshipit-source-id: 3e688c34f061511df5b68243111fecb83483d79d

5 years agoOptimal make_integer_sequence
Yedidya Feldblum [Fri, 28 Jul 2017 21:39:32 +0000 (14:39 -0700)]
Optimal make_integer_sequence

Summary:
[Folly] Optimal `make_integer_sequence`.

When the builtin `__make_integer_seq` is available, use that. It is the most optimal implementation.

Otherwise, use a tweaked divide-and-conquer implementation. Designed to reuse more template instantiations than the straightforward divide-and-conquer approach in libstdc++ >= 6. And definitely not linearly recursive as in libstdc++ < 6.

Illustrating with an example. Let `M` be whatever template type implements `make_integer_sequence`. For `M<17>`, libstdc++ < 6 does linear recursion (least optimal), instantiating `M<16>`, `M<15>`, ..., `M<1>`. libstdc++ >= 6 does straightforward divide-and-conquer recursion, instantiating `M<8>` and `M<9>`, recursing into `M<4>` and `M<5>`, recursing into `M<2>` and `M<3>`, recursing into `M<1>`. Our implementation does a variant of divide-and-conquer recursion to maximize reuse, instantiating `M<8>` and `M<1>`, recursing into `M<4>`, recursing into `M<2>`.

Implementation derived from `fatal/type/sequence.h`.

Reviewed By: ericniebler

Differential Revision: D5496975

fbshipit-source-id: 449b4e0a1c7b4a5b602752c1d3dd8914bf9a8e71

5 years agoPrevent IsOneOf unused template specialization instantiation
stryku [Fri, 28 Jul 2017 20:05:08 +0000 (13:05 -0700)]
Prevent IsOneOf unused template specialization instantiation

Summary:
Current `IsOneOf` implementation does unnecessary work because it instantiates all of the possible template specializations, even if type is same as the first of the tested ones. E.g.
`IsOneOf<char, char, int, float>` will instantiate:
```
IsOneOf<char, char, int, float>
IsOneOf<char, char, int>
IsOneOf<char, char>
IsOneOf<char>
```

With the proposed inheritance, compiler will stop initializing at the first match.
Closes https://github.com/facebook/folly/pull/643

Reviewed By: ericniebler

Differential Revision: D5482783

Pulled By: yfeldblum

fbshipit-source-id: 3d04c750ce72fa9b19b4d0588cccfb396a9e0715

5 years agoAdd X509_REVOKED_get0_* OpenSSL shims
Mingtao Yang [Fri, 28 Jul 2017 16:57:24 +0000 (09:57 -0700)]
Add X509_REVOKED_get0_* OpenSSL shims

Reviewed By: yfeldblum

Differential Revision: D5509756

fbshipit-source-id: 0b9581dafb073c5e3e5a229c032c6cf272ceb2e0

5 years agoFix StringPiece ostream overloads to properly not rely on <ostream>
Andrew Krieger [Fri, 28 Jul 2017 15:20:06 +0000 (08:20 -0700)]
Fix StringPiece ostream overloads to properly not rely on <ostream>

Summary:
std::ostream may be incomplete because Range.h doesn't use <ostream>,
only <iosfwd>. Changing the operator<< overloads to be templated on the char
type defers typechecking until callsites, which will avoid the potential problem.

Reviewed By: yfeldblum, ericniebler

Differential Revision: D5494648

fbshipit-source-id: e59b6fdfba6c08ec70ebb1e10c14a43307a1119f

5 years agostd::basic_ostream operator<< overload for FixedString
Andrew Krieger [Fri, 28 Jul 2017 15:20:05 +0000 (08:20 -0700)]
std::basic_ostream operator<< overload for FixedString

Summary:
When attempting to output a FixedString into eg. glog or
some other ostream, it is first being implicitly converted to StringPiece
and then that is printed using the overloaded operator<<. If another
suitable implicit conversion is provided, eg. to `dynamic`, compilers
cannot choose between either one. Instead, overload operator<< directly
on FixedString to resolve the ambiguity.

Reviewed By: yfeldblum, ericniebler

Differential Revision: D5492779

fbshipit-source-id: 92d661e5471a91057d7a0d010420709c5d59232f

5 years agoSwitch to folly/Optional.h to use std::aligned_storage
Michael Lee [Thu, 27 Jul 2017 16:20:04 +0000 (09:20 -0700)]
Switch to folly/Optional.h to use std::aligned_storage

Summary: Older versions of libc++ do not support `std::aligned_storage_t`, switch to something more widely supported.

Differential Revision: D5506449

fbshipit-source-id: 3f5cf5dddf00bda76d4f16cfd4d8944ee5f1ba55

5 years agoAdd FOLLY_HAS_FEATURE and use it
Yedidya Feldblum [Wed, 26 Jul 2017 21:18:41 +0000 (14:18 -0700)]
Add FOLLY_HAS_FEATURE and use it

Summary:
[Folly] Add `FOLLY_HAS_FEATURE` and use it.

Use it in the definitions of `FOLLY_SANITIZE_ADDRESS` and `FOLLY_SANITIZE_THREAD`.

Reviewed By: meyering

Differential Revision: D5496915

fbshipit-source-id: e272137ad8ba891e64fc98444edf573115764ee2

5 years agoCut moveFromTry
Yedidya Feldblum [Wed, 26 Jul 2017 18:52:29 +0000 (11:52 -0700)]
Cut moveFromTry

Summary: [Folly] Cut `moveFromTry`. Not necessary, and is even longer than `std::move`.

Reviewed By: WillerZ, ericniebler

Differential Revision: D5478450

fbshipit-source-id: ecd01cb1bcd435e49268a76dd558e57ba8dd9b9e

5 years agoOutline throw statements in dynamic
Yedidya Feldblum [Wed, 26 Jul 2017 18:39:53 +0000 (11:39 -0700)]
Outline throw statements in dynamic

Summary:
[Folly] Outline `throw` statements in `dynamic`.

There is no need for them to be inline - definitionally, they are always cold.

Reviewed By: WillerZ

Differential Revision: D5497457

fbshipit-source-id: 7b649c59b5b2609f838eb10e9329468d1bd1d558

5 years agoKill folly::SSLContext::switchCiphersIfTLS11.
Xiangyu Bu [Wed, 26 Jul 2017 18:32:54 +0000 (11:32 -0700)]
Kill folly::SSLContext::switchCiphersIfTLS11.

Summary: It has been years since BEAST attack surfaced. The vulnerabilities have been patched and the mitigation using RC4 cipher is no longer needed. This diff removes the code relevant to mitigating BEAST years ago.

Reviewed By: anirudhvr

Differential Revision: D5409859

fbshipit-source-id: 58178e68a447f372b19491832a7be590af9402e9

5 years agoAdd getEventBase() to AsyncUDPSocket
Neel Goyal [Wed, 26 Jul 2017 18:31:11 +0000 (11:31 -0700)]
Add getEventBase() to AsyncUDPSocket

Summary: Add an event base getter for AsyncUDPSocket similar to the other socket classes.

Reviewed By: knekritz

Differential Revision: D5498587

fbshipit-source-id: ac3179e03485328417ed9863f6bb790de7c691cb

5 years agoConcurrentHashMap
Dave Watson [Wed, 26 Jul 2017 16:41:45 +0000 (09:41 -0700)]
ConcurrentHashMap

Summary:
A ConcurrentHashMap with wait-free readers, as in Java's ConcurrentHashMap.

It's a pretty generic closed-addressing chaining hashtable, except find() uses two hazard pointers
to do hand-over-hand traversal of the list, so it never takes a lock.

On rehash, only the part of the chain that remains the same (i.e. is still hashed to the same bucket)
is reused, otherwise we have to allocate new nodes.

Reallocating nodes means we either have to copy the value_type, or add in an extra indirection
to access it.  Both are supported.

There's still a couple opportunities to squeeze some more perf out with optimistic loading
of nodes / cachelines, but I didn't go that far yet, it sill looks pretty good.

Reviewed By: davidtgoldblatt

Differential Revision: D5349966

fbshipit-source-id: 022e8adacd0ddd32b2a4563caa99c0c4878851d8

5 years agoAllow stealing pointer bits
Dave Watson [Wed, 26 Jul 2017 15:07:56 +0000 (08:07 -0700)]
Allow stealing pointer bits

Summary:
Currently hazard pointers doesn't support stealing any of the pointer bits.
You can *almost* roll it yourself using try_protect, but this prevents
implementations from choosing their type of barrier.

This adds a new get_protected interface that you can use to steal bits, or
otherwise manipulate pointers as you would like.

This also adds a MWMR list based set example that uses it, that is wait-free
for readers (unlike the SWMR example, that is only lock-free).

Reviewed By: magedm

Differential Revision: D5455615

fbshipit-source-id: 53d282eda433e00b6b53cd804d4e1c32c74c2fb8

5 years agoUpdate Optional
Phil Willoughby [Wed, 26 Jul 2017 12:52:11 +0000 (05:52 -0700)]
Update Optional

Summary: Now const-optimizer safe, and safe when the contained value overloads unary operator&

Reviewed By: yfeldblum

Differential Revision: D5480170

fbshipit-source-id: 3b53b0b6ce608857aa29d3f61eccd0b793b4cddc

5 years agoclang-format Optional.h
Phil Willoughby [Wed, 26 Jul 2017 12:12:29 +0000 (05:12 -0700)]
clang-format Optional.h

Reviewed By: yfeldblum

Differential Revision: D5497522

fbshipit-source-id: bb208aeb37b5b9ce99619193d4cd2d0f3fb39178

5 years agoAdd FOLLY_HAS_BUILTIN and use it
Yedidya Feldblum [Wed, 26 Jul 2017 08:51:44 +0000 (01:51 -0700)]
Add FOLLY_HAS_BUILTIN and use it

Summary:
[Folly] Add `FOLLY_HAS_BUILTIN` and use it.

Use it in the definition of `folly::launder`. Of course, since GCC does not have `__has_builtin`, we still have to check its version.

Reviewed By: WillerZ

Differential Revision: D5496748

fbshipit-source-id: 3bd6e89424dfd2c9cb9795ee4d88f66c4294cc4c

5 years agoCut throwOnFail
Yedidya Feldblum [Wed, 26 Jul 2017 07:04:24 +0000 (00:04 -0700)]
Cut throwOnFail

Summary:
[Folly] Cut `throwOnFail`.

It is not necessary, and `CHECK_THROW`, its reason for existing, can be implemented without it.

It can also easily be a pessimization because there is no way to delay computation of the arguments to the exception ctor until after the check. So if there is, say, a computation using `sformat` to compute a string argument to the exception ctor, that will always be performed rather than being performed only should the check fail.

Reviewed By: Orvid

Differential Revision: D5478804

fbshipit-source-id: 71a125c126eae76c6e95ef1bd23ee883b1db39a5

5 years agofolly: changes to make nvcc happy
Yangqing Jia [Wed, 26 Jul 2017 06:45:53 +0000 (23:45 -0700)]
folly: changes to make nvcc happy

Summary:
(1) small_vector.h line 1099: wrap the default return in an else statement to
avoid compiler warning of "unreachable statement".
(2) Constexpr.h: need to treat cudacc similarly to msvc.

(Note: this ignores all push blocking failures!)

Reviewed By: dzhulgakov

Differential Revision: D5387061

fbshipit-source-id: f002ab5ec00d4dcd85d86386f87a0327023afa1b

5 years agoMove __CLANG_PREREQ to folly/CPortabiilty.h
Yedidya Feldblum [Wed, 26 Jul 2017 03:50:18 +0000 (20:50 -0700)]
Move __CLANG_PREREQ to folly/CPortabiilty.h

Summary: [Folly] Move `__CLANG_PREREQ` to `folly/CPortabiilty.h`.

Reviewed By: Orvid

Differential Revision: D5496372

fbshipit-source-id: 710af3d30aa8bd0e5f645beede354e3463f1bb25

5 years agoThere is no HAVE_SHADOW_LOCAL_WARNINGS
Yedidya Feldblum [Wed, 26 Jul 2017 03:50:16 +0000 (20:50 -0700)]
There is no HAVE_SHADOW_LOCAL_WARNINGS

Summary:
[Folly] There is no `HAVE_SHADOW_LOCAL_WARNINGS`

It is `FOLLY_HAVE_SHADOW_LOCAL_WARNINGS`.

Reviewed By: Orvid

Differential Revision: D5496247

fbshipit-source-id: 689f40180180465bdc44593059e44fb64cf3e415

5 years agoFix include typo
Mingtao Yang [Tue, 25 Jul 2017 22:27:18 +0000 (15:27 -0700)]
Fix include typo

Reviewed By: anirudhvr

Differential Revision: D5492790

fbshipit-source-id: 10e868976a7ea42673d5b5c906a53c6c9495a288

5 years agoadd import to main in logging example
nicksbyman [Tue, 25 Jul 2017 20:04:17 +0000 (13:04 -0700)]
add import to main in logging example

Summary: Closes https://github.com/facebook/folly/pull/642

Reviewed By: Orvid

Differential Revision: D5471368

Pulled By: yfeldblum

fbshipit-source-id: 3bbafd04b93828121ba829027959b6b3e0e55888

5 years agoMove OpenSSL locking code out of SSLContext
Mingtao Yang [Tue, 25 Jul 2017 18:52:40 +0000 (11:52 -0700)]
Move OpenSSL locking code out of SSLContext

Summary:
OpenSSL 1.1.0 deprecates the callback based locking setup in favor
for platform native mutexes.

Added `OPENSSL_init_ssl` in the OpenSSL portability module for OpenSSL API < 1.1.0. This implements
the standard OpenSSL library initialization routines (taken from SSLContext::initializeOpenSSL).

Added `OPENSSL_cleanup` in the OpenSSL portability module for OpenSSL API < 1.1.0. This implements
the cleanup routine from SSLContext::cleanupOpenSSL.

Removed `SSLContext::SSLLockType`. Replaced with `folly::ssl::LockType`.

Reviewed By: mzlee, ngoyal

Differential Revision: D5404777

fbshipit-source-id: 7e5d9bf4a6683afb5560ada0a5b73cac3ff2662b

5 years agoFix double-free in DynamicConverter
Nicholas Ormrod [Tue, 25 Jul 2017 17:50:36 +0000 (10:50 -0700)]
Fix double-free in DynamicConverter

Summary:
If an exception is thrown during the construction of value in a container, then the Transformer iterator will not successfully reconstruct a cache_ object after explicitly calling its destructor (due to the exception being thrown), which results in a double-free when cache_ is destroyed as part of Transformer's destructor.

Conveniently, there exists a piece of code designed to solve just this problem: folly::Optional. Replace cache_ and valid_ with folly::Optional.

This also fixes the unnecessary requirement that container value types have default constructors, since cache_ is no longer default constructed inside of Transformer.

Reviewed By: markisaa

Differential Revision: D5472342

fbshipit-source-id: eade1f7ce260b9b3406d92af8255b5ffa4e4a51c

5 years agoReplaceable
Phil Willoughby [Tue, 25 Jul 2017 07:17:24 +0000 (00:17 -0700)]
Replaceable

Summary:
An instance of `Replaceable<T>` wraps an instance of `T`.

You access the inner `T` instance with `operator*` and `operator->` (as if
it were a smart pointer).

`Replaceable<T>` adds no indirection cost and performs no allocations.

`Replaceable<T>` has the same size and alignment as `T`.

You can replace the `T` within a `Replaceable<T>` using the `emplace` method
(presuming that it is constructible and destructible without throwing
exceptions). If the destructor or constructor you're using could throw an
exception you should use `Optional<T>` instead, as it's not a logic error for
that to be empty.

Reviewed By: yfeldblum

Differential Revision: D5346528

fbshipit-source-id: c7d72e73ea04e371325327a7ff0b345315d6e5ac

5 years agoMove the SpookyHash libraries into folly/hash v2017.07.24.00
Yedidya Feldblum [Mon, 24 Jul 2017 05:24:46 +0000 (22:24 -0700)]
Move the SpookyHash libraries into folly/hash

Summary:
[Folly] Move the SpookyHash libraries into `folly/hash`.

And propagate the changes to `#include` lines, etc.

Reviewed By: Orvid

Differential Revision: D5477735

fbshipit-source-id: 94fe95ece05b52bde1466ab5f9fb8b53a4c59bed

5 years agoOutline the throw statements in Try
Yedidya Feldblum [Mon, 24 Jul 2017 04:43:04 +0000 (21:43 -0700)]
Outline the throw statements in Try

Summary:
[Folly] Outline the `throw` statements in `Try`.

They are by definition cold and so we gain nothing from inlining them.

Reviewed By: Orvid

Differential Revision: D5478237

fbshipit-source-id: f413251a56ca4cbddcf3baea6679a552ae5bb19e

5 years agoAdd fnv1-a hash to Hash
Subodh Iyengar [Sun, 23 Jul 2017 18:15:06 +0000 (11:15 -0700)]
Add fnv1-a hash to Hash

Summary:
Add fnv1-a 64 bit hash to Hash.h.
fnv1-a is supposed to be preferred over
fnv1.

Reviewed By: yfeldblum

Differential Revision: D5453401

fbshipit-source-id: c13f12ef11eb6745c95f3901b14ceafce90ea0ea

5 years agoRevert D5455584: [Folly] Move the SpookyHash libraries into folly/hash
Mihaela Ogrezeanu [Sat, 22 Jul 2017 10:03:41 +0000 (03:03 -0700)]
Revert D5455584: [Folly] Move the SpookyHash libraries into folly/hash

Summary:
This reverts commit 616b04579eb6c822023b04840b075f3ac9fbb720

bypass-lint

Differential Revision: D5455584

fbshipit-source-id: afc712fe40121232f52a5bad781350581cec6ce8

5 years agoMove the SpookyHash libraries into folly/hash
Yedidya Feldblum [Sat, 22 Jul 2017 08:17:31 +0000 (01:17 -0700)]
Move the SpookyHash libraries into folly/hash

Summary:
[Folly] Move the SpookyHash libraries into `folly/hash`.

And propagate the changes to `#include` lines, etc.

Reviewed By: ot, ericniebler, Orvid

Differential Revision: D5455584

fbshipit-source-id: 616b04579eb6c822023b04840b075f3ac9fbb720

5 years agocrc32c: add missing header for std::runtime_error
Stephen Chen [Fri, 21 Jul 2017 21:24:04 +0000 (14:24 -0700)]
crc32c: add missing header for std::runtime_error

Summary: On the non sse42 path, we throw std::runtime_error, but Crc32cDetail.cpp is missing the header for it so it fails to compile on aarch64.

Reviewed By: yfeldblum

Differential Revision: D5468906

fbshipit-source-id: 2d5408621cb2b6758d3501407ed3d2a40d79f1b0

5 years agoApply clang-format to folly/experimental/symbolizer/
Yedidya Feldblum [Fri, 21 Jul 2017 08:45:34 +0000 (01:45 -0700)]
Apply clang-format to folly/experimental/symbolizer/

Summary: [Folly] Apply `clang-format` to `folly/experimental/symbolizer/`.

Reviewed By: Orvid

Differential Revision: D5468832

fbshipit-source-id: 94a0f82312769be0e8be724c11f97e14425ead10

5 years agoApply clang-format to folly/experimental/io/
Yedidya Feldblum [Fri, 21 Jul 2017 08:44:43 +0000 (01:44 -0700)]
Apply clang-format to folly/experimental/io/

Summary: [Folly] Apply `clang-format` to `folly/experimental/io/`.

Reviewed By: Orvid

Differential Revision: D5460571

fbshipit-source-id: d19aff829316dd277e65620196e12db8cad46787

5 years agoStyle tweaks to max_align_v calculation
Yedidya Feldblum [Fri, 21 Jul 2017 07:20:14 +0000 (00:20 -0700)]
Style tweaks to max_align_v calculation

Summary:
[Folly] Style tweaks to `max_align_v` calculation.

* Change ns from `folly::detail` since that can be crowded and many other folly libraries may include this header.
* Extract a 2-param `max` alias.
* Fix an incorrectly hardcoded `size_t`.

Reviewed By: WillerZ

Differential Revision: D5468758

fbshipit-source-id: 14a3f67323020a3cfce2b3b46f5f64f3e6125027

5 years agoApply clang-format to folly/tracing/
Yedidya Feldblum [Fri, 21 Jul 2017 02:29:51 +0000 (19:29 -0700)]
Apply clang-format to folly/tracing/

Summary: [Folly] Apply `clang-format` to `folly/tracing/`.

Reviewed By: Orvid

Differential Revision: D5460511

fbshipit-source-id: c7a7d34211044a1b76934f184a8552a96d0bad91

5 years agoParse suffixes without switch-fallthrough in huge-pages
Yedidya Feldblum [Fri, 21 Jul 2017 02:29:14 +0000 (19:29 -0700)]
Parse suffixes without switch-fallthrough in huge-pages

Summary: [Folly] Parse suffixes without switch-fallthrough in huge-pages. It is clever, but weird. We can use an immediately-executed lambda expression to make it convenient.

Reviewed By: Orvid

Differential Revision: D5467585

fbshipit-source-id: 02ddb97641db97e38e3f40388ecc522eccd436cb

5 years agoApply clang-format to folly/experimental/bser/
Yedidya Feldblum [Thu, 20 Jul 2017 23:52:28 +0000 (16:52 -0700)]
Apply clang-format to folly/experimental/bser/

Summary: [Folly] Apply `clang-format` to `folly/experimental/bser/`.

Reviewed By: Orvid

Differential Revision: D5460552

fbshipit-source-id: e103f8920eb29b7c14688f5bbb3e28129ef35e96

5 years agoDrop a remnant of gcc48 support in futures
Yedidya Feldblum [Thu, 20 Jul 2017 22:10:41 +0000 (15:10 -0700)]
Drop a remnant of gcc48 support in futures

Summary: [Folly] Drop a remnant of gcc48 support in futures. Because gcc48 is no longer supported.

Reviewed By: Orvid, meyering

Differential Revision: D5460788

fbshipit-source-id: 86e2985a0980357641d18f59fd25b9667ec30ab0