1. 22 Sep, 2013 14 commits
    • Louis Brandy's avatar
      deprecating boost::shared_ptr · a88ef0be
      Louis Brandy authored
      Summary:
      Replacing boost::shared_ptr with std::shared_ptr.
      
      Test Plan: .
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      FB internal diff: D932119
      a88ef0be
    • Tudor Bosman's avatar
      Fix small race in subprocess_test · 253f44cb
      Tudor Bosman authored
      Summary:
      It is possible for subprocess_test_parent_death_helper's child to signal
      the parent between the check for "caught" and the call to "pause()", and
      therefore pause() blocks forever.
      
      Test Plan: ran the test in a loop
      
      Reviewed By: delong.j@fb.com
      
      FB internal diff: D979872
      253f44cb
    • Tudor Bosman's avatar
      Add various functions to wrapNoInt · 5675ef27
      Tudor Bosman authored
      Test Plan: used them
      
      Reviewed By: soren@fb.com
      
      FB internal diff: D976393
      5675ef27
    • Tudor Bosman's avatar
      Fixed-size atomic bitset · c63b363e
      Tudor Bosman authored
      Summary: No magic; what it says on the package.
      
      Test Plan: atomic_bitset_test
      
      Reviewed By: delong.j@fb.com
      
      FB internal diff: D971875
      c63b363e
    • Max Wang's avatar
      Parametrize allocator in AtomicHash{Array,Map} · 2129f9b5
      Max Wang authored
      Summary: Maybe at some point somebody won't want malloc, e.g. me.
      
      Test Plan: Ran AtomicHashArrayTest using an mmap allocator.
      
      Reviewed By: delong.j@fb.com
      
      FB internal diff: D960192
      2129f9b5
    • Stephane Sezer's avatar
      Make folly::Uri::port() return uint16_t instead of uint32_t. · 4c787a9d
      Stephane Sezer authored
      Summary: We can safely assume that ports are always going to be 16bit (TCP or UDP), so no need to have a uint32_t here.
      
      Test Plan: Ran tests in folly/tests.
      
      Reviewed By: tudorb@fb.com
      
      FB internal diff: D973291
      4c787a9d
    • Stephane Sezer's avatar
      Remove problematic log lines from folly JSON test. · ffd25cf7
      Stephane Sezer authored
      Summary: We are logging UTF-8 data in this test. This makes the test infra fail (when using `fbmake runtests` for example).
      
      Test Plan: Run existing JSON tests.
      
      Reviewed By: shreehari@fb.com
      
      FB internal diff: D975249
      ffd25cf7
    • Andrey Goder's avatar
      fix minor typo in comment · 8071c1e0
      Andrey Goder authored
      Test Plan: n/a
      
      Reviewed By: delong.j@fb.com
      
      FB internal diff: D970791
      8071c1e0
    • Altan Alpay's avatar
      AsyncIO::initializeContext() should provide more debug output when io_queue_init fails · 5af17ef1
      Altan Alpay authored
      Summary: It would be good idea to provide more information if the io_queue_init() failed due to resource allocation.
      
      Test Plan:
      Run standart tests + manual testing
      1. fbconfig -r folly/experimental/ && fbmake runtests
      2. Ask a capacity larger than aio_max_nr and check failure messages
      
      Reviewed By: agartrell@fb.com
      
      FB internal diff: D965260
      5af17ef1
    • Philip Pronin's avatar
      fix memcpy-param-overlap (asan) in GroupVarint · 6e442037
      Philip Pronin authored
      Test Plan: .
      
      Reviewed By: tudorb@fb.com
      
      FB internal diff: D962972
      6e442037
    • Andrew Gallagher's avatar
      folly: don't inline functions with ASAN disabled · 95201d11
      Andrew Gallagher authored
      Summary:
      The address sanitizer disabling attribute has some issues in gcc when
      the function is inlined.
      
      Test Plan: Built and ran tao tests with ASAN.
      
      Reviewed By: philipp@fb.com
      
      FB internal diff: D962930
      95201d11
    • Nicholas Ormrod's avatar
      range checks in DynamicConverter · 6a7ee8aa
      Nicholas Ormrod authored
      Summary:
      Add range-checking to convertTo for small numeric types.
      
      Internally, dynamics represent a numeric with an int64_t or a double.
      When converting to a smaller numeric type, DynamicConverter uses a
      static_cast. This causes some confusion (re D936940). The code now uses
      folly::to, which throws a std::range_error on overflow.
      
      While working on this I also added some light comments to the new
      toDynamic section, for consistency with the original convertTo
      commenting. I also renamed the internal trait is_associative_container
      to is_map, since is_associative_container is looking for a mapped_type
      typedef and hence excludes such associative containers as sets.
      
      While adding the overflow tests, I also augmented the typetraits test to
      include the is_map and is_range traits, which hitherto had no test
      coverage.
      
      Test Plan: build and run tests, both in dbg and opt
      
      Reviewed By: cberner@fb.com
      
      FB internal diff: D961605
      6a7ee8aa
    • Philip Pronin's avatar
      disable asan for qfind_first_byte_of_needles16 · 5f19afe7
      Philip Pronin authored
      Summary:
      It's expected to read past the string (within the same memory
      page).
      
      Test Plan: .
      
      Reviewed By: tudorb@fb.com
      
      FB internal diff: D962974
      5f19afe7
    • Philip Pronin's avatar
      fix heap-buffer-overflow (asan) in EliasFanoCoding · 3c40a0b6
      Philip Pronin authored
      Test Plan:
      fbconfig folly/experimental/test:elias_fano_test && fbmake runtests_opt
      
      Reviewed By: tudorb@fb.com
      
      FB internal diff: D962971
      3c40a0b6
  2. 08 Sep, 2013 5 commits
    • Jordan DeLong's avatar
      Some fixes for building stuff with clang · ec0da690
      Jordan DeLong authored
      @override-unit-failures
      
      Summary: Not that much.
      
      Test Plan:
      Compiled hphp with clang.
      
      Reviewed By: oyamauchi@fb.com
      
      FB internal diff: D954663
      ec0da690
    • Andrew Gallagher's avatar
      folly: disable address sanitizer warnings on fbstring · 91199bbe
      Andrew Gallagher authored
      Summary:
      The fbstring constructor does word-aligned copies which may creep
      past the end of the C string, which address sanitizer doesn't like.
      
      This also adds a address-sanitizer-disabling-attribute to both
      Portability.h (for general use) and a (gross) copy in FBString.h
      since it gets put into libstdc++.
      
      Test Plan: ran address sanitizer on folly tests
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      FB internal diff: D950586
      91199bbe
    • bsimmers's avatar
      abort instead of throwing an exception on bad format strings · 9bfa4150
      bsimmers authored
      Summary:
      Errors that happen during format are almost always programmer
      error in the form of a bad format string. Abort instead of throwing in
      these cases.
      
      Test Plan: automated tests, added a couple new tests
      
      Reviewed By: tudorb@fb.com
      
      FB internal diff: D947470
      9bfa4150
    • Dave Watson's avatar
      x86intrinsic seems to be problematic for clang · 38220af4
      Dave Watson authored
      Summary: fbinject (clang code parser) throws some errors when
      including the x86intrinsic header.
      
      Test Plan:
      D929356 compiles after this diff.  It adds a dep on RWSpinLock.
      
      Reviewed By: beng@fb.com
      
      FB internal diff: D950285
      38220af4
    • Tudor Bosman's avatar
      Fix insignificant CRTP bug · e16c0109
      Tudor Bosman authored
      Summary:
      
      @override-unit-failures
      Flaky unit tests passed on the second try, but the git hook still
      complains
      
      Test Plan: iobuf_cursor_test
      
      Reviewed By: philipp@fb.com
      
      FB internal diff: D948768
      e16c0109
  3. 29 Aug, 2013 2 commits
    • Sean Cannella's avatar
      fix folly build on OSX with gcc 4.8 · 879dfa05
      Sean Cannella authored
      Summary:
      - gcc 4.8 + boost 1.53 do not like the Oxford comma in template
      arguments
      
      Test Plan: compiled on OSX with gcc 4.8 and boost 1.53
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      FB internal diff: D949373
      879dfa05
    • Tudor Bosman's avatar
      folly::io::QueueAppender speedup · bae9c76c
      Tudor Bosman authored
      Summary:
      Make QueueAppender (as used in the thrift2 protocol writer) much faster.
      Benchmarks in a separate diff (for thrift2).
      
      A few things:
      - remove IOBuf range checks in optimized mode
      - simplify QueueAppender: maxGrowth wasn't used, removed it
      - simplify QueueAppender: don't duplicate the work in IOBufQueue, let
      IOBufQueue keep track of memory
      - speed up IOBuf::isSharedOne(): fast-path case where the buffer was never
      shared (so don't read the reference count in that case)
      - fast-path in QueueAppender if size is known at compile time
      
      @override-unit-failures
      compilation errors outside of folly fixed in subsequent diff
      
      Test Plan: folly/io/test, both dbg and opt
      
      Reviewed By: davejwatson@fb.com
      
      FB internal diff: D946907
      bae9c76c
  4. 28 Aug, 2013 19 commits
    • Dave Watson's avatar
      Update build for Ubuntu 12.10. 12.04 seems to no longer compile · 3086657e
      Dave Watson authored
      Summary: Dave Watson put this in github a few months ago.
      
      Test Plan: None
      
      Reviewed By: delong.j@fb.com
      
      FB internal diff: D912681
      3086657e
    • Tudor Bosman's avatar
      Unbreak build: -Werror=pragmas (srsly) · fab0e011
      Tudor Bosman authored
      Summary:
      gcc 4.6 doesn't know of -Wmaybe-uninitialized, so it reports a warning, which
      we treat as an error.
      
      Test Plan: compiled folly/test folly/experimental/test with gcc 4.6.2, 4.7.1, 4.8.1
      
      Reviewed By: philipp@fb.com
      
      FB internal diff: D945766
      fab0e011
    • Tudor Bosman's avatar
      Expand the range where uninitialized warnings are ignored · 2b356118
      Tudor Bosman authored
      Summary: gcc 4.8 is picky
      
      Test Plan: folly tests, compiled unicorn with gcc 4.8
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      FB internal diff: D945336
      2b356118
    • Jim Meyering's avatar
      folly: adjust more headers to be -Wshadow-clean · 820c91a0
      Jim Meyering authored
      Summary:
      This is part of what's required to make mcrouter compile warning-free
      with gcc -Wshadow.  In case it's not obvious why this is worth doing,
      see t2719164.
      
      I've used two techniques:
      rename one of the shadowed variables
      bracket offending code with #pragma directives to disable the warning there.
      
      * folly/Bits.h (BitIterator): Guard this function with #pragma
      to avoid a warning about its member-shadowing "bitOffset" parameter.
      * folly/Memory.h (StlAllocator): Rename parameter in trivial, one-line
      function definition, s/alloc/a/, to avoid shadowing the member function.
      Let me know if you'd prefer #pragma directives instead.
      * folly/io/Cursor.h (pull,skip,clone): Rename parameter, s/length/len/,
      not to shadow the member function name.
      
      Test Plan:
      build and run tests of a few tools that use these headers
      
      Reviewed By: jon.coens@fb.com
      
      FB internal diff: D940493
      820c91a0
    • Tudor Bosman's avatar
      unbreak build · cf0e5923
      Tudor Bosman authored
      Test Plan: built producer_consumer_queue_test with gcc 4.7.1
      @override-unit-failures
      
      Reviewed By: chip@fb.com
      
      FB internal diff: D942465
      cf0e5923
    • Sara Golemon's avatar
      Use boost:has_trivial_destructor instead of std::... · 573d6149
      Sara Golemon authored
      Summary: Boost's version is 4.8 safe.  std's version changes name
      
      Test Plan: hhvm builds
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      FB internal diff: D883508
      573d6149
    • Tudor Bosman's avatar
      std::map and std::set are not relocatable · 0950060f
      Tudor Bosman authored
      Summary: https://github.com/facebook/folly/issues/35
      
      @override-unit-failures
      hphp tests independently broken
      
      Test Plan: test added
      
      Reviewed By: delong.j@fb.com
      
      FB internal diff: D939323
      0950060f
    • Lucian Grijincu's avatar
      folly: improve Subprocess::enforce() error message · 01f69815
      Lucian Grijincu authored
      Summary: Previous implementation only printed the desired state, not the actual runtime state. Fix that.
      
      Test Plan: n/a
      
      Reviewed By: tudorb@fb.com
      
      FB internal diff: D936279
      01f69815
    • Philip Pronin's avatar
      make StringGen clang-compatible · 5ab723e5
      Philip Pronin authored
      Test Plan:
      fbconfig -r folly/test && fbmake opt -j32
      
      Reviewed By: tjackson@fb.com
      
      FB internal diff: D935182
      5ab723e5
    • Philip Pronin's avatar
      retry flock() if interrupted (EINTR) · 257ff9ff
      Philip Pronin authored
      Test Plan: fbconfig folly/test:file_test && fbmake runtests_opt
      
      Reviewed By: soren@fb.com
      
      FB internal diff: D932782
      257ff9ff
    • Tudor Bosman's avatar
      Fix overeager assertion · 07ed0a72
      Tudor Bosman authored
      Summary: Also important spelling mistakes.
      @override-unit-failures
      
      Test Plan: string_test
      
      Reviewed By: tjackson@fb.com
      
      FB internal diff: D930037
      07ed0a72
    • Tudor Bosman's avatar
      Add Varint-length-prefixed flavor of LZ4 · d71636e2
      Tudor Bosman authored
      Test Plan: test added
      
      Reviewed By: alandau@fb.com
      
      FB internal diff: D928836
      d71636e2
    • Tudor Bosman's avatar
      Varint in folly · 0558d398
      Tudor Bosman authored
      Test Plan: test added
      
      Reviewed By: alandau@fb.com
      
      FB internal diff: D928835
      0558d398
    • Jordan DeLong's avatar
      Fix a ThreadLocal bug: hold the meta lock when resizing the element vector · c55ca702
      Jordan DeLong authored
      Summary:
      There appears to be a race here.  leizha reported issues with
      a heavily recycled AtomicHashMap (ThreadCachedInt inside).  It looks
      like what's happening is this:
      
      - Thread A: ~ThreadCachedInt from an AHM
      - meta lock is taken, and the ThreadElement list is iterated
      - all entries are zerod, and the id is marked free
      - then releases the lock
      - Thread B: someone is calling get() on an unrelated id
      - hit reserve: rallocm on the pointer or unsynchronized memcpy from
      the element vector
      - waits on the lock
      - when it gets the lock, it stores back the value that it read that
      was zero'd by A.
      
      Later, someone reuses the id from the freelist, and reuses the
      previously freed pointer, and eventually double-freeing it.  (nullptr
      is the signifier for "this thread doesn't have an instance of the
      threadlocal yet").
      
      Test Plan:
      leizha's test case doesn't segv after this diff---it was
      reliably breaking with corruption in malloc before it.  I'm working on
      making that test case into a unit test to add to this diff, but I'm
      putting it up early in case there's something wrong with the theory
      above or in case someone has an idea for a better fix.
      
      Reviewed By: tudorb@fb.com
      
      FB internal diff: D928534
      c55ca702
    • Jim Meyering's avatar
      folly: attribute-aligned-arg must now be constant (not enum) · 21effa23
      Jim Meyering authored
      Summary:
      With gcc-4.8.[01], the argument to __attribute__((__aligned__(...)))
      must be a literal;  using an enum member evokes this:
      
      ./folly/MPMCQueue.h:341:63: error: requested alignment is not an \
      integer constant
      size_t capacity_ FOLLY_ON_NEXT_CACHE_LINE;
      
      Changing the enum member to this made no difference:
      
      static constexpr size_t kFalseSharingRange = 64;
      
      Test Plan: compile tao and run test suite
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      FB internal diff: D926221
      
      @override-unit-failures
      21effa23
    • Andrew Gallagher's avatar
      folly/Conv.h: remove unused local typedef · 6d5d48ac
      Andrew Gallagher authored
      Test Plan: compiled using gcc-4.8
      
      Reviewed By: meyering@fb.com
      
      FB internal diff: D923895
      6d5d48ac
    • Jim Meyering's avatar
      folly: avoid use of has_trivial_destructor in FBVector.h · 7c94b139
      Jim Meyering authored
      Summary:
      This is required for gcc-4.8.x.
      Use boost::has_trivial_destructor, not std::has_trivial_destructor.
      The latter was never standard, and the now-std name (and the only one
      supported in gcc-4.8.0) is std::is_trivially_destructible.
      
      Test Plan:
      fbmake runtests and then
      run_unit_tests.sh with -r and again with -d
      
      Reviewed By: njormrod@fb.com
      
      FB internal diff: D923359
      
      @override-unit-failures
      7c94b139
    • Tudor Bosman's avatar
      IOBuf compression · 797870ec
      Tudor Bosman authored
      Summary: davejwatson: you asked
      
      Test Plan: test added
      
      Reviewed By: davejwatson@fb.com
      
      FB internal diff: D917336
      797870ec
    • Andrew Gallagher's avatar
      Revert "[clang support] removed superfluous declarations from header files" · fa664ed9
      Andrew Gallagher authored
      Summary: This reverts commit 49b197dfd02443e958906bac45059cea460e4e10.
      
      Test Plan: contbuild
      
      Reviewed By: akhilravidas@fb.com
      
      FB internal diff: D915386
      
      @override-unit-failures
      fa664ed9