- 10 Apr, 2018 6 commits
-
-
Alexander Zhavnerchik authored
Summary: If FOLLY_SETTING_DEFINE(...) is put into .cpp file right now you will get linker error about undefined references. According to http://en.cppreference.com/w/cpp/language/inline 2) The definition of an inline function or variable (since C++17) must be present in the translation unit where it is accessed (not necessarily before the point of access). Hence the linker error. This diff fixes that. Reviewed By: alikhtarov, mnv104 Differential Revision: D7567469 fbshipit-source-id: 02049e4881e50c414aeb506745e02eed1256daad
-
Adam Simpkins authored
Summary: Update `cmake_configure()`, `cmake_install()`, and `fb_github_cmake_install()` to support specifying the directory where CMakeLists.txt is found, relative to the directory where the build is being performed. Previously these functions where hardcoded to assume that CMakeLists.txt was always found at '..' Reviewed By: snarkmaster Differential Revision: D7540689 fbshipit-source-id: efd3d044345fadc0346e436c01d0a247e1b6fd70
-
Adam Simpkins authored
Summary: Add a macro to help users define the `getBaseLoggingConfig()` function. While I would prefer to avoid macros if possible, this seems worthwhile. This saves 4 or 5 lines of boilerplate code in each program that sets a custom base logger setting. It also reduces the likelihood of a developer accidentally having a typo in the function name, which would still build successfully but not have the desired results. Reviewed By: chadaustin Differential Revision: D7457652 fbshipit-source-id: 1c316c7ea6949c16bd7b61c0440cc1ee69ecb83e
-
Adam Simpkins authored
Summary: Add folly::initLoggingOrDie(), which behaves like `initLogging()` but handles errors by printing a message to stderr and then calling `exit(1)`. Most programs are expected to initialize logging early on during program start-up, and will likely use a command line argument or other configuration value as the logging settings. If an error occurs they usually want to print the message to stderr and exit unsuccesfully. `initLoggingOrDie()` makes it easy to perform these steps without requiring programs to write their own exception handlers to handle errors from `initLogging()`. Reviewed By: chadaustin Differential Revision: D7164830 fbshipit-source-id: d688046f1b6240c948e4aaabfc9fb24ba3d9ff89
-
Anton Likhtarov authored
Summary: - Let's enforce a single definition. Also makes the implementation much simpler. - Collect all static info about a setting in a Metadata struct Differential Revision: D7544210 fbshipit-source-id: d3f2ef617bd817d355a37e11fa9425b6a4259384
-
Eugene Pekurovsky authored
Summary: Currently, the memory used by a map instance is available only via computeStats(), which is quite expensive. A lightweight method is needed for getting the map memory footprint on a hot code path. Reviewed By: nbronson Differential Revision: D7544180 fbshipit-source-id: 3cbc98bb9f1c5e7f75fd9eb7f89016580fbb6523
-
- 09 Apr, 2018 3 commits
-
-
Orvid King authored
Summary: Which only supports C++11 style constepxr. Reviewed By: simpkins Differential Revision: D7546457 fbshipit-source-id: 52db98379096dd3b25f656e7e62238ce10537bf7
-
Alexander Zhavnerchik authored
Summary: According to http://en.cppreference.com/w/cpp/language/operators The overload of operator -> must either return a raw pointer or return an object (by reference or by value), for which operator -> is in turn overloaded. Hence this change. Reviewed By: mnv104 Differential Revision: D7548832 fbshipit-source-id: d98ff1f96bc00dc6e2e5cb084b96091a61421627
-
Denis Samoylov authored
Summary: Tudor who wrote this left the company... so RB.. you are the reviewers :) 1. make default commands as constants 2. remove fake message about ",h" 3. align quota usage from mix to ' 4. add support for version command 5. add function to identify built-in command (is needed for an external application to make a decision if something is mandatory or not) Reviewed By: marcinpe Differential Revision: D7048169 fbshipit-source-id: b48cf7df28cfa387e028a1cc869332407314c906
-
- 08 Apr, 2018 1 commit
-
-
Alex Guzman authored
Summary: Adds a few more OpenSSL compatibility functions for working with X509_STORE and its objects. Reviewed By: knekritz Differential Revision: D7540930 fbshipit-source-id: 0275a200d673386988bc25140b1d827859b04364
-
- 07 Apr, 2018 1 commit
-
-
Marc Celani authored
Summary: hazptr_obj is copyable and moveable, but doing so would cause a bug, because the next ptr would point to the object that was copied/moved from, which can oftentimes be garbage or another object that has not yet retired. This diff changes the copy/move constructors and assignment operators to simply check that the rhs has not been retired. Reviewed By: magedm Differential Revision: D7539444 fbshipit-source-id: f9325c7b886fcf4b553344ee37f2355ca41268b6
-
- 06 Apr, 2018 2 commits
-
-
Adam Simpkins authored
Summary: Install the CMake package configuration file under lib/cmake/folly rather than share/folly. CMake will automatically search both of these locations, but lib/cmake/folly appears to be a more commonly-used location across other open source projects. Reviewed By: Orvid Differential Revision: D7479056 fbshipit-source-id: becd3d4c05e774d2aede20f6a7a50f57d6c05875
-
Adam Simpkins authored
Summary: - Use CMakePackageConfigHelpers to help generate the file - Print a message about where folly was found if not using QUIET - Make the include, lib, and cmake installation directories configurable Reviewed By: wez Differential Revision: D7479058 fbshipit-source-id: 2548acc9d6de90d11da02ac576a58ce5ca939766
-
- 05 Apr, 2018 5 commits
-
-
Steve O'Brien authored
Summary: Include the new `UTF8String.h` header where needed. Reviewed By: Orvid Differential Revision: D7473655 fbshipit-source-id: 9d1b820123a786d8eb3d6405a4ff35331de41694
-
Orvid King authored
Summary: Neither Folly nor Thrift actually version anymore and haven't in multiple years, so just remove the code to do this. Reviewed By: yfeldblum Differential Revision: D7512580 fbshipit-source-id: 89c61cf4ef3d78ea7c09ba6855e0717cfbe022d6
-
Dan Melnic authored
Summary: Fix compile error: error: variable 'b' set but not used [-Werror=unused-but-set-variable] Reviewed By: yfeldblum Differential Revision: D7471259 fbshipit-source-id: 784e874200bb44ec9bddf4a3c12f7a90be12d17b
-
Asier Gutierrez authored
Summary: Added missing installation of UTF8String.h Closes https://github.com/facebook/folly/pull/813 Reviewed By: yfeldblum Differential Revision: D7506038 Pulled By: Orvid fbshipit-source-id: 9821a0040c44715cfd68852743b64a32df0dcf57
-
Orvid King authored
Summary: MSVC 2015 Update 3 can't parse these with curly-brace init'd, so swap the assignment. The result is the exact same. Reviewed By: simpkins Differential Revision: D7508756 fbshipit-source-id: 5e60607f978a87ae8bfed22086d1dccef15759ac
-
- 04 Apr, 2018 10 commits
-
-
Brian Gesiak authored
Summary: Optimized builds of //folly/experimental/coro test Coro.Sleep would almost always fail because the compiler would generate code that would only sleep for 0.98 seconds. Perform some simple rounding in order to ignore slight optimizations like these. Reviewed By: wqfish Differential Revision: D7496416 fbshipit-source-id: f81ff30922fbf3e5d2086fde50f4a469bdf72e51
-
Nathan Bronson authored
Summary: F14HashToken encapsulates the work of hash_function(), which is the same across F14 containers that have the same key_type and equal hash_function() (same type and operator==). This diff adds documentation that callers may rely on this fact, which means they can use this feature to reduce work if a single key is access in multiple maps/sets. (Note: this ignores all push blocking failures!) Reviewed By: shixiao Differential Revision: D7506737 fbshipit-source-id: 321032d619434501b1e0544962e54732bfc4c970
-
Janusz Kudelka authored
Summary: Allow the user to give their own pair implementation. This allows using a packed pair. Reviewed By: yfeldblum Differential Revision: D7504521 fbshipit-source-id: 11888594b8b3ef3f530ebd95b8006ef6f5afbc65
-
Tom Jackson authored
Summary: Terabytes aren't Web Scale. Reviewed By: ot, philippv, luciang Differential Revision: D7479752 fbshipit-source-id: fd353933e642b1ee024c28107c8fcb6a55fe755e
-
Tom Jackson authored
Summary: Until I do a PR on `double_conversion`, we need to work around this by catching the trailing 'e' case. Reviewed By: luciang Differential Revision: D7481130 fbshipit-source-id: 2734dbe834e6cd69c6dfe41d6b4e9a7a548a7da8
-
Jun Li (Wormhole) authored
Summary: When `startFail()` is called, it sets the state to StateEnum::ERROR. There is a chance that immediate read callback is scheduled to run in next event loop. The callback calls handleRead() then triggers `assert(state_ == StateEnum::ESTABLISHED)` in `AsyncSokcet::handleRead`. Cancel any immediate read callback when startFail is called. Reviewed By: yfeldblum Differential Revision: D7051956 fbshipit-source-id: 0d6693d851b272355a4f36ab8d001969fa47750e
-
Brian Gesiak authored
Summary: At `-O0` each coroutine call results in a heap allocation. This combined with the increased memory pressure when using ASAN results in an invalid memory access beyond the maximum address. Avoid the problem by limiting the recursion to 5,000 frames deep, instead of 10,000. This still fulfills the intent of the test, but without pushing the limits of ASAN. Reviewed By: wqfish Differential Revision: D7503976 fbshipit-source-id: 7850a9d9db23328d42c25b74a1290caa7773e6a7
-
Andrii Grynenko authored
Summary: sendRequestSync should only be implemented by channels, which own threads looping EventBases. Reviewed By: phoad Differential Revision: D7464392 fbshipit-source-id: bde6edc85438bb406592291330869972f88c787a
-
Nathan Bronson authored
Summary: Using an array of prehash tokens is quite inconvenient without the ability to default construct them. Reviewed By: shixiao Differential Revision: D7490113 fbshipit-source-id: f802a7dc6dc2c603c4682e5f384d9f135220cd54
-
Alex Wang authored
Summary: Apple Clang 9 (clang-900.0.39.2) on macOS 10.13.3, when configured with `FOLLY_USE_LIBCPP`, fails to build `SynchronizedTest.cpp` with the following error: In file included from /Users/awang/code/folly/folly/test/SynchronizedTest.cpp:20: /Users/awang/code/folly/folly/Synchronized.h:511:9: error: no matching constructor for initialization of 'folly::Synchronized<int, NonDefaultConstructibleMutex>' : Synchronized{std::piecewise_construct, ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/awang/code/folly/folly/test/SynchronizedTest.cpp:539:25: note: in instantiation of function template specialization 'folly::Synchronized<int, NonDefaultConstructibleMutex>::Synchronized<int &&, int &&>' requested here auto&& synchronized = folly::Synchronized<int, NonDefaultConstructibleMutex>{ ^ /Users/awang/code/folly/folly/Synchronized.h:499:12: note: candidate constructor not viable: no known conversion from 'const std::__1::piecewise_construct_t' to 'in_place_t' (aka 'folly::in_place_tag (&)(folly::in_place_tag)') for 1st argument explicit Synchronized(in_place_t, Args&&... args) ^ /Users/awang/code/folly/folly/Synchronized.h:764:3: note: candidate template ignored: could not match 'std::__1::integer_sequence' against 'folly::integer_sequence' Synchronized( ^ <other constructors not viable due to number-of-parameter mismatches> The proximate cause of the error is that `make_index_sequence` is generating a `folly::index_sequence`, but the delegatee constructor only accepts `std::index_sequence`. Changing the delegatee constructor to take an unqualified `index_sequence` solves the problem, since the return type for an unqualified `make_index_sequence` should be the same as the unqualified `index_sequence`. This appears to have been introduced in 8581e9e0. Clang ends up using the Folly implementation of `make_integer_sequence` because `__cpp_lib_integer_sequence` is still not defined, even though `integer_sequence` support was added to libc++ way back in mid-2013, in revision 185343. There is a bug open on the LLVM bug tracker (#18584 [1]) to add the `__cpp_lib_integer_sequence` and other feature test macros, but the last activity on it was in late 2014. This results in the compiler successfully finding the definition for `std::index_sequence` (unlike what would happen with C++11 compilers), but using the folly implementation for `make_index_sequence`. Qualified `std::index_sequence` is used in a few other places, but `std::` was not removed from those usages because they reside in functions that have C++14 features that would prevent a C++11 compiler from compiling them at all, let alone with a `std::` v.s. `folly::` mismatch: - folly/test/FormatBenchmark.cpp - decltype(auto) is used for format20Numbers() - folly/container/Foreach-inl.h - decltype(auto) and generic lambdas are used in a few of the for_each_range_impl() overloads - decltype(auto) is used in some of the impl() overloads - decltype(auto) is used as the return type for fetch() - folly/container/Iterator.h - decltype(auto) is used as the get_emplace_arg() and unwrap_emplace_arg() return type A different way of solving the problem would be to add a special case for Clang to the `integer_sequence` check, similar to what is done for MSVC, but that seemed like partially papering over the problem. The best solution would be to get those feature macros into libc++, but that wouldn't help for already-released versions of LLVM. [0]: https://blogs.msdn.microsoft.com/vcblog/2014/06/06/c14-stl-features-fixes-and-breaking-changes-in-visual-studio-14-ctp1/ [1]: https://bugs.llvm.org/show_bug.cgi?id=18584 Closes https://github.com/facebook/folly/pull/810 Reviewed By: aary Differential Revision: D7482813 Pulled By: yfeldblum fbshipit-source-id: 36310acbc227bfe646d6fad877a406b8d57407e5
-
- 03 Apr, 2018 4 commits
-
-
Orvid King authored
Summary: Continuing from D7482813, ensure everywhere in folly is using the folly versions of integer and index sequences. Also implement index_sequence_for and use it. Reviewed By: aary Differential Revision: D7490483 fbshipit-source-id: 082209dd6c6ca11f67b38dbe4529d46e9dce57ce
-
Steve O'Brien authored
Summary: This has functionality not overlapping with `FBString` or `folly::fbstring` or `folly::StringPiece`; and a pretty expensive dependency on `boost/regex`. Much of the thrift-gen `_types.h` code comes from this inclusion chain: * `_types.h` uses strings (for `str` fields in thrift structs); these are represented by `folly::fbstring`, from... * `folly/String.h` includes `FBString.h` and other things to support string-related stuff; simple enough. But it has a class `UTF8StringPiece`, which uses an iterator, from Boost called `boost::u8_to_u32_iterator<char const *>`. So then we have... * `boost/regex/pending/unicode_iterator.hpp` includes tons of things in the usual boost header avalanche: iterator facades, lots of `mpl` code. Reviewed By: meyering Differential Revision: D7373577 fbshipit-source-id: efdb920b6fe8c7b7c57d3becf2bf0710975fcf73
-
Xiao Shi authored
Summary: Upon `erase`, F14 vector containers destroys the value and erases the item (i.e., index into the `values_` vector) from the underlying hashtable. However, the item still needs to be hashable when erasing from the hashtable, so we have to destroy the value _afterwards_. This diff fixes the bug. There are a couple of reasons that this was previous undetected / did not cause a problem: * for POD types, `allocator_traits::destroy` is a no-op. * this code path is only hit if the chunk of the destroyed item has hosted overflowed items * the use was immediately after free * our test coverage did not have vector policy + non-SSO string keys Reviewed By: nbronson Differential Revision: D7488050 fbshipit-source-id: ea29e875a0c7a39b8deed40a15777a6983438836
-
Anton Likhtarov authored
Summary: A library that provides gflags-like functionality, with the addition of: - Threadsafe read/writes for all flags - Arbitrary C++ types - No declare/define split, all setting definitions are declaration and are safe to place in headers - Runtime introspection of all flags - Compile time and runtime collision checks - Namespaces per project Down the road: - Overlay support (change a set of settings based on some context) - Construct arbitrary user types from string - Support multiple library instances with distinct settings in a single process - Callbacks on setting updates Reviewed By: aary, mnv104 Differential Revision: D6217956 fbshipit-source-id: 7c03d79c7601ce7b266df78e62b7193712d8331e
-
- 02 Apr, 2018 1 commit
-
-
Andrew Gallagher authored
Summary: This diff change the `FOLLY_USE_SYMBOLIZER` gates to check for a value of `1`. Reviewed By: yfeldblum Differential Revision: D7471272 fbshipit-source-id: 74dbb4d56e1adc56ec75af5b4950ca2c027851cc
-
- 01 Apr, 2018 1 commit
-
-
Andrew Gallagher authored
Summary: We used `link_whole` to make sure the `setStackTraceGetter` constructor is always linked when using Singleton's to setup symbolizer for stack traces. However, using `link_whole` means we always link in the singleton library, even if it's never used. This diff merges `SingletonStackTrace.cpp` into `Singleton.cpp` to avoid the need for `link_whole` and to link the former if and only if we use the latter. Reviewed By: pixelb Differential Revision: D7230733 fbshipit-source-id: de9be51a4eefee201563523d25800ab19ea777e3
-
- 31 Mar, 2018 3 commits
-
-
Orvid King authored
Summary: These were being mangled as C++ functions rather than C functions. Reviewed By: yfeldblum Differential Revision: D7462668 fbshipit-source-id: e4e83e16aafad3d888599dd78bdbb4ac2711ad7f
-
Orvid King authored
Summary: It's unused, remove it. Reviewed By: yfeldblum Differential Revision: D7462683 fbshipit-source-id: 604c5691d69f2576c83c25350d29515efbc77a7b
-
Orvid King authored
Summary: `timespec` is defined in `sys/time.h`, so don't rely on `<chrono>` including it. Reviewed By: yfeldblum Differential Revision: D7462731 fbshipit-source-id: 590954e2230a0da322e2f5eb966bb49b18aa56f7
-
- 30 Mar, 2018 3 commits
-
-
Seva Oparin authored
Summary: Add API to AsyncUdpSocket to support three options on the socket. - SO_RCVBUF and SO_SNDBUG options are responsible for the size of the queues that contain received and sent messages, respectively. - SO_BUSY_POLL sets the approximate time in microseconds to busy poll on a blocking receive when there is no data Details in socket man: http://man7.org/linux/man-pages/man7/socket.7.html Reviewed By: yfeldblum Differential Revision: D7372123 fbshipit-source-id: 5fd92489cbe86879d63df208c3821febdadb0020
-
Orvid King authored
Summary: MSVC calls this out explicitly as a non-standard cast and errors. Reviewed By: yfeldblum Differential Revision: D7451404 fbshipit-source-id: 9261b15fdc47b6ffbc1b53e83cbfbe9f9af894a9
-
Mingtao Yang authored
Reviewed By: ouj Differential Revision: D7424982 fbshipit-source-id: 3190564d3e79d10d7d64c1822a53e058a201f87d
-