1. 19 Feb, 2021 4 commits
    • Yedidya Feldblum's avatar
      mark type_info_of param as [[maybe_unused]] · bdd1109c
      Yedidya Feldblum authored
      Summary: Mark the param to `folly::type_info_of` param as `[[maybe_unused]]` since, when RTTI is unavailable, it is unused.
      
      Differential Revision: D26537864
      
      fbshipit-source-id: 3fd0a1bb0d3ecbbcdc5e07f153e321a0b8537478
      bdd1109c
    • Yedidya Feldblum's avatar
      let [[maybe_unused]] wrapper support msvc · 77f0c0d9
      Yedidya Feldblum authored
      Summary: Let `FOLLY_MAYBE_UNUSED` which wraps `[[maybe_unused]]` support MSVC even when the latter misreports `__cplusplus`.
      
      Differential Revision: D26537706
      
      fbshipit-source-id: 37554b7f9d27332088b72de41e53a5b85ef46327
      77f0c0d9
    • Yedidya Feldblum's avatar
      in uncaught_exceptions, if windows, assume c++17 · 36eb535c
      Yedidya Feldblum authored
      Summary: This permits removal of the `_getptd()`-based implementation of `folly::uncaught_exceptions` sometimes used on windows, in favor of forwarding to `std::uncaught_exceptions`.
      
      Reviewed By: akrieger
      
      Differential Revision: D26509011
      
      fbshipit-source-id: b8fd14df91fcd849420d3c52328cb080b528245b
      36eb535c
    • Misha Shneerson's avatar
      Fix ASAN violations when shutting down FiberManager from python · 36dbf002
      Misha Shneerson authored
      Reviewed By: andriigrynenko
      
      Differential Revision: D26497717
      
      fbshipit-source-id: 35307fce7f9e85882f8f9e5a6bdfe651122727a3
      36dbf002
  2. 18 Feb, 2021 5 commits
    • Yedidya Feldblum's avatar
      ensure all lang tests are in the cmake build · 1d97d5b6
      Yedidya Feldblum authored
      Summary: Ensure all the tests in `folly/lang/test/` are in the cmake build. For disambiguation, prefix them all with `lang_`.
      
      Reviewed By: Orvid
      
      Differential Revision: D26496837
      
      fbshipit-source-id: 185a7990c2c7f535123229a07436e901dca6ae7f
      1d97d5b6
    • Orvid King's avatar
      Use nullptr not 0 for fallback in cpp demangle code · ee838173
      Orvid King authored
      Summary: This returns a char* so correct return is nullptr, not 0.
      
      Reviewed By: usikder
      
      Differential Revision: D26122982
      
      fbshipit-source-id: 8c62520403fce966f83939be7cc03f6dc6be4aee
      ee838173
    • Yedidya Feldblum's avatar
      cut log lines in uncaught_exceptions test · 0effaa94
      Yedidya Feldblum authored
      Summary: Cut log lines in `folly::uncaught_exceptions` test cases. Having log lines is helpful when debugging test failures but we can always add them in when necessary. This makes running the test binary directly less noisy, and running test binaries directly is an important case not to be overlooked.
      
      Reviewed By: markisaa
      
      Differential Revision: D26504200
      
      fbshipit-source-id: 00e06e1396b9ccc9cdd739ace1007726ebaa3d88
      0effaa94
    • Yedidya Feldblum's avatar
      getdeps show-build-dir · 646b9998
      Yedidya Feldblum authored
      Summary: A show-build-dir subcommand. Possibly useful for building a project and then running only one test or benchmark binary directly.
      
      Reviewed By: wez
      
      Differential Revision: D26502869
      
      fbshipit-source-id: 0d8f6c42a2bbeb2440503a39c7fc770e3b3e4fff
      646b9998
    • Yedidya Feldblum's avatar
      cut std::hash specialization for int128 · cb2d12eb
      Yedidya Feldblum authored
      Summary:
      Cut `std::hash` specialization in folly for `signed __int128` and `unsigned __int128`.
      
      There are cases where folly does polyfill things in the global and standard namespaces, but in order for folly to play nicely with other libraries this practice is overall to be avoided.
      
      Reviewed By: nlutsenko
      
      Differential Revision: D26455137
      
      fbshipit-source-id: 948140513b8daf6fe777d04ea42346d69c5eb03f
      cb2d12eb
  3. 17 Feb, 2021 4 commits
    • Yedidya Feldblum's avatar
      no fancy macros in the enumerate tests · fbba2051
      Yedidya Feldblum authored
      Summary: Avoid the use of fancy macros in the `folly::enumerate` test suite in order to facilitate cmake's gtest integration.
      
      Reviewed By: Orvid
      
      Differential Revision: D26477530
      
      fbshipit-source-id: 1838709e76016c389b052a9523a0681c58b8af96
      fbba2051
    • Yedidya Feldblum's avatar
      cut EventBaseLocal::emplace overload taking pointer · 04d6ac76
      Yedidya Feldblum authored
      Summary: Cut the `EventBaseLocal::emplace` overload taking a pointer since it is unused and to consolidate on the approach of not letting internals leak.
      
      Differential Revision: D26246689
      
      fbshipit-source-id: 0d9dc1bfcc3d37dc980142b221ee4443b98205a3
      04d6ac76
    • Lee Howes's avatar
      Switch SerialExecutor to default to the immutable global executor · 0f4db9c7
      Lee Howes authored
      Summary: Use the global immutable executor by default and remove the default entirely for the deprecated form.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26414638
      
      fbshipit-source-id: b48fe4683165e7f29e8003560f2917e143138bb0
      0f4db9c7
    • Yedidya Feldblum's avatar
      let File tests not use /etc/hosts · f45ed0ab
      Yedidya Feldblum authored
      Summary: Let `File` tests not use `/etc/hosts` since that file is not portable across all systems. Likewise the fs-util tests using `/usr/lib` and `/usr/bin`.
      
      Reviewed By: chadaustin
      
      Differential Revision: D26447117
      
      fbshipit-source-id: 669a3d7e0ea4efd54ca2efd5c15d8a21227b5c8c
      f45ed0ab
  4. 16 Feb, 2021 2 commits
    • Yedidya Feldblum's avatar
      Let some utility functions be invocable objects · 993de579
      Yedidya Feldblum authored
      Summary:
      [Folly] Let some utility functions be invocable objects: `to_signed`, `to_unsigned`, `to_narrow`, `to_underlying`.
      
      Additionally, force the template type param to be deduced.
      
      Reviewed By: markisaa
      
      Differential Revision: D21959729
      
      fbshipit-source-id: eedd9f2f84efb62c99ed0d5f65123a7fe000cf0a
      993de579
    • Lior Israeli's avatar
      Remove seperate logic for first value in histogram · 57b8506e
      Lior Israeli authored
      Summary:
      Currently there is logic that keeps histograms which only have one value reported to it separately.
      
      The multi level histogram keeps the histogram for several time buckets. Just in case we had only one value added, it will keep reporting the value even if it was reported long ago and shouldn't appear in the time window level we are querying.
      
      This is inconsistent with non histogram metrics (`avg` for example) reported from the same histogram, which don't have this logic.
      
      A scenario would look like this:
      1. Report value 5 to histogram
      2. Immediately query the 60 second level -> `avg` reports 5, `p50` reports 5.
      3. Wait 2 minutes
      4. look at the 60 second level -> `avg` reports 0 (no value in the last 60 seconds) but `p50` keeps reporting 5.
      
      I think this does more harm than good, so I suggest to kill this behavior.
      
      Reviewed By: simpkins
      
      Differential Revision: D26339016
      
      fbshipit-source-id: 120485f8b78876e60ce66a534edcf86e7d9a836d
      57b8506e
  5. 14 Feb, 2021 4 commits
    • Yedidya Feldblum's avatar
      no shared_ptr in EventBaseLocal · 38c1a117
      Yedidya Feldblum authored
      Summary: [folly] no `shared_ptr` storage in `EventBaseLocal` since its refcount operations are unnecessary. Pare it down to `unique_ptr` with a straightforward fun-ptr deleter.
      
      Reviewed By: iahs
      
      Differential Revision: D26246619
      
      fbshipit-source-id: 3d0214ccb6c4730ca7b573065b4468a0dce85d40
      38c1a117
    • Yedidya Feldblum's avatar
      thunk · 619ff1d1
      Yedidya Feldblum authored
      Summary:
      Introduce `folly::detail::thunk`, a carefully curated collection of generic general-purpose thunk templates: `make`, `ruin`, `ctor`, `dtor`.
      
      Initial uses in `StaticSingletonManager` and `to_erased_unique_ptr`.
      
      Reviewed By: vitaut
      
      Differential Revision: D26417824
      
      fbshipit-source-id: 482f4154a957b3c3dbeede726ed870a8d10c2a32
      619ff1d1
    • Yedidya Feldblum's avatar
      define FOLLY_CPLUSPLUS · fe3cce9b
      Yedidya Feldblum authored
      Summary:
      Define macro `FOLLY_CPLUSPLUS` on all platforms.
      
      Move the initial C++ language version check below the `#include` group.
      
      Reviewed By: Orvid
      
      Differential Revision: D26420758
      
      fbshipit-source-id: 33d156ae944e7112b007afc49e8fb929dc677b85
      fe3cce9b
    • Dan Melnic's avatar
      Move REGISTER_TYPED_TEST_CASE_P to cpp from h · af1bcd17
      Dan Melnic authored
      Summary: Move REGISTER_TYPED_TEST_CASE_P to cpp from h
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26440651
      
      fbshipit-source-id: 7efd63b2f4af3de206cf2abdba33c849145c7834
      af1bcd17
  6. 13 Feb, 2021 2 commits
    • Dan Melnic's avatar
      Avoid static init crash when compiling with clang 9.0 · ee856474
      Dan Melnic authored
      Summary: Avoid static init crash in testing::internal::TypedTestCasePState::VerifyRegisteredTestNames when compiling with clang 9.0 (works OK with clang-8.0)
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26419675
      
      fbshipit-source-id: c961ac0f73e3fc8d8852eb32c0b89634fb854c37
      ee856474
    • Ilya Maykov's avatar
      add unique ptr type for X509_PUBKEY · f604b03c
      Ilya Maykov authored
      Summary: See title.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26419855
      
      fbshipit-source-id: 2857c80eb2500d8d3d5f815a1f795ddeac31165f
      f604b03c
  7. 12 Feb, 2021 4 commits
    • Samuel Miller's avatar
      Adding SSL option setting to AsyncSSLSocket test client · 6f7d8f37
      Samuel Miller authored
      Summary: This allows the test client to be used with session tickets enabled, if desired
      
      Reviewed By: yfeldblum
      
      Differential Revision: D25795104
      
      fbshipit-source-id: 1adfb6c17c6da24db9c6367485a5cd0f8e534661
      6f7d8f37
    • Kevin Vigor's avatar
      allow specifying multiple CPUs in io_uring SQ_POLL mode. · aa8c3c8f
      Kevin Vigor authored
      Summary:
      Existing API allows user to specify a single preferred CPU for SQ_POLL workers,
      but it also allows specifying multiple workers.
      
      Add API to allow specifying a set of CPUs, not just one.
      
      The specified set of CPUs are used in round-robin fashion, so it is not strictly
      necessary that the number of CPUs and the number of workers be the same.
      
      #forceTDHashing
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26380317
      
      fbshipit-source-id: ecfd8722670ffc3e3dc246fae1bcb7f4d8e6f3e4
      aa8c3c8f
    • Dan Melnic's avatar
      Lower max submit so the test will not fail with EINVAL when SQ size is > CQ size · 12066f6a
      Dan Melnic authored
      Summary: Lower max submit so the test will not fail with EINVAL when SQ size is > CQ size
      
      Reviewed By: kevin-vigor
      
      Differential Revision: D26419746
      
      fbshipit-source-id: f9cbd4bef06b314f43ab667646d9e5ef61999246
      12066f6a
    • Ilya Maykov's avatar
      add unique ptr types for X509_SIG and X509_ALGOR · a6b3089a
      Ilya Maykov authored
      Summary: See title
      
      Reviewed By: knekritz
      
      Differential Revision: D26320388
      
      fbshipit-source-id: 2796ae36cd8779f56474d21e89e80562f7bad22d
      a6b3089a
  8. 11 Feb, 2021 7 commits
    • Yedidya Feldblum's avatar
      add missing co-invoke to async-generator safe-point test · 40b160ef
      Yedidya Feldblum authored
      Summary: The `AsyncGenerator` test for `co_safe_point` immediately-invokes a temporary coroutine function to return a coroutine object, but the temporary coroutine function goes out of scope while the returned coroutine is live. Use `co_invoke` to fix it.
      
      Reviewed By: lxfind
      
      Differential Revision: D26408345
      
      fbshipit-source-id: 4650ea57c01baffb1065560b661e3296cb0292cc
      40b160ef
    • Robert Quitt's avatar
      Fix CO_TEST_F to use updated googletest API · 229610b6
      Robert Quitt authored
      Summary:
      The new version of googletest has a different internal API for registering test suites. This diff updates `CO_TEST_` to match the new version of googletest. I created this diff by copying the new version of `GTEST_TEST_` and adding the coroutine `co_TestBody`, just like in the old version of `CO_TEST_`.
      
      ~~There is a problem that I'd like reviewer's feedback on: how do we cleanly make the switch over to the new version of `CO_TEST_`? This change is tied to a specific version of googletest.~~
      
      ~~I have 2 ideas so far:~~
      
      ~~(Plan 1) Land this diff stacked on top of D25585021, so that we don't have to manage two versions at once.~~ Not possible
      
      (Plan 2) Have two versions of `CO_TEST_` at the same time, but select which one to use based on a preprocessor macro defined in gtest.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26365504
      
      fbshipit-source-id: 196c2277c7942163951f5781b334d0bff5c34de8
      229610b6
    • Scott Pruett's avatar
      Bounded version of AsyncPipe · af8e836f
      Scott Pruett authored
      Summary:
      Some use-cases of AsyncPipe may want to backpressure writers in the
      case that readers start to slow down. Without backpressure, the queue
      (and pending work) can essentially grow without bound, leading to OOMs
      or starvation of other resources.
      
      This implements a bounded channel primitive by layering a semaphore
      in front of an existing AsyncPipe. It inherits similar cancellation behavior,
      though pending writes must be canceled in the case that the read end is destroyed.
      
      Reviewed By: iahs
      
      Differential Revision: D26260278
      
      fbshipit-source-id: a936cf021023b31a6db868e27e9855480a1dc405
      af8e836f
    • Dan Melnic's avatar
      Add io_uring SQ/CQ poll tests · 02c80c5d
      Dan Melnic authored
      Summary: Add io_uring SQ/CQ poll tests
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26387632
      
      fbshipit-source-id: 2b68fa4f9af41b76b90183a010f81a92537a6e3f
      02c80c5d
    • Victor Zverovich's avatar
      Remove BaseFormatter::fbstr() · 3a5deaca
      Victor Zverovich authored
      Summary: Remove `BaseFormatter::fbstr()` because it is virtually unused and those few cases that do use it are better off with `std::string`.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26358276
      
      fbshipit-source-id: e96b4958735b3c9c03010e1e3dcdd01abd2d6a33
      3a5deaca
    • Yedidya Feldblum's avatar
      let EventBaseLocal::getOrCreateFn function return value · 1486429b
      Yedidya Feldblum authored
      Summary:
      Let the function passed to `EventBaseLocal::getOrCreateFn` directly return the value to be stored, rather than allocating it and returning a pointer.
      
      Details of its storage should be internal to `EventBaseLocal` and should not leak out into the creator functions.
      
      Differential Revision: D26246341
      
      fbshipit-source-id: d72a62998985e42ef517eede3654324dc9f48709
      1486429b
    • Victor Zverovich's avatar
      Replace folly::writeTo with fmt::print · 029aff28
      Victor Zverovich authored
      Summary:
      Remove `folly::writeTo` which is untested and virtually unused, replacing
      ```
      folly::writeTo(
          stdout,
          folly::format(...));
      ```
      with
      ```
      fmt::print(...);
      ```
      for better compatibility with C++20 `std::format`.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26326405
      
      fbshipit-source-id: 598ec5d7906b2d36b20aa63f410a0c2621bc62fa
      029aff28
  9. 10 Feb, 2021 3 commits
    • Jakob lövhall's avatar
      docs/Synchronized.md spelling (#1523) · af3fd11e
      Jakob lövhall authored
      Summary:
      removed double of word 'lock'
      
      Pull Request resolved: https://github.com/facebook/folly/pull/1523
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26367154
      
      Pulled By: Orvid
      
      fbshipit-source-id: 586647d28b9ad002ee975450426d2da967dc638e
      af3fd11e
    • Shai Szulanski's avatar
      erased_unique_ptr · 49926b98
      Shai Szulanski authored
      Summary: There are lots of unnecessary uses of shared_ptr for type erasure where refcounting is not needed because it is trivial to convert to shared_ptr<void>, while it is more involved to make the equivalent unique_ptr. Adds a utility that hides the details to bring effort parity between the two pointer types.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26323443
      
      fbshipit-source-id: e33c5378f7df3105c7cb97d2622dca351b866035
      49926b98
    • Dan Melnic's avatar
      Add IoUringBackend support for openat, openat2, close, fallocate · 1e63a88c
      Dan Melnic authored
      Summary: Add IoUringBackend support for openat, openat2, close, fallocate #forcetdhashing
      
      Reviewed By: kevin-vigor
      
      Differential Revision: D26325604
      
      fbshipit-source-id: dbeea468ffbb324dc8c7afc1dbde1e451f72e06d
      1e63a88c
  10. 09 Feb, 2021 5 commits
    • Alfred Fuller's avatar
      Enable AllowAllParametersOfDeclarationOnNextLine in canary · e032bce6
      Alfred Fuller authored
      Summary:
      Making it consistent with other *OnNextLine rules.
      
      Also fixes really odd line breaks after the return type of some functions, for example:
      ```
      template <typename M>
      iterator
      insert_or_assign(const_iterator /*hint*/, key_type const& key, M&& obj) {
      ```
      becomes:
      ```
      template <typename M>
      iterator insert_or_assign(
          const_iterator /*hint*/, key_type const& key, M&& obj) {
      ```
      
      Reviewed By: yfeldblum
      
      Differential Revision: D25987579
      
      fbshipit-source-id: cc24ea3db1b256f5563fb051fbd572adfccf556a
      e032bce6
    • Xavier Deguillard's avatar
      ninja: upgrade and build from source on macOS · 89d16506
      Xavier Deguillard authored
      Summary:
      On macOS, ninja only provides prebuilt Intel binaries, not arm64 ones. Since we
      need to have a native arm64 ninja to be able to build binaries for the M1,
      let's compile it from scratch on macOS too. Compiling it takes less than 30s so
      it shouldn't add any notable cost to any builds.
      
      Reviewed By: genevievehelsel
      
      Differential Revision: D26322029
      
      fbshipit-source-id: 1bbeeac2a3f0ba07c477a2b33f8878a91ccaec0e
      89d16506
    • Shai Szulanski's avatar
      CancellationToken::merge() · 5d1f7e5f
      Shai Szulanski authored
      Summary:
      Combining CancellationTokens is a common pattern in user code, which requires the user to manage a CancellationSource and attach a callback per token to be merged:
      ```
          folly::CancellationSource source;
      
          folly::CancellationCallbacki cb1{
              std::move(token1), [&] { source.requestCancellation(); }};
          folly::CancellationCallback cb2{
              std::move(token2), [&] { source.requestCancellation(); }};
          ...
      
          co_await co_withCancellation(source.getToken(), ...);
      ```
      
      This diff adds the functionality to folly:
      ```
          co_await co_withCancellation(folly::CancellationToken::merge(token1, token2, ...), ...);
      ```
      
      This diff subclasses CancellationState for simplicity. If the extra vtable ptr is a concern, we can instead template CancellationState to combine them, but that would come with a compilation speed penalty.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26277772
      
      fbshipit-source-id: 169f65b4cf8f7f10f2800fb7797bb09379ecc239
      5d1f7e5f
    • Yedidya Feldblum's avatar
      fix folly/lang/ExceptionTest.cpp under libc++ · de428b41
      Yedidya Feldblum authored
      Summary: Fix the uncaught-exception termination message expectations in `folly/lang/ExceptionTest.cpp` under libc++.
      
      Reviewed By: markisaa
      
      Differential Revision: D26328622
      
      fbshipit-source-id: 2e2f9fce93c65556508d99d1f7b80f0971f35c0c
      de428b41
    • Dan Melnic's avatar
      Lower min capacity so the test succeeds when ulimit -l has a lower value · 94e80675
      Dan Melnic authored
      Summary: Lower min capacity so the test succeeds when ulimit -l has a lower value
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26321362
      
      fbshipit-source-id: 9d2c41fbbc190f46a6174c3f847943e13f5bea6c
      94e80675