1. 11 Aug, 2018 7 commits
    • Yedidya Feldblum's avatar
      Replace FOLLY_HAVE_MALLOC_H with __has_include · d849ddfd
      Yedidya Feldblum authored
      Summary:
      [Folly] Replace `FOLLY_HAVE_MALLOC_H` with `__has_include`.
      
      Now that folly only targets which support `__has_include`.
      
      Reviewed By: Orvid
      
      Differential Revision: D9281875
      
      fbshipit-source-id: eb895f3e034e4a4d3c9eb34fb73d47893e59f5ef
      d849ddfd
    • Yedidya Feldblum's avatar
      Replace FOLLY_HAVE_LIBDWARF_DWARF_H with __has_include · ba837af1
      Yedidya Feldblum authored
      Summary:
      [Folly] Replace `FOLLY_HAVE_LIBDWARF_DWARF_H` with `__has_include`.
      
      Now that folly only targets which support `__has_include`.
      
      Reviewed By: Orvid
      
      Differential Revision: D9281453
      
      fbshipit-source-id: f416a6e4eb25ec31f86c705b7e9aafb1064e876a
      ba837af1
    • Yedidya Feldblum's avatar
      Replace FOLLY_HAVE_BITS_CXXCONFIG_H with __has_include · 877030c7
      Yedidya Feldblum authored
      Summary:
      [Folly] Replace `FOLLY_HAVE_BITS_CXXCONFIG_H` with `__has_include`.
      
      Now that folly only targets which support `__has_include`.
      
      Reviewed By: Orvid
      
      Differential Revision: D9280942
      
      fbshipit-source-id: cd843b4e903b2c96d3a40611f2274572b8b0600a
      877030c7
    • Yedidya Feldblum's avatar
      Replace FOLLY_HAVE_LINUX_MEMBARRIER_H with __has_include · 6fdfb75a
      Yedidya Feldblum authored
      Summary:
      [Folly] Replace `FOLLY_HAVE_LINUX_MEMBARRIER_H` with `__has_include`.
      
      Now that folly only targets which support `__has_include`.
      
      Reviewed By: Orvid
      
      Differential Revision: D9279852
      
      fbshipit-source-id: 94c446a2d6e2662d32a7899ab470679da6da8e0e
      6fdfb75a
    • Victor Zverovich's avatar
      Fix various includes and dependencies · b7a40a73
      Victor Zverovich authored
      Summary:
      This fixes various include and dependency issues found when building
      `folly/compression/test/facebook:compression_fuzz_test.so` with modules.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9271280
      
      fbshipit-source-id: e0ae46c2a6d95c8f4d0a66e3dc20e1d045ffc6a4
      b7a40a73
    • Matthieu Martin's avatar
      RequestContext: revert to F14FastMap · 8bb021de
      Matthieu Martin authored
      Summary: This reverts my previous change "RequestContext: replace F14FastMap by std::unordred_map"
      
      Reviewed By: ot
      
      Differential Revision: D9280469
      
      fbshipit-source-id: ad3f4d5f520e88ab0e0fab0506d87bab2cd10d41
      8bb021de
    • Yedidya Feldblum's avatar
      Epochs for BufferedRandomDevice · bfdd04bb
      Yedidya Feldblum authored
      Summary:
      [Folly] Epochs for `BufferedRandomDevice`.
      
      To maintain the security property that the thread-local object is reset after fork in the child process, but in an async-signal-safe way.
      
      This approach has the downside that it makes the fast path larger by 3 instruction (`mov`, `cmp`, `jne`).
      
      Reviewed By: djwatson, ot
      
      Differential Revision: D9256536
      
      fbshipit-source-id: dc34e1aeb75e1009610d47fe4ef7030a4a0e2a90
      bfdd04bb
  2. 10 Aug, 2018 11 commits
    • Yin Qiu's avatar
      Suppress class-memaccess warning with gcc 8.2 (#907) · c8be4cb5
      Yin Qiu authored
      Summary:
      The following code won't compile with g++ 8.2 when `-Wall -Werror` is turned on (`-Werror=class-memaccess` implied):
      
          std::memcpy(dst, src, n * sizeof(Value))
      
      where in `VectorContainerPolicy`'s case, `Value` is typically an `std::pair`, which  indeed has no trivial copy-assignment.
      Pull Request resolved: https://github.com/facebook/folly/pull/907
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9244951
      
      Pulled By: Orvid
      
      fbshipit-source-id: 26787d43dab7d4212c5975a509dfd8703b0a157c
      c8be4cb5
    • Lee Howes's avatar
      Use rvalue overload of Future::then in retrying · 99ad09f9
      Lee Howes authored
      Summary:
      Overall plan to modify Future<T>::then to be r-value qualified and use Future<T>::thenTry or Future<T>::thenValue.
      
      The goal is to disambiguate folly::Future and to improve type and lifetime safety of Future and its methods.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9273440
      
      fbshipit-source-id: f1e1b91fd8fe02020a5919b9193644e256413982
      99ad09f9
    • Yedidya Feldblum's avatar
      Cut FOLLY_HAS_INCLUDE · 9a1abfca
      Yedidya Feldblum authored
      Summary:
      [Folly] Cut `FOLLY_HAS_INCLUDE` now that all supported platforms have it.
      
      MSVC2015 and gcc4.9.1 don't support it, but folly no longer targets them.
      
      Reviewed By: simpkins, Orvid
      
      Differential Revision: D9262258
      
      fbshipit-source-id: e518492acd7c11374ab971b26adb642bce7b19c3
      9a1abfca
    • Victor Zverovich's avatar
      Fix various includes/deps for modules · 1243c576
      Victor Zverovich authored
      Summary: Fix various dependency issues in folly for modular build.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9246772
      
      fbshipit-source-id: 32afa48db3222b906077376c54e1301c8366d97d
      1243c576
    • Ajanthan Asogamoorthy's avatar
      Move Password in file from wangle to folly · da6cd553
      Ajanthan Asogamoorthy authored
      Summary: Move Password in file from wangle to folly
      
      Reviewed By: ngoyal, yfeldblum
      
      Differential Revision: D9192652
      
      fbshipit-source-id: b883ddaf2d815b37677d9c5e924b3dd06aa0ec6b
      da6cd553
    • Victor Zverovich's avatar
      Move HAZPTR_DEBUG macro definition to target · f43a71ac
      Victor Zverovich authored
      Summary:
      Move the definition of `HAZPTR_DEBUG` from code to the target to fix modular
      build. This is needed because `HAZPTR_DEBUG` is effectively a configuration
      macro affecting the API.
      
      Reviewed By: magedm
      
      Differential Revision: D9256127
      
      fbshipit-source-id: 44deb0e915373ea88206098544b03fa335b31a22
      f43a71ac
    • Nathan Bronson's avatar
      force link failure when compilation flags don't match · b436f54d
      Nathan Bronson authored
      Summary:
      F14 varies its inline code according to the flags passed to the
      compiler. This can cause problems if libraries override compilation flags
      on their own, since it won't be safe to exchange F14 instances between
      compilation domains.  This diff introduces a template specialization
      that varies according to the intrinsics mode and that has only a single
      definition (in F14Table.cpp).  The member is called on a couple of cold
      paths (exception handling for copy construction and rehash).  This makes
      it very likely that a compilation unit that uses F14 and is compiled
      with different compiler flags than F14Table.cpp will get a linker error.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9200315
      
      fbshipit-source-id: 9cbca18eef0ddd6efcf6d9d6057eda2400f8653c
      b436f54d
    • Andrew Gallagher's avatar
      folly: update krb5 include · 54a91c4f
      Andrew Gallagher authored
      Summary:
      As indicated at https://github.com/krb5/krb5/blob/master/src/include/krb5.h,
      this header is deprecated, so update to use the new location (and fix lint).
      
      Reviewed By: luciang
      
      Differential Revision: D9259770
      
      fbshipit-source-id: 6832206b8c890184f5d3369b0305048ae9c377d9
      54a91c4f
    • Tingzhe Zhou's avatar
      Change file name and add benchmark · e2d713fc
      Tingzhe Zhou authored
      Summary:
      Make the file name consistent with its class name
      Add benchmark code
      Attach performance data
      
      Reviewed By: magedm
      
      Differential Revision: D9250954
      
      fbshipit-source-id: b9f9b90cb83ca319d91fe65667d0072511be5e26
      e2d713fc
    • Adam Simpkins's avatar
      cmake: generate and install a libfolly.pc file for pkg-config · c2e51a8e
      Adam Simpkins authored
      Summary:
      Update the CMake build files to install a libfolly.pc file so downstream
      projects can use pkg-config to more easily depend on folly.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9213429
      
      fbshipit-source-id: 849c0fce01d4903d3f8a7b6d196037bf950e5921
      c2e51a8e
    • Adam Simpkins's avatar
      fbcode_builder: drop support for Ubuntu 14.04 and Debian 8.6 · 3cb0b1f1
      Adam Simpkins authored
      Summary:
      folly, and therefore most of our other open source projects, no longer support
      gcc-4.9.  Drop Ubuntu 14.04 and Debian 8.6 from our CI platforms list, since
      the these images only support gcc 4.9.
      
      We should ideally add support for Ubuntu 18.04 soon, but I'll leave that for a
      later diff.  Removing the older platforms is somewhat higher priority for now
      to get our Travis CI builds green again.
      
      Reviewed By: snarkmaster
      
      Differential Revision: D9258797
      
      fbshipit-source-id: 3cab47a6c51b2dbe63214034240f844c85963c3d
      3cb0b1f1
  3. 09 Aug, 2018 15 commits
    • Dave Watson's avatar
      Fix RandomFork test · 84ca5428
      Dave Watson authored
      Summary:
      Fork test tries to test that we don't reuse the SecureRandom buffer on fork, but it only tests one byte.
      
      This gives us probability one in 256*256 (or something like that) that we spuriously fail.
      
      Check the whole buffer instead before failing.
      
      Reviewed By: fredemmott
      
      Differential Revision: D9242788
      
      fbshipit-source-id: b9fb809518797c439d7fe16084a04f9964a1f597
      84ca5428
    • Adam Simpkins's avatar
      cmake: remove reference to deleted ElfUtil.cpp file · 0761e428
      Adam Simpkins authored
      Summary:
      experimental/symbolizer/ElfUtil.cpp was deleted in D9218592 so it no longer
      needs to be explicitly excluded in CMakeLists.txt
      
      Reviewed By: Orvid, calebmarchent
      
      Differential Revision: D9229945
      
      fbshipit-source-id: 7d708b265573e70e4e6de88edefa2fa5b41af200
      0761e428
    • Adam Simpkins's avatar
      cmake: remove the separate folly_symbolizer library target · bbea1798
      Adam Simpkins authored
      Summary:
      The code in folly/experimental/symbolizer/* is already included in the main
      libfolly library if it is supported by the build configuration.  Remove the
      separate libfolly_symbolizer target added in D9216312 that includes a second
      copy of these objects.
      
      This change effectively reverts D9216312.
      
      Reviewed By: Orvid, calebmarchent
      
      Differential Revision: D9229946
      
      fbshipit-source-id: d8e6874eeab8c9c1aa519441bd29ae107aef03ac
      bbea1798
    • Orvid King's avatar
      Adjust the constexpr strlen implementation to handle up to 4kb strings · 88ab460c
      Orvid King authored
      Summary:
      Previously it was only capable of handling 512 byte strings under MSVC due to the constexpr recursion depth limit being 512 by default under MSVC.
      In the future once we have C++14 constexpr everywhere, this should just be a for loop, which should remove the limit.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9230717
      
      fbshipit-source-id: 88bcf0ef94b200301eb41392482e910b2e8de008
      88ab460c
    • Lee Howes's avatar
      Add deprecation of l-value form of Future<T>::then() · 3795f900
      Lee Howes authored
      Summary:
      Separates l-value and r-value versions of parameterless then.
      
      Deprecates l-value version.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9222345
      
      fbshipit-source-id: 3dd95b3e35bf1b06d426334c30150b049a5e0b70
      3795f900
    • Mikhail Karasikov's avatar
      throw std::bad_alloc if memory can't be allocated (#888) · e34ba846
      Mikhail Karasikov authored
      Summary:
      Bug fix: call `reserve()` trying to allocate more memory than available
      Pull Request resolved: https://github.com/facebook/folly/pull/888
      
      Reviewed By: ot
      
      Differential Revision: D9234444
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 4d12236aee745ad663d95a370d273f619f92b1bd
      e34ba846
    • Adam Simpkins's avatar
      RequestContext: fix segfaults in the tests · c4fca6d0
      Adam Simpkins authored
      Summary:
      Update all of the RequestContext tests to use a test fixture that helps ensure
      they all start from a consistent state.
      
      Otherwise tests can end up running with RequestContxt settings left over from
      previous test functions, which can affect their results.
      
      In particular, several tests leave behind data for the "test" key.  This
      causes subsequent calls to `setContextData()` to not actually set new data for
      this key, but to instead reset its value to null.  This would cause many tests
      to segfault since they did not check if `getContextData()` returned null
      before dereferencing the result.
      
      Reviewed By: yfeldblum, A5he
      
      Differential Revision: D9233617
      
      fbshipit-source-id: ce7a7c738592305f01b16fec7796505ea192ede4
      c4fca6d0
    • Adam Simpkins's avatar
      cmake: fix issues in the FindGMock module · 7d4c2a9b
      Adam Simpkins authored
      Summary:
      - Fix the variable name passed to FIND_PACKAGE_HANDLE_STANDARD_ARGS() so that
        it matches the module name (`FindGMock.cmake`).  This makes sure that the
        failure is detected correctly if GMock is not found.
      - googletest depends on pthreads, so use `find_package(Threads)` and add
        `Threads::Threads` to the list of required library dependencies.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9212536
      
      fbshipit-source-id: eae6220a2dbfe777bff1ac0ee0fb4df53de16955
      7d4c2a9b
    • Adam Simpkins's avatar
      cmake: use the built-in FindThreads module · f09065c9
      Adam Simpkins authored
      Summary:
      Use CMake's built-in FindThreads module rather than having our own custom
      FindPThread.cmake module.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9212535
      
      fbshipit-source-id: 9a652c510cb310c18547d31bd8215dedd8532a4c
      f09065c9
    • Adam Simpkins's avatar
      cmake: fix detection of dwarf.h · 48d6f314
      Adam Simpkins authored
      Summary:
      Ubuntu 18.04 (and presumably other Debian-based distributions) install
      dwarf.h at /usr/include/libdwarf/dwarf.h.  However other platforms like Mac
      typically install dwarf.h directly inside include/ without a libdwarf
      subdirectory.
      
      Commit e66fb34c previously changed the code to look only for "dwarf.h" to
      support Homebrew installations of dwarfutils on Mac, but accidentally broke
      finding dwarf.h on Ubuntu in the process.  This change should hopefully work
      on both platforms.
      
      Fixes: #905
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9212428
      
      fbshipit-source-id: a4520a47718a2da25e597ac7350344931ba21634
      48d6f314
    • Yedidya Feldblum's avatar
      Import Policy members into F14Table · 4fcdaf5c
      Yedidya Feldblum authored
      Summary: [Folly] Import `Policy` members into `F14Table` to deduplicate repeated uses of `Policy::`.
      
      Reviewed By: shixiao
      
      Differential Revision: D9176546
      
      fbshipit-source-id: bbd32a17cca7d38b3e5d55c1840353821f4e2ddc
      4fcdaf5c
    • Dan Melnic's avatar
      Add thread cached ints benchmark · dd624c5e
      Dan Melnic authored
      Summary: Add thread cached ints benchmark
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9212949
      
      fbshipit-source-id: 552aab15e7421f74b5cec3ce4abd211ab3141153
      dd624c5e
    • Eric Niebler's avatar
      don't slice std:: exceptions in exception_wrapper::handle when no handler is found · 1d883868
      Eric Niebler authored
      Summary:
      Given an exception_wrapper `ew` holding a `std::runtime_error`, the following assertion fails:
      
      ```
      try {
        ew.handle();
      } catch( std::runtime_error const & ) {
      } catch( std::exception const & ) {
        assert(false);
      }
      ```
      
      Reviewed By: simpkins
      
      Differential Revision: D9199924
      
      fbshipit-source-id: b6f90ccf269a1b58f0dd07723451ff34cde1d529
      1d883868
    • Victor Zverovich's avatar
      Fix building of folly/compression with modules · be5070bf
      Victor Zverovich authored
      Summary: Move the definition of the `ZSTD_STATIC_LINKING_ONLY` and `ZDICT_STATIC_LINKING_ONLY` macros from code to the target to fix the modular build. It is needed because these macros affect the public API of `zstd.h`.
      
      Reviewed By: terrelln
      
      Differential Revision: D9189720
      
      fbshipit-source-id: efacc1456803900fd65159a43cf1fba2daf15673
      be5070bf
    • Fred Emmott's avatar
      Flush secureRandom buffer on fork · 8e927ee4
      Fred Emmott authored
      Summary: On fork, flush the secureRandom buffer, so that we don't share entropy between the parent and child.
      
      Reviewed By: ricklavoie
      
      Differential Revision: D9196474
      
      fbshipit-source-id: 12ff8488d814466186df61328a5f1d4000beb27f
      8e927ee4
  4. 08 Aug, 2018 7 commits
    • Aaryaman Sagar's avatar
      Print benchmark results as they complete · 173b48d4
      Aaryaman Sagar authored
      Summary:
      Print benchmark results as and when they complete instead of outputting the
      whole thing once at the end
      
      Reviewed By: djwatson, ot
      
      Differential Revision: D9177038
      
      fbshipit-source-id: 54898b303771f214c21163cd87b11f8e2083cdf4
      173b48d4
    • Sven Over's avatar
      fix `folly::via` for callables returning SemiFuture · ab24ce0c
      Sven Over authored
      Summary:
      When passing a callable to `folly::via` that returns a SemiFuture,
      via should return a Future. The implementation does the correct thing
      but the declaration's return type is not correct. This diff fixes that.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9219041
      
      fbshipit-source-id: e61544231e7846c713ff43394c3bf5d1aae18233
      ab24ce0c
    • Lee Howes's avatar
      Fix for lifetime bug in retrying. · 1d3ee8c5
      Lee Howes authored
      Summary: Late change in D9175807 removed necessary temporaries. This caused a lifetime management problem for GCC.
      
      Reviewed By: Orvid
      
      Differential Revision: D9227937
      
      fbshipit-source-id: d5fea8a98855c6302189a7dee8cd5862d13a63a3
      1d3ee8c5
    • Marshall Cline's avatar
      Perf improvement of folly::Future's map() · 7ef79a5f
      Marshall Cline authored
      Summary: folly::Future's map() functions create a std::vector<Future<...>>, then use push_back to populate that vector. This could result in reallocations. Avoid that by reserving proper space ahead of the push_backs.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9204713
      
      fbshipit-source-id: 51d9154f483a47c6196a4d4d9d4af14e4eeab6e0
      7ef79a5f
    • Caleb Marchent's avatar
      Include Symbolizer in Folly CMake build · f0939c67
      Caleb Marchent authored
      Summary: autotools-based builds are being deprecated, but they lack the symbolizer library target.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9216312
      
      fbshipit-source-id: 585ce3c43a0800823c7de4ece99b56a1af82bae4
      f0939c67
    • Lee Howes's avatar
      R-value qualify Future<T>::then and deprecate lvalue. · 64eaa718
      Lee Howes authored
      Summary:
      Overall plan to modify Future<T>::then to be r-value qualified and use Future<T>::thenTry or Future<T>::thenValue.
      
      The goal is to disambiguate folly::Future and to improve type and lifetime safety of Future and its methods.
      
       * Deprecate l-value qualified calls to Future<T>::then.
       * Make appropriate changes to folly to make this correct without local deprecation warnings.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9175807
      
      fbshipit-source-id: 9dc9812270ca3fb800f3a56d3aef8ef3d1d209e6
      64eaa718
    • Yedidya Feldblum's avatar
      Dead Code: folly/experimental/symbolizer/ElfUtil.cpp · 8f17118c
      Yedidya Feldblum authored
      Summary: [Folly] Dead Code: `folly/experimental/symbolizer/ElfUtil.cpp`.
      
      Reviewed By: calebmarchent
      
      Differential Revision: D9218592
      
      fbshipit-source-id: e231852c068eb797c7c3a4a3955fefc38e4be2fc
      8f17118c