1. 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
  2. 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
  3. 13 Mar, 2020 5 commits
  4. 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
  5. 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
  6. 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
  7. 08 Mar, 2020 2 commits
    • Yedidya Feldblum's avatar
      Cut CachelinePadded · 9489a9c1
      Yedidya Feldblum authored
      Summary: [Folly] Cut `CachelinePadded` after migrating all uses to `cacheline_aligned`.
      
      Reviewed By: aary
      
      Differential Revision: D19657696
      
      fbshipit-source-id: d2e5b4695bdc3734340723d5d3681e724734691e
      9489a9c1
    • Laurent Stacul's avatar
      Cannot build tests if Gtest not configured by CMake (#1331) · c3d09b78
      Laurent Stacul authored
      Summary:
      When Gtest cannot be discovered by CMake config file, the tests fails to compile:
      ```
      In file included from /home/docker/opensource/folly/folly/test/common/TestMain.cpp:23:
      /home/docker/opensource/folly/folly/portability/GTest.h:32:10: fatal error: gtest/gtest.h: No such file or directory
         32 | #include <gtest/gtest.h>
            |          ^~~~~~~~~~~~~~~
      ```
      This PR fixes this problem with a classic `find_package`.
      Pull Request resolved: https://github.com/facebook/folly/pull/1331
      
      Differential Revision: D20323404
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 2e41f99172c504063c00c45a9fa5c08a26bcc0c8
      c3d09b78
  8. 06 Mar, 2020 5 commits
    • Lee Howes's avatar
      Add Unsafe version of collect functions to ease migration to safe SemiFuture versions · 6f3d8f43
      Lee Howes authored
      Summary:
      Migration from Future-returning executor-erasing collectX forms to SemiFuture-returning forms, that are less risky in particular with coroutines.
      
      An earlier change added collectXSemiFuture. This diff adds collectXUnsafe as a migration path.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D20255061
      
      fbshipit-source-id: 379b5ed95aa7782aa121dba8e84cb48f802a57cd
      6f3d8f43
    • Lee Howes's avatar
      Remove unnecessary include · 9db0f005
      Lee Howes authored
      Summary: SingletonThreadLocal is not needed by Future.cpp.
      
      Reviewed By: Orvid
      
      Differential Revision: D20142400
      
      fbshipit-source-id: d0f3b7c1bbef03226c8d6264abeb96822587a465
      9db0f005
    • Oded Horovitz's avatar
      make mlock2wrapper public · 0b4e86c2
      Oded Horovitz authored
      Summary: As title. Expose the useful portable mlock2() wrapper.
      
      Reviewed By: alikhtarov
      
      Differential Revision: D20239849
      
      fbshipit-source-id: 0fa776faf29ad69e551dfbe6eb69369560800a0e
      0b4e86c2
    • Jason Meisel's avatar
      Fix Conv.cpp unary minus operator applied to unsigned type · 043bf35f
      Jason Meisel authored
      Summary: Cast from unsigned to signed *before* negating. The resulting assembly code is the same, but there's no warning.
      
      Reviewed By: yfeldblum, jdonald
      
      Differential Revision: D19588115
      
      fbshipit-source-id: d0d61ab0543211e2399f42a86a7a7a2366679d37
      043bf35f
    • Dave Rigby's avatar
      Make GFlags actually optional (#1325) · 16b3011a
      Dave Rigby authored
      Summary:
      The absence of GFlags is already partially optional -
      portability/GFlags.h defines a number of stub macros / clases if
      FOLLY_HAVE_LIBGFLAGS is false.
      
      However the top-level CMake rules don't correctly handle when GFlags
      isn't present - they unconditionally add GFlags-related variables to
      CMAKE_REQUIRED_xxx variables.
      
      Additionally there are a couple of source files which should not be
      compiled if GFlags isn't available.
      Pull Request resolved: https://github.com/facebook/folly/pull/1325
      
      Differential Revision: D20252030
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 7c3441e8b2850d68df125fb9c14b8417f4d08b55
      16b3011a
  9. 05 Mar, 2020 2 commits
  10. 04 Mar, 2020 5 commits
    • Haijun Zhu's avatar
      Explicitly destroy c++ IOBuf from cython IOBuf · 27d015c7
      Haijun Zhu authored
      Summary: This seems to not happen reliably and causes rss to grow. The `__dealloc__` cannot fix it completely, although I verified it is called. So calling it explicitly seems to guarantee it to happen.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D20206887
      
      fbshipit-source-id: 6285a8e8943a53d20714e54efd3220a545010102
      27d015c7
    • Yang Chi's avatar
      Mock recvmmsg in AsyncUDPSocket · 4e969a2d
      Yang Chi authored
      Summary: as title, just to add a mock function
      
      Reviewed By: yfeldblum, lnicco
      
      Differential Revision: D20130909
      
      fbshipit-source-id: 469d904cce93dc8e88c5dc4728b1f1fbd0baf798
      4e969a2d
    • Giuseppe Ottaviano's avatar
      Improve the documentation of Assume.h · 072c06e3
      Giuseppe Ottaviano authored
      Summary:
      We have noticed some inappropriate uses of `assume_unreachable()`, and we believe that the documentation does not convey strongly enough that it is not an assertion.
      
      This diff moves the implementation to a separate header (as the assertions in there might be misleading) and fleshes out more the intended use cases.
      
      Reviewed By: yfeldblum, mkatsevVR, luciang
      
      Differential Revision: D20182339
      
      fbshipit-source-id: 8a3be1ada06dead7ea936971c42c4f30389fc23a
      072c06e3
    • Yedidya Feldblum's avatar
      Fix small_vector::insert with non-random-access iterators · 7fbfb758
      Yedidya Feldblum authored
      Summary:
      [Folly] Fix `small_vector::insert` with non-random-access iterator arguments.
      
      Closes https://github.com/facebook/folly/issues/1322.
      
      Reviewed By: ot, terrelln
      
      Differential Revision: D20150453
      
      fbshipit-source-id: 184e748dcbb7cb60318b5f0a3104d9aeb8352d7b
      7fbfb758
    • Amlan Nayak's avatar
      Add methods to update Codel parameters · 5ead8bc2
      Amlan Nayak authored
      Summary:
      Codel is statically initialized with some default target delay and interval period. It would be useful to have the ability to update these parameters at runtime to fine tune load shedding to a given use case.
      
      Adding methods here to update the target delay and interval parameters.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D19987838
      
      fbshipit-source-id: 4d67277f38037840883f6d9d5fd2d5f9be760f44
      5ead8bc2
  11. 03 Mar, 2020 3 commits
    • Ján's avatar
      add missing #include · cbe65786
      Ján authored
      Summary: `type_traits` needed for `std::enable_if_t`
      
      Reviewed By: yfeldblum, Orvid
      
      Differential Revision: D20196749
      
      fbshipit-source-id: 4d4e44c523959dda1f04b452d65880ca3401e036
      cbe65786
    • Phil Willoughby's avatar
      make glogstyleformatter stop guessing · fcfaecbc
      Phil Willoughby authored
      Summary: Might as well store the count of newlines in the Log Message - as the field is already padded to <pointersize> bytes by the alignment requirements of the field either side it will not use any more space than the existing `bool`
      
      Reviewed By: simpkins
      
      Differential Revision: D20200298
      
      fbshipit-source-id: 84cc52898069eae1af5bd0f103d4ab3177c45206
      fcfaecbc
    • Dan Melnic's avatar
      Add support for futures folly::HighResDuration · 6c881171
      Dan Melnic authored
      Summary: Add support for futures folly::HighResDuration
      
      Reviewed By: kevin-vigor
      
      Differential Revision: D19981652
      
      fbshipit-source-id: 4a321fda487d5acdee04d138b0e4f0f10a4119f1
      6c881171