1. 06 Nov, 2013 5 commits
    • denisspb's avatar
      Update Overview.md · 46600f3e
      denisspb authored
      Summary: just added few words about Subprocess.
      
      Reviewed By: delong.j@fb.com
      
      Test Plan: none
      46600f3e
    • Avani Nandini's avatar
      make move-ctor and destructor noexcept for folly::Optional · 7c083b08
      Avani Nandini authored
      Summary:
      as per summary
      @override-unit-failures
      
      Test Plan: run unit tests
      
      Reviewed By: delong.j@fb.com
      
      FB internal diff: D1031726
      7c083b08
    • Alex Landau's avatar
      Fix passing MoveWrapper into lambdas · e14cd5e1
      Alex Landau authored
      Summary:
      GCC can't compile code that passes a MoveWrapper into a lambda
      in some cases. For example if the capture list has
      [someConstObject, myMoveWrapper], gcc 4.7 fails. This specific case
      works with gcc 4.8, but other cases (e.g. [this, myMoveWrapper]) still
      fail.
      
      This diff is a hack that makes code like that compile. It can be
      removed, along with MoveWrapper itself once we move to C++14 with its
      extended lambda syntax.
      
      Test Plan: fbmake
      
      Reviewed By: hans@fb.com
      
      FB internal diff: D1032585
      e14cd5e1
    • Dave Watson's avatar
      updating folly makefiles · c21eba0d
      Dave Watson authored
      Summary:
      Update Makefile.am with recent files.
      
      Leaves out io/Compression because it uses lz4, of which there are no prebuilt packages for ubuntu (didn't check fedora, but I assume it is the same story there)
      
      Test Plan: on ubuntu 12.10, ./configure, make, make install
      
      Reviewed By: tudorb@fb.com
      
      FB internal diff: D1030008
      c21eba0d
    • Dave Watson's avatar
      move MoveWrapper to folly · 722ef0f3
      Dave Watson authored
      Summary: Add MoveWrapper to folly.
      
      @override-unit-failures
      
      Test Plan: arc unit
      
      Reviewed By: hans@fb.com
      
      FB internal diff: D1030005
      722ef0f3
  2. 25 Oct, 2013 1 commit
    • Sara Golemon's avatar
      Add missing define guard for folly-config.h · 8fcf9c21
      Sara Golemon authored
      Summary:
      Other inclusions of folly-config.h watch for this.
      It must have been missed when this file was added.
      
      Test Plan: Fixes Mac OSX build.
      
      Reviewed By: seanc@fb.com
      
      FB internal diff: D1028354
      8fcf9c21
  3. 24 Oct, 2013 20 commits
    • Sara Golemon's avatar
      Add missing include · 78d1c04a
      Sara Golemon authored
      Summary:
      MemoryMapping.cpp uses DEFINE_int64() from gflags,
      but doesn't include it anywhere.
      
      @override-unit-failures
      
      Test Plan: OSS build failure goes away
      
      Reviewed By: seanc@fb.com
      
      FB internal diff: D1026364
      78d1c04a
    • Andrey Goder's avatar
      fix typo in comment · 83f654ef
      Andrey Goder authored
      Summary: Pretty sure it was meant to be this way...
      
      @override-unit-failures
      
      Test Plan: n/a
      
      Reviewed By: tudorb@fb.com
      
      FB internal diff: D1020789
      83f654ef
    • Philip Pronin's avatar
      exponential capacity growth for io::TypedIOBuf · 94fce358
      Philip Pronin authored
      Summary:
      Amortized cost of `TypedIOBuf::push()` is `O(N)` at this moment.
      Unless we're using jemalloc where we can rely on `realloc()`.  In this
      diff we switch to exponential growth otherwise.
      
      Test Plan:
      built unicorn/test with ASan (and thus without jemalloc), ran
      end-to-end tests and verified we no longer spend minutes to build di4
      
      @override-unit-failures
      
      Reviewed By: tudorb@fb.com
      
      FB internal diff: D1015233
      94fce358
    • Philip Pronin's avatar
      avoid using ifunc + ASan · 681e4677
      Philip Pronin authored
      Summary:
      Code that is using ifunc dies with SIGSEGV on startup when used
      with ASan.
      
      Here is gdb output: {P2882504}
      
      Seems like `ifunc` dispatch is happening before ASan is initialized,
      but ASan instrumentation logic being called from there.
      
      Test Plan:
      built affected unicorn binaries with ASan, ran them, verified
      there is no more SIGSEGV
      
      Reviewed By: meyering@fb.com
      
      FB internal diff: D1013420
      681e4677
    • Rajat Goel's avatar
      Issue with find and npos · b3cd8a1b
      Rajat Goel authored
      Summary:
      I dont know whats the expected behavior but for std::string it seems
      to work.
      
      @override-unit-failures
      
      Test Plan:
      unit-tests
      
      [ RUN      ] FBString.findWithNpos
      folly/test/FBStringTest.cpp:1147: Failure
      Value of: fbstr.find(":", fbstring::npos)
      Actual: 9
      Expected: fbstring::npos
      Which is: 18446744073709551615
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      FB internal diff: D1012870
      b3cd8a1b
    • Nicholas Ormrod's avatar
      Change FBString's #define throw · b604632b
      Nicholas Ormrod authored
      Summary:
      Instead of defining throw to nothing, define it to something
      which creates a grepable error message (re @tudorb in D1005889).
      
      @override-unit-failures
      
      Test Plan:
      fbconfig -r folly
      fbmake dbg && fbmake runtests && fbmake opt && fbmake runtests_opt
      
      All tests passing.
      
      Added throw to a few places in FBString; noticed that error messages
      were produced, and that they contained the defined text. Those changes
      not committed.
      
      Reviewed By: tudorb@fb.com
      
      FB internal diff: D1011963
      b604632b
    • Philip Pronin's avatar
      fix a few bugs in FBString · 8c13c0b9
      Philip Pronin authored
      Summary:
      * `push_back()` fails for medium strings of zero capacity if not linked
      with jemalloc (see added test),
      * we incorrectly initiliaze capacity when acquire mallocated string
      (forgot about null terminator).
      
      Test Plan: fbconfig --allocator=malloc folly/test:fbstring_test_using_jemalloc && fbmake runtests_opt
      
      @override-unit-failures
      
      Reviewed By: tudorb@fb.com
      
      FB internal diff: D1012196
      8c13c0b9
    • Jim Meyering's avatar
      folly, tao: don't impose C constraints on folly's Portability.h · 796bfa80
      Jim Meyering authored
      Summary:
      * folly/Portability.h: Move the definitions that Tao uses
      into a new file, and include that new file here.
      * folly/AddressSanitizer.h: New file.
      * tao/server/config.h: Include that small new file, rather
      than all of folly's Portability.h
      
      Test Plan:
      fbconfig -r tao/server &&
      tao/server/tests/run_unit_tests.sh -d --save-log=log
      For folly, watch the arc-run tests.
      
      Reviewed By: pgriess@fb.com
      
      FB internal diff: D1011800
      
      @override-unit-failures
      796bfa80
    • Sathya Gunasekar's avatar
      Include cpp only when needed · 3851f0ea
      Sathya Gunasekar authored
      Summary:
      D1008921 broke compilation for tao which uses folly/Portability.h
      This diff guards the change for only c++ code. Not sure if this breaks the
      definition of portability.
      
      Test Plan: Compile tao, fbconfig -r folly and fbmake runtests
      
      Reviewed By: simpkins@fb.com
      
      FB internal diff: D1010967
      
      @override-unit-failures
      3851f0ea
    • Peter Griess's avatar
      Remove trailing comma in configure.ac. · 040c3387
      Peter Griess authored
      Summary:
      - We were inadvertantly emitting a superfluous comma when generating the
      configure script, causing it warn on execution. This was caused by
      separating two AC_DEFINE() invocations w/ a comma.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: meyering@fb.com
      
      FB internal diff: D1008924
      040c3387
    • Peter Griess's avatar
      Remove check that depends on malloc implementation. · e6c32d1b
      Peter Griess authored
      Summary:
      - The EXPECT_EQ(vec.capacity(), vec2.capacity()) check is implicitly
      testing how the platform's malloc() and malloc_usable_size()
      implementations interact. We know that small_vector will attempt to
      allocate storage for 3 elements via malloc(), but the small_vector
      implementation then uses malloc_usable_size() to determine capacity,
      which can return more than the size requested by malloc(). As a
      result, capacity may grow more than expected depending on how the
      malloc implementation works.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: alandau@fb.com
      
      FB internal diff: D1008922
      e6c32d1b
    • Peter Griess's avatar
      Detect and use std::is_trivially_copyable<T> where possible. · baab3743
      Peter Griess authored
      Summary:
      - Sadly, boost::has_trivial_copy<T> is not a suitable replacement for
      std::is_trivially_copyable<T> on libc++. Fortunately, the latter is
      actually supported (and works), so use it directly.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: delong.j@fb.com
      
      FB internal diff: D1008921
      baab3743
    • Peter Griess's avatar
      Only run FBString.testConstructionFromLiteralZero under GNU libstdc++ · 60f2c87d
      Peter Griess authored
      Summary:
      - This test verifies the behavior of std::string(0), which the GNU
      library expects to throw an std::logic_error. Other libraries may have
      other behaviors; libc++ segfaults.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: simpkins@fb.com
      
      FB internal diff: D1003125
      60f2c87d
    • Peter Griess's avatar
      Set -std=XXX flags earlier; use in AC_COMPILE_IFELSE() · 9d456e4f
      Peter Griess authored
      Summary:
      - We had a bug where AC_COMPILE_IFELSE() invocations weren't using the
      same -std=XXX flags that we're using in our actual build. This
      happened because we made these checks before figuring out which
      flag to use.
      - Stop setting -std=XXX flags in CPPFLAGS. It's only useful for
      CFLAGS/CXXFLAGS.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: meyering@fb.com
      
      FB internal diff: D1003972
      9d456e4f
    • Peter Griess's avatar
      Detect C++ implementations that support constexpr strlen() · e5b563e9
      Peter Griess authored
      Summary:
      - Only declare the Range constructor as a constexpr if strlen() is also
      a constexpr. Otherwise, we'll get compilation errors.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: soren@fb.com
      
      FB internal diff: D1003124
      e5b563e9
    • Peter Griess's avatar
      Check for std::this_thread::sleep_for. · 31005a98
      Peter Griess authored
      Summary:
      - Some installations of libstdc++ don't have this defined. This happens
      if they were built without --enable-libstdcxx-time. Detect this and
      avoid tests that rely on this behavior.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: meyering@fb.com
      
      FB internal diff: D1002963
      31005a98
    • Peter Griess's avatar
      Detect libc++ in configure.ac. · 77cc480d
      Peter Griess authored
      Summary:
      - Explicitly detect use of libc++ in configure.ac and reflect this in
      folly-config.h. Do this rather than looking for to pop up organically
      _LIBCPP_VERSION since this only exists if we've included some libc++
      header files prior to refernce. This isn't always the case, e.g. in
      Portability.h.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: simpkins@fb.com
      
      FB internal diff: D1002958
      77cc480d
    • Peter Griess's avatar
      Use Mach built-ins in lieu of clock_gettime(3) and friends. · 1342be12
      Peter Griess authored
      Summary:
      - Mach doesn't support clock_getres(3) or clock_gettime(3). Provide our
      own implementations by wrapping mach_timebase_info() and
      mach_absolute_time().
      - Detect availability of of -lrt at configure time and don't link with
      it if it's not available. On Linux, this is what provides
      clock_gettime(3) and friends.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: meyering@fb.com
      
      FB internal diff: D999131
      1342be12
    • Nicholas Ormrod's avatar
      Migrating folly to gcc-4.7.1 · d7562b8c
      Nicholas Ormrod authored
      Summary:
      folly/PLATFORM is the last fbcode platform on gcc-4.6.2.
      
      Before pushing, I ran arc unit from my devserver (see Test Plan).
      Phabricator's test run has a lot of aborted test cases, which are
      indicative of a failing test framework. Arc unit had been
      intermittently broken when running my own tests. Overriding
      Phabricator's unit test failures:
      @override-unit-failures
      
      Test Plan:
      (1) fbconfig -r folly/ -- build and runtsts in dbg and opt.
      
      Everything is passing.
      
      (2) arc unit, look at each failed result
      
      Some builds/tests are failing. Most seem unrelated. Of the rest, one is
      also failing on master, and the others did not fail during a second run.
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      FB internal diff: D1005889
      d7562b8c
    • Philip Pronin's avatar
      make IOBuf::coalesce return ByteRange · de0fe30e
      Philip Pronin authored
      Test Plan: fbconfig -r folly/io && fbmake opt -j32 && fbmake runtests_opt
      
      @override-unit-failures
      
      Reviewed By: soren@fb.com
      
      FB internal diff: D1005735
      de0fe30e
  4. 15 Oct, 2013 14 commits
    • Peter Griess's avatar
      Cast lambda to function pointer for boost::split(). · 44365277
      Peter Griess authored
      Summary:
      - For some reason, Boost's internals aren't considering this lambda a
      type that's castable. Cast it to a function pointer before using it.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      - _bin/folly/test/string_test --benchmark
      
      Reviewed By: alandau@fb.com
      
      FB internal diff: D998594
      44365277
    • Peter Griess's avatar
      Be more careful when using SSE intrinsics. · 69b46104
      Peter Griess authored
      Summary:
      - Check FOLLY_HAVE_EMMINTRIN_H before #including it in Range.cpp.
      - The version of Clang that Mac OS X uses for Xcode is based on GCC 4.2.
      It turns out that this does not have a full compliment of SSE2
      builtins (e.g. __builtin_ia32_loaddqu is undefined, but
      __builtin_ia32_storedqu is). Work around this omission by not
      compiling the specialized code on this platform.
      
      @override-unit-failures
      Ignore unit test failures as two tests are just sitting in the postponed
      state forever. I investigated all the other unit test failures and they
      just look like flakey tests.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: delong.j@fb.com
      
      FB internal diff: D999130
      69b46104
    • Peter Griess's avatar
      Fix test for memory allocators that want to look backwards. · e34bc9ca
      Peter Griess authored
      Summary:
      - The NeedleFinderTest.NoSegFault test uses mprotect(2) to ensure that
      our needle implementations don't peek past the end of memory. However,
      some memory allocators (e.g. the defaulton OS X) seem to look at the
      last byte of a page. As a result, if we allocate 2 pages and mark the
      second as PROT_NONE, then ask the memory allocator for 2 more pages,
      it may end up peeking at the last byte of the second page, triggering
      a SIGBUS. To work around this, allocate 8 pages of memory and only
      mark the second as PROT_NONE.
      - Clear mprotect(2) bits before freeing memory.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: delong.j@fb.com
      
      FB internal diff: D998592
      e34bc9ca
    • Peter Griess's avatar
      Handle libc++ usage of inline namespaces for std:: · 2549fb3c
      Peter Griess authored
      Summary:
      - libc++ uses inline namespaces in its implementation of the std
      namespace; use its macros for our forward-declaring needs.
      
      @override-unit-failures
      The hphp_packedtv test has been sitting postponed for a long time. I
      can't repro its failure locally anyway.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: simpkins@fb.com
      
      FB internal diff: D998578
      2549fb3c
    • Peter Griess's avatar
      Use #if rather than #ifdef to check autoconf guards. · 85064d3d
      Peter Griess authored
      Summary:
      - Replace instances of '#ifdef FOLLY_*' guards with '#if FOLLY_*'. This
      allows the configuration system to disable the guard by defining the
      value to 0 using the -D compiler flag.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: delong.j@fb.com
      
      FB internal diff: D999129
      85064d3d
    • bsimmers's avatar
      Turn one more folly::format error into a fatal · 6f335237
      bsimmers authored
      Summary:
      I missed this one in my original diff. It's a static property of the
      format string and the number of arguments passed.
      
      Test Plan:
      automated tests. saw that my buggy format() call aborted instead of throwing an
      exception
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      FB internal diff: D998409
      @override-unit-failures
      6f335237
    • Peter Griess's avatar
      Fix misc compilation errors in ThreadCachedIntTest. · 27ff9a4a
      Peter Griess authored
      Summary:
      - int64_t is a long on x86_64, but a long long on 32-bit.
      - Build a uint64_t from pthread_self() before performing masking on it.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      FB internal diff: D998598
      27ff9a4a
    • Peter Griess's avatar
      Explicitly use !basic_istream::fail() in test. · 209fa4a8
      Peter Griess authored
      Summary:
      - Looks like libc++ doesn't support operator bool() for streams? Use
      !fail() explicitly to work around this.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      FB internal diff: D998596
      209fa4a8
    • Peter Griess's avatar
      Use boost::has_trivial_copy_constructor rather than std. · c103a338
      Peter Griess authored
      Summary:
      - libc++ doesn't ship with this method defined. Just use Boost's version
      of this instead.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: meyering@fb.com
      
      FB internal diff: D998593
      c103a338
    • Peter Griess's avatar
      Avoid static_assert in tuple_element for Clang/libc++ · 6bd1d409
      Peter Griess authored
      Summary:
      - Clang/libc++ has a static_assert that blows when tuple_element is
      invoked with a tuple of length 0. Unfortunately if we embed this
      construct in an enable_if, it still gets evaluated. To work around
      this, wrap this in a last_element struct and specialize the 0-element
      case there explicitly.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      FB internal diff: D998591
      6bd1d409
    • Peter Griess's avatar
      Change ScopeGuardTest to work around libc++'s different terminate() semantics. · 3b3fa008
      Peter Griess authored
      Summary:
      - Looks like the default terminate() in libc++ doesn't reflect the
      exception message to stderr. Instead, it just writes a generic
      message. Reflect that in the test.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      FB internal diff: D998590
      3b3fa008
    • Peter Griess's avatar
      Use RW_SPINLOCK_USE_X86_INTRINSIC_ in RWSpinLockTest · 01d9c7dd
      Peter Griess authored
      Summary:
      - This macro is computed based on whether or not we support x86
      intrinsics in RWSpinLock.h; re-use it rather than re-computing
      this (and getting it wrong).
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: oyamauchi@fb.com
      
      FB internal diff: D998586
      01d9c7dd
    • Peter Griess's avatar
      Disable memory reporting for non-GNU C++ libraries. · d53c9e56
      Peter Griess authored
      Summary:
      - Non-GNU standard C++ libraries may have a different layout; only
      report memory usage when we know we're using GNU's.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      FB internal diff: D998584
      d53c9e56
    • Peter Griess's avatar
      Disable timed sychronization tests on Apple platforms. · b97d804d
      Peter Griess authored
      Summary:
      - Apple doesn't provide timed sychronization primitives. We already
      handle this in Sychronization.h, but our unit tests were being run for
      all platforms.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      FB internal diff: D998581
      b97d804d