1. 19 Mar, 2020 2 commits
    • Lee Howes's avatar
      replace [[nodiscard] with FOLLY_NODISCARD · 7be4309f
      Lee Howes authored
      Summary: Correct use of portability macro.
      
      Reviewed By: yfeldblum, manderyao
      
      Differential Revision: D20520392
      
      fbshipit-source-id: b21fb13aa7a523db21a506b71e65047edbb17684
      7be4309f
    • Chad Austin's avatar
      fix unused parameter warnings · 05cf1d41
      Chad Austin authored
      Summary: Fix two small warnings when building AsyncUDPSocket on macOS.
      
      Reviewed By: fanzeyi
      
      Differential Revision: D20525411
      
      fbshipit-source-id: 39cd84364413d434d261c17c4c8a87e31ac75a42
      05cf1d41
  2. 18 Mar, 2020 8 commits
    • Dan Melnic's avatar
      Add support for creating an EventBaseManager with a custom backend factory method · 00c84e07
      Dan Melnic authored
      Summary:
      Add support for creating an EventBaseManager with a custom backend factory method
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: kevin-vigor
      
      Differential Revision: D20513736
      
      fbshipit-source-id: 62edc876cd1c0667bd7beb85a3d6fbd9a5a03ebf
      00c84e07
    • Dan Melnic's avatar
      Return 0(success) in EventBaseEvent::eb_event_base_set if we're trying to use... · 3df1b70d
      Dan Melnic authored
      Return 0(success) in EventBaseEvent::eb_event_base_set if we're trying to use a non libevent backend
      
      Summary: Return 0(success) in EventBaseEvent::eb_event_base_set if we're trying to use a non libevent backend
      
      Reviewed By: kevin-vigor
      
      Differential Revision: D20513609
      
      fbshipit-source-id: 8329c614f728a86d1bd5267652c39c8d4f54f6cd
      3df1b70d
    • Dan Melnic's avatar
      Allow the WTCallback to be used with timer managers that have timeoutExpired methods · c79a6fde
      Dan Melnic authored
      Summary: Allow the WTCallback to be used with timer managers that have timeoutExpired methods
      
      Reviewed By: kevin-vigor
      
      Differential Revision: D20503031
      
      fbshipit-source-id: df91f1e2531f5c54943d3540bdf7c3d357c9fda1
      c79a6fde
    • TJ Yin's avatar
      fix flaky unit-test CodelTest · 101ac180
      TJ Yin authored
      Summary:
      Sometimes it fails to throw exception in [Codel::setOptions](https://github.com/facebook/folly/blob/master/folly/executors/Codel.cpp#L109), since it failed the check `interval <= delay`.
      
      The reason is that both interval and delay are [POD](https://github.com/facebook/folly/blob/master/folly/executors/Codel.h#L80-L81), thus both are not initialized by default.
      
      Using them without initialization is UB. In x86, they will have random value (since x86 doesn't have trap representation), thus sometimes it passes, sometimes it fails.
      
      Based on comment, it looks like the intention is copying the `options` from default initialized `Codel`.
      
      Reviewed By: amlannayak
      
      Differential Revision: D20499449
      
      fbshipit-source-id: e12de0b42c02a8bf6379ba7fd224e0ae173945f0
      101ac180
    • Dan Melnic's avatar
      Add eb_signal_set, eb_timer_set methods to be in sync with libevent · 4aef2fa3
      Dan Melnic authored
      Summary:
      Add eb_signal_set, eb_timer_set methods to be in sync with libevent
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: kevin-vigor
      
      Differential Revision: D20513498
      
      fbshipit-source-id: be8d5d0ca362bdaa86cc161f481aea93cc757c75
      4aef2fa3
    • Lee Howes's avatar
      Current thread executor · 5c4e6238
      Lee Howes authored
      Summary: A thread-local query for the current executor. Grounding feature for logging operations.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D20070133
      
      fbshipit-source-id: e320d2a3d97744b91c07a6060708e5cefc517cb7
      5c4e6238
    • Maged Michael's avatar
      RequestContext: Use hazard pointer-based implementation by default · 8a3363fa
      Maged Michael authored
      Summary: Make the hazard pointer-based implementation of request context the default one by setting `folly_reqctx_use_hazptr` to true by default.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D19145252
      
      fbshipit-source-id: 5dd68fb92561685a6ee35d8b3b03a1dcf7e1e356
      8a3363fa
    • Dmytro Stechenko's avatar
      fix duplicated symbols for dynamic::TypeInfo members · 2ca4c388
      Dmytro Stechenko authored
      Summary:
      while compiling on windows see duplicated symbols:
      ```
      lld-link: error: duplicate symbol:
      public: static char const *const folly::dynamic::TypeInfo<
      class std::basic_string<char, struct std::char_traits<char>,
      class std::allocator<char>>>::name
      in buck-out\dev\gen\crypto\cat\cpp\tests\crypto_auth_token_util_test#compile-CryptoAuthTokenUtilTest.cpp.obj1f5bc0bc,windows-x86_64\out.obj
      and in libdynamic.lib(out.obj)
      ```
      
      Reviewed By: yfeldblum
      
      Differential Revision: D20426321
      
      fbshipit-source-id: 4e0346c624ad12561adb14f3a2e5f6e15bbbba26
      2ca4c388
  3. 17 Mar, 2020 4 commits
    • Brian Gesiak's avatar
      Remove workaround for co_return with uniform initializer · c761da7b
      Brian Gesiak authored
      Summary:
      This workaround is no longer necessary for a Clang that includes
      patch https://reviews.llvm.org/D76118.
      
      Reviewed By: ispeters, lewissbaker
      
      Differential Revision: D20486353
      
      fbshipit-source-id: cab137ed557ba8aa6ec86ec7011cc4fc7c46fe82
      c761da7b
    • Dmytro Stechenko's avatar
      fix -Wsign-compare in hazptr · 21dc1d37
      Dmytro Stechenko authored
      Summary:
      building on windows fails:
      ```
      buck-out/cells/fbsource/gen/xplat/third-party/glog/glogWindows#header-mode-symlink-tree-only,headers\glog/logging.h:698:32:
      error: comparison of integers of different signs: 'const unsigned long long' and 'const int' [-Werror,-Wsign-compare]
      
      buck-out/dev/gen/folly/synchronization/hazptr#header-mode-symlink-tree-only,headers\folly/synchronization/HazptrObj.h:397:13:
      note: in instantiation of function template specialization 'google::Check_EQImpl<unsigned long long, int>' requested here
                  DCHECK_EQ(reinterpret_cast<uintptr_t>(p) & 7, 0) << p << " " << i;
      ```
      
      Reviewed By: yfeldblum
      
      Differential Revision: D20482798
      
      fbshipit-source-id: 4b661121401890cec113905fc6b53cd9189fcca0
      21dc1d37
    • Luca Niccolini's avatar
      VERSION_ID in /etc/os-release is not mandatory · 1e93e64f
      Luca Niccolini authored
      Summary:
      e.g. debian doesn't seem to have it
      ```
      $ cat /etc/os-release
      PRETTY_NAME="Debian GNU/Linux bullseye/sid"
      NAME="Debian GNU/Linux"
      ID=debian
      HOME_URL="https://www.debian.org/"
      SUPPORT_URL="https://www.debian.org/support"
      BUG_REPORT_URL="https://bugs.debian.org/"
      ```
      
      Reviewed By: mjoras
      
      Differential Revision: D20483097
      
      fbshipit-source-id: 722397ff994336884ed2e5bbf8fe517d4dcf4e6c
      1e93e64f
    • David Carlier's avatar
      FreeBSD and/or clang build fix. (#1317) · 72f1c293
      David Carlier authored
      Summary:
      clang being more strict with obsolete C++14 api, has
      completely disabled them in this context.
      Pull Request resolved: https://github.com/facebook/folly/pull/1317
      
      Reviewed By: luciang, markisaa
      
      Differential Revision: D20154780
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 1ff36fecd3406802c3f393dfdd5dbe2f30656567
      72f1c293
  4. 16 Mar, 2020 3 commits
    • Lee Howes's avatar
      Fix retrying to correctly deal with a SemiFuture-returning policy · db0e476d
      Lee Howes authored
      Summary: Retrying was modified to support SemiFuture returning policy and function, but incorrectly handled the return type propagation. Fix the problem and add a test to verify.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D20462982
      
      fbshipit-source-id: 97b4dad6d83dbbfe7f1846b457bf915c14b9f31a
      db0e476d
    • Jeff McGlynn's avatar
      Fix build errors with -Wvla on Mac/iOS · 3697fb05
      Jeff McGlynn authored
      Summary:
      Conv.h's detail::digitsEnough was not decomposing to a constexpr on iOS/Mac toolchains, which resulted in the following call becoming a runtime VLA:
      
      ```
      char buffer[detail::digitsEnough<unsigned __int128>() + 1];
      ```
      
      Update to use `numeric_limits<>::digits10`, which allows this function to evaluate at compile-time on iOS/Mac.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D20440659
      
      fbshipit-source-id: d086e367eec0d3b2f35465525cb7406e746e6df7
      3697fb05
    • Yedidya Feldblum's avatar
      Unqualify uses of folly::AsyncUDPSocket::ReadCallback::OnDataAvailableParams · 0dd89890
      Yedidya Feldblum authored
      Summary: Unqualify nearly all uses of `folly::AsyncUDPSocket::ReadCallback::OnDataAvailableParams` since nearly all uses already have `OnDataAvailableParams` in scope.
      
      Differential Revision: D20450063
      
      fbshipit-source-id: c0fd49a7eace44a6edc8086762c44753224788dd
      0dd89890
  5. 15 Mar, 2020 3 commits
    • Pádraig Brady's avatar
      folly: fix clash with std::reduce with libgcc >= 9.3.0 · 13655b8a
      Pádraig Brady authored
      Summary:
      This code is new in 9.3.0, introduced upstream with:
      https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=ed920373
      Unless we qualify folly::reduce() we get the clash
      in P127472223 when running the test plan.
      
      Reviewed By: meyering
      
      Differential Revision: D20461173
      
      fbshipit-source-id: 41b21e9215571da2cbd2ef7f817e2d9999083033
      13655b8a
    • Yedidya Feldblum's avatar
      FOLLY_SSSE · d9407ff2
      Yedidya Feldblum authored
      Summary: [Folly] `FOLLY_SSSE`, for testing compiler mode support for SSSE3 intrinsics.
      
      Reviewed By: markisaa
      
      Differential Revision: D20414435
      
      fbshipit-source-id: 077a78f880ea8dce44f1aced38a6cca08cdd1f65
      d9407ff2
    • Yedidya Feldblum's avatar
      Move remove_reference_wrapper to coro traits · f08234c4
      Yedidya Feldblum authored
      Summary: [Folly] Move remove_reference_wrapper to coro traits, since this is not a language-level trait and is there to be used in the coro library.
      
      Reviewed By: iahs
      
      Differential Revision: D20301017
      
      fbshipit-source-id: aa78488cc5138e6ade9dcbc99ec1b75b65c74c78
      f08234c4
  6. 14 Mar, 2020 3 commits
    • Daryl Johnas Sison's avatar
      Revert D20443631: Fix compilation errors for C++20 · 30f1c257
      Daryl Johnas Sison authored
      Differential Revision:
      D20443631
      
      Original commit changeset: 03e8210a64a3
      
      fbshipit-source-id: 42621768beab530619aba877015dd48d509bc62b
      30f1c257
    • Scott Ramsby's avatar
      Fix mode_t to match Linux and be overridable (#1335) · f84ad364
      Scott Ramsby authored
      Summary:
      `unsigned int` is a more typical definition of the mode_t type on Linux systems, which is what this is trying to emulate.
      
      Also guard by checking that HAVE_MODE_T isn't already define to allow clients to suppress its definition in cases where other client-used libraries (e.g. wxWindows) have their own definition which may conflict.
      Pull Request resolved: https://github.com/facebook/folly/pull/1335
      
      Reviewed By: yfeldblum
      
      Differential Revision: D20408879
      
      Pulled By: scramsby
      
      fbshipit-source-id: 511484f6513501bf595ccb9cdfb893c9d5761320
      f84ad364
    • Laurent Stacul's avatar
      Fix compilation errors for C++20 (#1329) · dacd7bf0
      Laurent Stacul authored
      Summary:
      Compiling with gcc 10.0.1 and -std=gnu++2a, we have the following errors:
      ```
      folly/FBString.h:1013:33: error: no type named 'reference' in 'class std::allocator<char>'
       1013 |   typedef typename A::reference reference;
            |                                 ^~~~~~~~~
      folly/FBString.h:1014:39: error: no type named 'const_reference' in 'class std::allocator<char>'
       1014 |   typedef typename A::const_reference const_reference;
      ```
      This is due to the fact many members in `std::allocator` have been remove in C++20: https://en.cppreference.com/w/cpp/memory/allocator
      
      We also have this one due to the new way C++ resolves the comparison operators:
      ```
      folly/dynamic-inl.h:854:20: error: ambiguous overload for 'operator!=' (operand types are 'folly::dynamic::const_item_iterator' and 'folly::dynamic::const_item_iterator')
        854 |   return find(key) != items().end() ? 1u : 0u;
            |          ~~~~~~~~~ ^~ ~~~~~~~~~~~~~
            |              |                   |
            |              |                   folly::dynamic::const_item_iterator
            |              folly::dynamic::const_item_iterator
      In file included from folly/dynamic-inl.h:25,
                       from folly/dynamic.h:796,
                       from folly/dynamic.cpp:17:
      folly/detail/Iterators.h:80:8: note: candidate: 'bool folly::detail::IteratorFacade<D, V, Tag>::operator==(const D&) const [with D = folly::dynamic::const_item_iterator; V = const std::pair<const folly::dynamic, folly::dynamic>; Tag = std::f
      orward_iterator_tag]' (reversed)
         80 |   bool operator==(D const& rhs) const {
            |        ^~~~~~~~
      folly/detail/Iterators.h:98:3: note: candidate: 'typename std::enable_if<std::is_convertible<D, D2>::value, bool>::type folly::detail::IteratorFacade<D, V, Tag>::operator==(const D2&) const [with D2 = folly::dynamic::const_item_iterator; D =
       folly::dynamic::const_item_iterator; V = const std::pair<const folly::dynamic, folly::dynamic>; Tag = std::forward_iterator_tag; typename std::enable_if<std::is_convertible<D, D2>::value, bool>::type = bool]' (reversed)
         98 |   operator==(D2 const& rhs) const {
            |   ^~~~~~~~
      folly/detail/Iterators.h:84:8: note: candidate: 'bool folly::detail::IteratorFacade<D, V, Tag>::operator!=(const D&) const [with D = folly::dynamic::const_item_iterator; V = const std::pair<const folly::dynamic, folly::dynamic>; Tag = std::f
      orward_iterator_tag]'
         84 |   bool operator!=(D const& rhs) const {
            |        ^~~~~~~~
      folly/detail/Iterators.h:103:8: note: candidate: 'bool folly::detail::IteratorFacade<D, V, Tag>::operator!=(const D2&) const [with D2 = folly::dynamic::const_item_iterator; D = folly::dynamic::const_item_iterator; V = const std::pair<const f
      olly::dynamic, folly::dynamic>; Tag = std::forward_iterator_tag]'
        103 |   bool operator!=(D2 const& rhs) const {
            |        ^~~~~~~~
      ```
      Pull Request resolved: https://github.com/facebook/folly/pull/1329
      
      Reviewed By: ot, igorsugak
      
      Differential Revision: D20443631
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 03e8210a64a3eeaefb6f14afaddf45be882e3ba6
      dacd7bf0
  7. 13 Mar, 2020 5 commits
  8. 12 Mar, 2020 6 commits
    • Victor Zverovich's avatar
      Move toStdString to FBString.h · c80c8e6c
      Victor Zverovich authored
      Summary: Move `toStdString` to `FBString.h` because it's fbstring-related and remove the dependency between `String.h` and `FBString.h`. This is possible because the only other use of fbstring in `String.h` is removed in previous diff.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D20195591
      
      fbshipit-source-id: b5ff7c918669e063e24bf91155a2496f82d7e975
      c80c8e6c
    • Dan Melnic's avatar
      Add ThreadWheelTimekeeperHighRes class · e5ccead7
      Dan Melnic authored
      Summary: Add ThreadWheelTimekeeperHighRes class
      
      Reviewed By: LeeHowes
      
      Differential Revision: D20355093
      
      fbshipit-source-id: b76563a3706d7732b490a88096fed484954820e5
      e5ccead7
    • Mohamad Gebai's avatar
      Remove CachelinePaddedTest.cpp from CMakeLists after deletion in d2e5b469 · 543fef62
      Mohamad Gebai authored
      Summary: It looks like that test file was deleted, but it was still referenced in a CMakeLists.txt file.
      
      Reviewed By: yfeldblum, Gownta
      
      Differential Revision: D20365343
      
      fbshipit-source-id: 40792bb9c526e1aef48062b0e560646bdcf201b8
      543fef62
    • Maged Michael's avatar
      io/async: Add support for RequestData::onClear() callback function · 5fa6ff45
      Maged Michael authored
      Summary:
      Add support for onClear() callback function to RequestData. The callback is to be executed on the last clearing of RequestData. This typically happens upon the destruction of the last RequestContext that contains the RequestData or due to explicit calls to RequestContext::clearContextData that remove the RequestData from the RequestContext.
      
      The onClear() callback is executed exactly once. If there are no calls to clearContextData, then onClear is executed upon the destruction of the last RequestContext that refers to the RequestData. If there are calls to clearContextData, then onClear is executed upon the removal of the last reference to the RequestData from a RequestContext.
      
      RequestData::hasCallback() applies only to onSet() and onUnset() which may be called multiple times, whereas onClear() is called exactly once.
      
      If a class derived from RequestData overrides onClear and either or both of onSet and onUnset, then care must be taken that the callbacks are mutually safe, as it is possible for the execution of onClear to be concurrent with executions of onSet and onUnset.
      
      Motivation: Some uses of RequestContext::clearContextData expect the immediate destruction of associated RequestData. The hazard pointer-based implementation of RequestContext guarantees only that all associated RequestData is destroyed before the completion of the destructor of the RequestContext. This callback provides users of RequestContext more control of the timing of executing actions related to clearing the data. The addition of this capability is intended to provide a tool to eliminate differences in timing of executing actions between the two implementations of RequestContext (hazard pointer-based vs. read lock-based).
      
      Also, fixes a minor bug in request_context_test, where the key "test2" was used in two tests (setIfAbsentTest and deadlockTest) without being cleared, which generated a warning when the tests were run in the same process.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D20332008
      
      fbshipit-source-id: c9cefffb28c8da098e97f851f31d29a1bf704061
      5fa6ff45
    • Yixian Jiang's avatar
      clean sigar build dependency · fbb0c170
      Yixian Jiang authored
      Summary:
      Clean the sigar build dependency completely under:
      - fbcode/fbzmq/public_tld/build/...
      - fbcode/openr/public_tld/build/...
      
      Delete files:
      - fbcode/opensource/fbcode_builder/manifests/sigar
      - fbcode/opensource/fbcode_builder/specs/sigar.py
      
      Reviewed By: steven1327
      
      Differential Revision: D20376067
      
      fbshipit-source-id: 3321a14df2551525acee605028ef06a04cda7c6a
      fbb0c170
    • Alex Guzman's avatar
      Adjust PasswordCollector.describe() to return a const ref · 6794edc6
      Alex Guzman authored
      Summary: This is mainly used for logging, and we can elide an unnecessary copy in some cases.
      
      Reviewed By: mingtaoy
      
      Differential Revision: D20402430
      
      fbshipit-source-id: 79b73792a69cf2817ffb88b07d9973139c3c67bb
      6794edc6
  9. 11 Mar, 2020 2 commits
    • Dan Melnic's avatar
      Split WTCallback code · f4c6d8e6
      Dan Melnic authored
      Summary: Split WTCallback cod
      
      Reviewed By: LeeHowes
      
      Differential Revision: D20355082
      
      fbshipit-source-id: 9ead4905cafeef27a9e2956fc50ebd59098cb80e
      f4c6d8e6
    • Dan Melnic's avatar
      Use decltype(event::ev_fd) instead of #ifdef · 8df984dc
      Dan Melnic authored
      Summary:
      Use decltype(event::ev_fd) instead of #ifdef
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: yfeldblum, kevin-vigor
      
      Differential Revision: D18525100
      
      fbshipit-source-id: 7cef32def7b40c71b2298f9dc354fbe63607fb8e
      8df984dc
  10. 10 Mar, 2020 4 commits
    • Laurent Stacul's avatar
      Allow folly to build on systems not having the config-fmt.cmake (#1328) · b5ef0bf9
      Laurent Stacul authored
      Summary:
      As written in the documentation, {fmt} should be built alongside folly. This is not possible in my case. My usecase is to provide some kind of small distribution of shared libraries that can be installed on any systems. Hence I really need to have libfmt treated as a normal shared lib.
      
      Moreover, libfmt can be consumed on our side as a normal library outside on cmake. We do not provide the cmake config file which are strongly dependent on the system on which libfmt is installed.
      
      My proposal is to first look for the fmt-config.cmake as it is now but in case of cmake support is not provided by system, we fall back to a normal library lookup.
      Pull Request resolved: https://github.com/facebook/folly/pull/1328
      
      Reviewed By: simpkins
      
      Differential Revision: D20312046
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 2d6b4917b37a8ed1d553600599702259db22c212
      b5ef0bf9
    • Dmytro Stechenko's avatar
      Mark folly/portability/PThread.h dep on boost as normal · 2501c25a
      Dmytro Stechenko authored
      Reviewed By: Orvid
      
      Differential Revision: D20353603
      
      fbshipit-source-id: 1910261be637237923b1f1d6a56fc954554176d2
      2501c25a
    • Victor Zverovich's avatar
      Make errnoStr return std::string instead of fbstring · 0d908464
      Victor Zverovich authored
      Summary:
      The result of `errnoStr` is often converted to `std::string` so returning `fbstring` adds an extra copy. Make it return `std::string` instead. This will also allow removing dependency between `String.h` and `FBString.h`.
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: yfeldblum
      
      Differential Revision: D20195395
      
      fbshipit-source-id: 0dc65f1566911156be3fcb715dd105c58f2a8822
      0d908464
    • Wez Furlong's avatar
      getdeps: use c:/open/scratch if available on windows · 8d276922
      Wez Furlong authored
      Summary:
      Ideally we'd be using mkscratch, but this still isn't shipped
      to our Windows systems.
      
      Pick a path that is more friendly to our corp windows environment by default.
      
      Reviewed By: pkaush
      
      Differential Revision: D20342277
      
      fbshipit-source-id: c85bccee6701adc03b26c92ba217b18bd684257a
      8d276922