1. 13 Jan, 2015 40 commits
    • Andrei Alexandrescu's avatar
      Mini-refactoring prompted by https://phabricator.fb.com/D1770460 · a1942184
      Andrei Alexandrescu authored
      Summary: I got obliged into this one :o).
      
      Test Plan: runtests
      
      Reviewed By: meyering@fb.com
      
      Subscribers: njormrod, folly-diffs@
      
      FB internal diff: D1772328
      
      Signature: t1:1772328:1420744114:2b81e46d77800d247293cb667bbef86e9d6d4755
      a1942184
    • Jim Meyering's avatar
      folly/stats/Histogram-defs.h: avoid -Wsign-compare error · 2ab6db1e
      Jim Meyering authored
      Summary:
      * folly/stats/Histogram-defs.h (HistogramBuckets): Take the unusual
      approach of converting "numBuckets" to signed, because we cannot
      cast "max-min" (a known positive value) to an unsigned type --
      we don't have an unsigned variant of ValueType.
      This avoids the following error from gcc-4.9:
      
      folly/stats/Histogram-defs.h:41:31: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: ldbrandy@fb.com
      
      Subscribers: trunkagent, net-systems@, folly-diffs@
      
      FB internal diff: D1770129
      
      Tasks: 5941250
      
      Signature: t1:1770129:1420745311:c447e59f1730abafdf0b962e70f0886ae1d48db1
      2ab6db1e
    • Jim Meyering's avatar
      folly/.../FileUtilDetail.h: avoid -Wsign-compare warnings · 9d9b01ef
      Jim Meyering authored
      Summary:
      * folly/detail/FileUtilDetail.h (wrapvFull): Change type of result
      variable from ssize_t to size_t: this required changing r == -1 to
      r == (size_t)-1.
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      Also run fbmake runtests, and confirm that the results are
      the same with and without this change.
      
      Reviewed By: lucian@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1772171
      
      Tasks: 5941250
      
      Signature: t1:1772171:1420743142:1f9e02006e2d77a0c9451bae7965fb28617d95d6
      9d9b01ef
    • Jim Meyering's avatar
      folly/wangle/futures/Future-inl.h: avoid -Wsign-compare errors · 7f4d487a
      Jim Meyering authored
      Summary:
      * folly/wangle/futures/Future-inl.h (whenAll): Do not compare
      signed (std::distance) with unsigned(size_t): add an assertion
      to eliminate the possibility of negative, then assign to a new
      size_t "n".
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: jsedgwick@fb.com
      
      Subscribers: trunkagent, fugalh, folly-diffs@
      
      FB internal diff: D1770668
      
      Tasks: 5941250
      
      Signature: t1:1770668:1420736965:fc722657a2ec523052fd96c33d65d5ca24aae61c
      7f4d487a
    • Jim Meyering's avatar
      folly/FBString.h: avoid -Wsign-compare error · 5b12bbfc
      Jim Meyering authored
      Summary:
      * folly/FBString.h (operator>>): Since istream.width() is signed,
      handle the case of a negative width. This avoids risk that "n"
      will be less than 0 when compared against unsigned "extracted".
      However, to suppress the following warning, we must also explicitly
      convert "n" to size_t before comparing:
      
      folly/FBString.h:2326:22: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      Subscribers: trunkagent, net-systems@, njormrod, folly-diffs@
      
      FB internal diff: D1770460
      
      Tasks: 5941250
      
      Signature: t1:1770460:1420679684:b262eb31e6511b6311bebf0fbc29099471648b36
      5b12bbfc
    • James Sedgwick's avatar
      stop returning move(...) when unnecessary · 0b215436
      James Sedgwick authored
      Summary: as discussed in another diff, this might help with NRVO
      
      Test Plan: unit
      
      Reviewed By: hans@fb.com
      
      Subscribers: trunkagent, fugalh, folly-diffs@
      
      FB internal diff: D1764921
      
      Signature: t1:1764921:1420677311:c6b63d7bf04c0e17283117b3edef798c288e5fbb
      0b215436
    • James Sedgwick's avatar
      fix shadowed variables · 0e8d462a
      James Sedgwick authored
      Summary: as above, fixes builds
      
      Test Plan: compiled thrift + mcrouter
      
      Reviewed By: seanc@fb.com
      
      Subscribers: seanc, fugalh, folly-diffs@
      
      FB internal diff: D1771910
      
      Signature: t1:1771910:1420733490:7f33e57a5853395cab786e5d35d4c15c75a15c5a
      0e8d462a
    • James Sedgwick's avatar
      doxygen comments for Try · 4ea6cf43
      James Sedgwick authored
      Summary:
      One header at a time, starting with the small fry
      
      I'm allowed to drink while I do this right? Good, because I don't think I ever had a choice.
      
      Test Plan: generated doxygen and looked decent http://home.fburl.com/~jsedgwick/html/classfolly_1_1wangle_1_1Try.html
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: trunkagent, fugalh, njormrod, folly-diffs@
      
      FB internal diff: D1677730
      
      Tasks: 5480262
      
      Signature: t1:1677730:1415899240:bdd03569a82be1c8def8c13786eae39b4a2a2f94
      4ea6cf43
    • James Sedgwick's avatar
      exception_ptr -> exception_wrapper migration · 352bbea6
      James Sedgwick authored
      Summary:
      integrate exception_wrapper everywhere, and deprecate public methods that take ptrs directly to discourage their use
      note that this will break for throwing non-exceptions, which is probably fine
      
      this change opens the door to interesting optimizations for those interested, e.g. Future::then<Exn1, Exn2>(/* func throwing Exn1 and Exn2 */) that autowraps the given types into the resultant future
      
      new benchmark:
      ```
      throwAndCatch                                               23.69us   42.21K
      throwAndCatchWrapped                             119.53%    19.82us   50.45K
      throwWrappedAndCatchWrapped                      350.16%     6.77us  147.80K
      ```
      
      Test Plan: existing unit tests, suspected potential perf wins confirmed by benchmark, will wait for windtunnel to see other wins/regressions
      
      Reviewed By: hans@fb.com
      
      Subscribers: search-fbcode-diffs@, apodsiadlo, alikhtarov, andrii, trunkagent, fugalh, njormrod, folly-diffs@, bmatheny
      
      FB internal diff: D1644912
      
      Signature: t1:1644912:1420731849:3dc658dc03bfd6e75d61158808c7dad96092ecfb
      352bbea6
    • Jim Meyering's avatar
      folly/String-inl.h (humanify): avoid -Wsign-compare error · 06cee071
      Jim Meyering authored
      Summary:
      * folly/String-inl.h (humanify): Count with a signed type.
      Otherwise, gcc-4.9 fails with e.g.,
      folly/String-inl.h:596:33: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      folly/String-inl.h:601:32: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: philipp@fb.com
      
      Subscribers: trunkagent, folly-diffs@
      
      FB internal diff: D1770451
      
      Tasks: 5941250
      
      Signature: t1:1770451:1420704354:c841ca453a5586fbf474535ca26cef17f95427dd
      06cee071
    • Jim Meyering's avatar
      folly/AtomicHashArray: use an unsigned type for each of two counters · d6ddc282
      Jim Meyering authored
      Summary:
      * folly/AtomicHashArray.h (numEntries_, numPendingEntries_):
      Use an unsigned type for each of these.  They count things, can
      never go below 0, and are compared to unsigned values.
      Otherwise, gcc-4.9 would emit this:
      folly/AtomicHashArray-inl.h:153:38: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: philipp@fb.com
      
      Subscribers: trunkagent, folly-diffs@
      
      FB internal diff: D1770695
      
      Tasks: 5941250
      
      Signature: t1:1770695:1420683354:bfa4775bc2f8aab74e34772308a5c8b1779243b8
      d6ddc282
    • Jim Meyering's avatar
      folly/AtomicHashMap-inl.h: avoid -Wsign-compare warning/error (easy) · 69e1c7dc
      Jim Meyering authored
      Summary:
      * folly/AtomicHashMap-inl.h (insertInternal): Do not declare
      nextMapIdx to be signed ("int"), since we compare it against
      variables of unsigned type.  Otherwise, gcc-4.9 would give this
      diagnostic:
      folly/AtomicHashMap-inl.h:99:18: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      complaining about this comparison:
      if (nextMapIdx >= kNumSubMaps_ ||
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: philipp@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1770683
      
      Tasks: 5941250
      
      Signature: t1:1770683:1420683505:4452c7cb4f14f098be089601be906884036348ed
      69e1c7dc
    • Jim Meyering's avatar
      Histogram and Timeseries vs gcc-4.9 and -Wsign-compare · 29be5d6d
      Jim Meyering authored
      Summary:
      Address multiple -Werror=sign-compare issues exposed when building
      tao with gcc-4.9.
      In most of these changes I've changed the type of the index in
      a for-loop from int to size_t.  The important thing is to use
      an unsigned type when the limit is also unsigned.  I choose size_t
      because the general recommendation (when writing portable code)
      to avoid size-tied types like uint32_t and uint64_t unless you
      have a very good reason to require them.
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 tao/server && fbmake dbgo
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      Subscribers: trunkagent, net-systems@, folly-diffs@
      
      FB internal diff: D1766651
      
      Tasks: 5941250
      
      Signature: t1:1766651:1420594537:56ef53ca233e1649469db9570942c1d5dd47cf6d
      29be5d6d
    • Jim Meyering's avatar
      folly/test/ForeachTest.cpp: avoid -Wsign-compare error · 8cae10aa
      Jim Meyering authored
      Summary:
      * folly/test/ForeachTest.cpp: Change a "1" to "1U", so it matches
      the signedness of the size_t upper bound.
      Otherwise, gcc-4.9 fails with e.g.,
      folly/Foreach.h:194:16: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1770603
      
      Tasks: 5941250
      
      Signature: t1:1770603:1420679246:56ef62ac7fa4413a4ad6310c3381a12bdc59e64c
      8cae10aa
    • Jim Meyering's avatar
      folly/stats/BucketedTimeSeries-defs.h: avoid -Wsign-compare error · 0d98066a
      Jim Meyering authored
      Summary:
      * folly/stats/BucketedTimeSeries-defs.h (BucketedTimeSeries):
      Assume that maxDuration is never negative, and cast the signed
      duration_.count() to size_t, to avoid this error from gcc-4.9:
      
      folly/stats/BucketedTimeSeries-defs.h:38:18: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      Subscribers: trunkagent, net-systems@, folly-diffs@
      
      FB internal diff: D1770171
      
      Tasks: 5941250
      
      Signature: t1:1770171:1420669115:61e6b8d3248f88b25736322c7066af015209fba5
      0d98066a
    • Jim Meyering's avatar
      folly/Format-inl.h: use the correct type for fwrite return value (easy) · ab794fb6
      Jim Meyering authored
      Summary:
      * folly/Format-inl.h (folly): fwrite returns size_t, not ssize_t.
      Fixing this avoids the following diagnostic from gcc-4.9:
      folly/Format-inl.h:299:11: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: philipp@fb.com
      
      Subscribers: trunkagent, net-systems@, folly-diffs@
      
      FB internal diff: D1770155
      
      Tasks: 5941250
      
      Signature: t1:1770155:1420668733:62593231d35f5874521dba575f23b68891b2a4f9
      ab794fb6
    • Jim Meyering's avatar
      folly/Format-inl.h: avoid -Wsign-compare error · 453a7e48
      Jim Meyering authored
      Summary:
      * folly/Format-inl.h (IndexableTraitsSeq::at): Add an explicit
      int-to-size_t cast (ok here, since we've just confirmed
      that the value is not negative) to avoid this error from gcc-4.9:
      
      folly/Format-inl.h:947:29: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: tjackson@fb.com
      
      Subscribers: trunkagent, net-systems@, folly-diffs@
      
      FB internal diff: D1770193
      
      Tasks: 5941250
      
      Signature: t1:1770193:1420670569:83ac19c2ca8cd408d7c86d7dce49e2d4b418941a
      453a7e48
    • Jim Meyering's avatar
      folly/test/SpinLockTest.cpp: avoid -Wsign-compare error (trivial) · 3d4f7737
      Jim Meyering authored
      Summary:
      * folly/test/SpinLockTest.cpp (trylockTestThread):
      Change parameter type from int to size_t, to fix these:
      folly/test/SpinLockTest.cpp:67:25: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      folly/test/SpinLockTest.cpp:82:60: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: philipp@fb.com
      
      Subscribers: net-systems@, folly-diffs@
      
      FB internal diff: D1770564
      
      Tasks: 5941250
      
      Signature: t1:1770564:1420674373:fa3020398e2df66590eb71f798419b6f555d07c4
      3d4f7737
    • Dave Watson's avatar
      Fix CPUObserver test · 5227dcf2
      Dave Watson authored
      Summary: CPUObserver observe events happen in different threads than the IOThreadPool ones.
      
      Test Plan: fbconfig folly/wangle/concurrent/test && fbmake runtests --stress-runs 48
      
      Reviewed By: jsedgwick@fb.com
      
      Subscribers: doug, fugalh, folly-diffs@
      
      FB internal diff: D1769345
      
      Tasks: 5948465
      
      Signature: t1:1769345:1420654316:196121ca30c905497a0acade05b9d877c98f6eeb
      5227dcf2
    • Jim Meyering's avatar
      folly/wangle/bootstrap/ServerBootstrap.h: avoid -Wsign-compare error (trivial) · 3564b902
      Jim Meyering authored
      Summary:
      * folly/wangle/bootstrap/ServerBootstrap.h:
      Change type of a for-loop index from int to size_t.
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: jsedgwick@fb.com
      
      Subscribers: fugalh, folly-diffs@
      
      FB internal diff: D1770091
      
      Tasks: 5941250
      
      Signature: t1:1770091:1420667597:fbe9a5ba56a0e34e0480c82c8fb61128406ded95
      3564b902
    • Nicholas Ormrod's avatar
      AHM ASAN test adjustment · 98543616
      Nicholas Ormrod authored
      Summary:
      The AHA-insert-race test case (a) does a LOT of iterations, and
      (b) allocated and deallocates a lot of memory on each iteration.
      
      The long iterations, by themselves, take 8s, and should be reduced.
      Further, ASAN errors on these tests, since it needs to hold on to memory
      for a bit of time and ends up OOMing.
      
      Test Plan:
      fbconfig -r 'folly' '--platform-all=gcc-4.8.1-glibc-2.17-fb' '--sanitize=address'
      fbmake runtests Ahm.atomic_hash_array_insert_race
      
      Reviewed By: robbert@fb.com
      
      Subscribers: sdwilsh, folly-diffs@
      
      FB internal diff: D1767334
      
      Tasks: 5941888
      
      Signature: t1:1767334:1420612386:4d6f4067b30d1cb7d20bcfeb0f31fac1339ead20
      98543616
    • Jim Meyering's avatar
      folly/small_vector.h: avoid -Wsign-compare error · 67a4edad
      Jim Meyering authored
      Summary:
      * folly/small_vector.h (moveToUninitialized): Do not mix
      signed and unsigned for-loop index/limit.  Instead, eliminate
      the intermediate "count" altogether and iterate as long as
      "first" is not equal to "last". Otherwise, gcc-4.9 fails with e.g.,
      folly/small_vector.h:115:18: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: soren@fb.com
      
      Subscribers: trunkagent, folly-diffs@
      
      FB internal diff: D1767844
      
      Tasks: 5941250
      
      Signature: t1:1767844:1420601608:987fd7f7d44197ed9919910c9b559b37fbe421b6
      67a4edad
    • Jim Meyering's avatar
      folly/FBVector.h: avoid -Wsign-compare error (simple) · b6c430e1
      Jim Meyering authored
      Summary:
      * folly/FBVector.h (make_window): Declare "tail" to be
      explicitly of the same type as "n".  Otherwise, we'd
      use the type of std::distance, which is unsigned, and
      then compare that against "n" of type "size_type", which
      is unsigned, and we'd get this from gcc-4.9:
      folly/FBVector.h:1276:14: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: philipp@fb.com, andrei.alexandrescu@fb.com
      
      Subscribers: trunkagent, njormrod, folly-diffs@
      
      FB internal diff: D1768346
      
      Tasks: 5941250
      
      Signature: t1:1768346:1420594452:654dac805bb46f7c6a38b4e4102e4004720d6835
      b6c430e1
    • Jim Meyering's avatar
      folly/test/RangeTest.cpp: avoid -Wsign-compare error (trivial) · c7e25e1a
      Jim Meyering authored
      Summary:
      * folly/test/RangeTest.cpp (NeedleFinderTest): Declare for-loop
      index to be of type size_t.  OTherwise, gcc-4.9 fails:
      folly/test/RangeTest.cpp:910:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: philipp@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1768279
      
      Tasks: 5941250
      
      Signature: t1:1768279:1420593237:246040eebd40e313bdb19799bb11d6639f1481de
      c7e25e1a
    • Jim Meyering's avatar
      folly/experimental/test/BitsBenchmark.cpp: avoid -Wsign-compare error · 314f48cc
      Jim Meyering authored
      Summary:
      * folly/experimental/test/BitsBenchmark.cpp (benchmarkSet):
      Another s/int/size_t/ change to type of for-loop index, to match
      the type of the loop's upper bound.
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1767853
      
      Tasks: 5941250
      
      Signature: t1:1767853:1420587945:f32a0ef33f6c5fa75598ecb114a243f83b31e550
      314f48cc
    • Jim Meyering's avatar
      folly/wangle/channel/ChannelPipeline.h: avoid -Wsign-compare errors (trivial) · 042bbfeb
      Jim Meyering authored
      Summary:
      * folly/wangle/channel/ChannelPipeline.h: Declare for-loop indices
      to be of type size_t(not int), to match size of upper bound.
      Otherwise, gcc-4.9 fails with e.g.,
      folly/wangle/channel/ChannelPipeline.h:126:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: fugalh, folly-diffs@
      
      FB internal diff: D1767783
      
      Tasks: 5941250
      
      Signature: t1:1767783:1420587925:d662b75e6a62ebd5bacdde28ad6e1da22ef777ac
      042bbfeb
    • Jim Meyering's avatar
      folly/gen/Parallel-inl.h: trivial -Wsign-compare fix · 32172a24
      Jim Meyering authored
      Summary:
      [just like https://phabricator.fb.com/D1767160 --
      I don't know why I didn't see this the first time]
      * folly/gen/Parallel-inl.h (folly): Use a for-loop index of type
      size_t (not "int") to match type of upper bound.
      Otherwise, gcc-4.9 fails with this:
      folly/gen/Parallel-inl.h:242:27: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: philipp@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1767520
      
      Signature: t1:1767520:1420583501:121f7212f78774adb6ca7cf67cbab83bf604cbbe
      32172a24
    • Jim Meyering's avatar
      folly/gen/Parallel-inl.h: trivial -Wsign-compare fix · a4a48cc2
      Jim Meyering authored
      Summary:
      * folly/gen/Parallel-inl.h (folly): Use a for-loop index of type
      size_t (not "int") to match type of upper bound.
      Otherwise, gcc-4.9 fails with this:
      folly/gen/Parallel-inl.h:242:27: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1767160
      
      Tasks: 5941250
      
      Signature: t1:1767160:1420577886:6acfb7f6d50ed715dcf4058841aeabc39fa99cbc
      a4a48cc2
    • Peter Griess's avatar
      Fix HHWheelTimer compilation bug in libc++ build · 0af2af09
      Peter Griess authored
      Summary:
      - Manually swap bucket_ entries in HHWheelTimer to work around a bug in
      libc++
      
      Test Plan:
      - fbconfig -r folly/io/async && fbmake runtests --extended-tests
      - Sync to OS X and build there
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: trunkagent, doug, seanc, folly-diffs@
      
      FB internal diff: D1766601
      
      Signature: t1:1766601:1420566916:24a2911e997ee04f0934884bdf7b82345cb2b752
      0af2af09
    • Hans Fugal's avatar
      join · 27188837
      Hans Fugal authored
      Summary:
      Fixes T5922800
      (I think)
      
      Test Plan:
      TBH I don't know why detaching a temporary thread variable might cause the program to abort but this seems to be the most likely cause so I'm making this change and we'll see in a day or two if it fixes it.
      
      The test still passes and doesn't hang
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: fugalh, exa, folly-diffs@
      
      FB internal diff: D1764374
      
      Tasks: 5922800
      
      Signature: t1:1764374:1420485233:2e4c81776ef6b6bdae18fbf2e99f0deea37b7879
      27188837
    • Jim Meyering's avatar
      folly/Format-inl.h: fix gcc-4.9-exposed shadowing warning/error (trivial) · 4925e0f4
      Jim Meyering authored
      Summary:
      * folly/Format-inl.h (BaseFormatter): Move decls of P and END down
      past the shadowed decls.  Otherwise, gcc-4.9 would emit this:
      ./folly/Format-inl.h:209:10: error: declaration of 'p' shadows a previous local [-Werror=shadow-local]
      ./folly/Format-inl.h:202:8: error: shadowed declaration is here [-Werror=shadow-local]
      ./folly/Format-inl.h:210:10: error: declaration of 'end' shadows a previous local [-Werror=shadow-local]
      ./folly/Format-inl.h:203:8: error: shadowed declaration is here [-Werror=shadow-local]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 tao/server && fbmake dbgo
      
      Reviewed By: andrewjcg@fb.com
      
      Subscribers: trunkagent, net-systems@, folly-diffs@
      
      FB internal diff: D1766673
      
      Tasks: 5941250
      
      Signature: t1:1766673:1420569376:22c5c3a012715e479b27ba6f0bde1a3b079a3be3
      4925e0f4
    • Dave Watson's avatar
      Thread Observer · 9009c2b4
      Dave Watson authored
      Summary: Observer methods, so users of IOThreadPoolExecutor can do stuff when threads are added/removed.  As a use case, previously the thrift server only used the threads already started when it started up, and assumed iothreadpool was never resized.
      
      Test Plan: Added several unittests
      
      Reviewed By: jsedgwick@fb.com
      
      Subscribers: trunkagent, doug, fugalh, alandau, bmatheny, mshneer, folly-diffs@
      
      FB internal diff: D1753861
      
      Signature: t1:1753861:1420236825:54cbdfee0efb3b97dea35faba29c134f2b10a480
      9009c2b4
    • Jim Meyering's avatar
      folly/Range.cpp: avoid -Werror=sign-compare error with gcc-4.9 · c9a5ee23
      Jim Meyering authored
      Summary:
      * folly/Range.cpp (scanHaystackBlock): This method mistakenly
      declared its "idx" (aka blockStartIdx) parameter to have signed type.
      It is logically an unsigned type and is compared only with other
      variables of unsigned type, so make it unsigned.
      Here's the diagnostic:
      folly/Range.cpp:202:44: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      folly/Range.cpp: In instantiation of 'size_t folly::detail::scanHaystackBlock(folly::StringPiece, folly::StringPiece, int64_t) [with bool HAYSTACK_ALIGNED = true; size_t = long unsigned int; folly::StringPiece = folly::Range<const char*>; int64_t = long int]':
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 tao/server && fbmake dbgo
      
      Reviewed By: robbert@fb.com, philipp@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1765590
      
      Signature: t1:1765590:1420506036:7cbe2c454ad1f018a1c0aa5112a38bed1b2ac673
      c9a5ee23
    • James Sedgwick's avatar
      fix 4.9 build · fe41434e
      James Sedgwick authored
      Summary:
      see https://www.facebook.com/groups/738749156173702/permalink/798168656898418/
      
      I suppressed "comparison between signed and unsigned integer expressions" warnings for this first pass because there a whole lot (dozens) of those. Do we suppress those with 4.8 or something? Never seen the warnings before.
      
      I can't find anything in boost 1.57 docs/changelog indicating why implicit conversion of boost::optional<bool> -> bool doesn't compile anymore, but it doesn't.
      
      Test Plan: fbconfig -r --platform-all gcc-4.9-glibc-2.20 --extra-cxxflags="-Wno-sign-compare" folly && fbmake opt && fbmake runtests_opt
      
      Reviewed By: rhysparry@fb.com
      
      Subscribers: trunkagent, fugalh, folly-diffs@
      
      FB internal diff: D1765093
      
      Signature: t1:1765093:1420500411:062acf841641c7f4142c9b48e8daa45327de6822
      fe41434e
    • Hans Fugal's avatar
      (folly) osx bootstrap script · 799d6503
      Hans Fugal authored
      Summary:
      This is a bootstrap script for building folly on osx. I attempted to make it Just Work for anyone who uses Homebrew (http://brew.sh/) but even if it doesn't work out of the box it should be instructive for the motivated developer on OSX.
      
      Facebook:
      In #5134151 Wangle used to not build, because something was using a futex. But that seems to have been rectified (or the build problems are hiding in headers that aren't used in the libfolly build).
      
      I'll also update https://our.intern.facebook.com/intern/wiki/Folly/BuildingOnMac to point people to this script instead.
      
      Test Plan:
      Tested on my laptop which is running Yosemite (10.10.1)
      Build, then inspect `otool -L .libs/*dylib`
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: folly-diffs@, exa
      
      FB internal diff: D1765248
      
      Tasks: 5134151
      
      Signature: t1:1765248:1420500905:bc5da97a0446f502cb2badc85c9004ff0a62027a
      799d6503
    • Dave Watson's avatar
      fix bootstrap test on older kernels · c77b1e7d
      Dave Watson authored
      Summary: another unittest that doesn't work without reuseport support, add a check
      
      Test Plan: ran it on sandcastle187.prn2, works
      
      Reviewed By: njormrod@fb.com
      
      Subscribers: doug, fugalh, folly-diffs@
      
      FB internal diff: D1764395
      
      Tasks: 5931982
      
      Signature: t1:1764395:1420490666:658aef148ebca9484534a0cebb228570e28f1002
      c77b1e7d
    • Sergey Doroshenko's avatar
      folly: AsyncServerSocket::getAddress: prefer IPv6 · 23027364
      Sergey Doroshenko authored
      Summary:
      Can't connect from ipv6-only cluster to ipv4/ipv6 service which uses different ports.
      
      Facebook:
      A lot of tests start a service, get its port, and try to connect to 127.0.0.1:port, which breaks
      after this diff since the port corresponds to IPv6 address, not IPv4. Fixing this by changing
      127.0.0.1 to ::1 in places found by sandcastle.
      
      ```
      fbconfig servicerouter/aggregator/tests servicerouter/client/cpp/test common/fb303/cpp/test thrift/lib/cpp2/test unicorn/hotswap/test common/client_mgmt thrift/test servicerouter/client/swig/tests unicorn/async/test servicerouter/selection/tests
      ```
      
      Test Plan:
      ```
      $ ./fastcopy_server --dir . &
      $ netstat -atnlp | grep LISTEN | grep fastcopy
      tcp        0      0 0.0.0.0:65478               0.0.0.0:*                   LISTEN      9348/./fastcopy_ser
      tcp        0      0 :::52793                    :::*                        LISTEN      9348/./fastcopy_ser
      ```
      
      Reviewed By: philipp@fb.com
      
      Subscribers: trunkagent, vkatich, fbcode-common-diffs@, chaoyc, search-fbcode-diffs@, davejwatson, andrewcox, mcduff, hitesh, unicorn-diffs@, alandau, mshneer, folly-diffs@, bmatheny, ps, soren
      
      FB internal diff: D1760372
      
      Tasks: 5868818, 5886688
      
      Signature: t1:1760372:1419992695:e7d254b2b8f730baefc169effa236b8daa9d846d
      23027364
    • Viswanath Sivakumar's avatar
      Fix use of SSL session TransportInfo after txn is detached · 9d022380
      Viswanath Sivakumar authored
      Summary:
      De-couple TransportInfo fields from SSL session structs to avoid
      dangling pointers.
      
      Facebook:
      We sometimes lazily copy TransportInfo in handler after
      detachClientTransaction for logging. If the socket is closed, then this
      creates dangling pointers to some SSL structs. This is an attempt to fix
      that.
      
      This is similar to what @ajitb did in
      https://phabricator.fb.com/D1666951 which had to be abandoned because of
      memory overhead. Here, instead of copying the relevant fields per
      transaction, we are only doing it once per session (shared_ptr), so the
      memory overhead should be negligible.
      
      Test Plan: Unit tests pass. Will canary
      
      Reviewed By: afrind@fb.com
      
      Subscribers: fugalh, bmatheny, ssl-diffs@, folly-diffs@, ajitb
      
      FB internal diff: D1757318
      
      Tasks: 5865651, 5879508
      
      Signature: t1:1757318:1420482488:9f5144b499eb2086cf2a80243328db5715b48f88
      9d022380
    • Andrii Grynenko's avatar
      Replace singleton names with type tags · df2469a3
      Andrii Grynenko authored
      Summary: This change simplifies Singleton API (methods don't need to accept name) and the actual implementation. It also makes it similar to folly::ThreadLocalPtr. Additionally misspelled singleton name becomes compilation error, not runtime error. Some users were actually naming singletons, when that was neccessary, this should also be fixed.
      
      Test Plan: unit tests for all touched projects
      
      Reviewed By: chip@fb.com
      
      Subscribers: trunkagent, fugalh, jsedgwick, fbcode-common-diffs@, mcduff, hitesh, mshneer, folly-diffs@
      
      FB internal diff: D1744978
      
      Signature: t1:1744978:1419282587:bd29dd8a70d7572530ac371a96a21764229bc397
      df2469a3
    • Philip Pronin's avatar
      fix __cxa_throw signature · 760b4c4f
      Philip Pronin authored
      Summary: `__cxa_throw` signature didn't match C++ ABI (see 2.4.3 in http://refspecs.linuxfoundation.org/abi-eh-1.22.html), gcc 4.9 was complaining.
      
      Test Plan: fbconfig -r folly && fbmake opt -j32
      
      Reviewed By: soren@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1760492
      
      Tasks: 5908365
      
      Signature: t1:1760492:1420251038:6d04683f96ac889ff348ca0485420c975819b90b
      760b4c4f