1. 15 Oct, 2013 38 commits
    • 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
    • Peter Griess's avatar
      Add missing #include <vector>. · cf2bae35
      Peter Griess authored
      Summary: - What it says.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      FB internal diff: D998579
      cf2bae35
    • Peter Griess's avatar
      Apple defines MAP_ANON, not MAP_ANONYMOUS · c8b43b85
      Peter Griess authored
      Summary:
      - Linux considers MAP_ANON deprecated, but it's all that Apple defines.
      Manually set up a mapping of one to the other.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: mwang@fb.com
      
      FB internal diff: D998511
      c8b43b85
    • Peter Griess's avatar
      Link spooky hash tests missing libfollybenchmark.a. · ec07828f
      Peter Griess authored
      Summary: - This test uses the benchmarking library, which it wasn't linking; fix.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: delong.j@fb.com
      
      FB internal diff: D998510
      ec07828f
    • Peter Griess's avatar
      Clean up platform-dependant format strings. · 41c4a7b2
      Peter Griess authored
      Summary:
      - Use PRIu64 and friends from <cinttypes> to handle uint64_t requiring
      different format strings on different platforms.
      - Fix lint errors.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: simpkins@fb.com
      
      FB internal diff: D998512
      41c4a7b2
    • Peter Griess's avatar
      Only run eventfd tests on Linux. · 8ae12a8e
      Peter Griess authored
      Summary:
      - Detect Linux and define the HAVE_LINUX autoconf macro. Use this to
      elide eventfd tests in tests/Makefile.am.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: delong.j@fb.com
      
      FB internal diff: D998507
      8ae12a8e
    • Peter Griess's avatar
      Fix ifunc test in configure.ac to make unknown attribute warnings fatal. · c6e51ca2
      Peter Griess authored
      Summary:
      - By default, GCC only warns on unknown attributes. As a result our
      FOLLY_HAVE_IFUNC test doesn't actually catch instances where we don't
      support this.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: oyamauchi@fb.com
      
      FB internal diff: D998506
      c6e51ca2
    • Peter Griess's avatar
      Pass 'nostdinc' to AM_INIT_AUTOMAKE(). · 1a732b02
      Peter Griess authored
      Summary:
      - On hosts with case-insensitive filesystems, adding folly/ directory to
      the include path causes String.h to get picked up as <string.h>. Add
      'nostdinc' to the AM_INIT_AUTOMAKE() invocation to remove these
      standard includes from the set of compile flags.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: delong.j@fb.com
      
      FB internal diff: D998505
      1a732b02
    • Peter Griess's avatar
      Clean up use of Boost and PThread libraries. · de4088dd
      Peter Griess authored
      Summary:
      - Use AM_LDFLAGS rather than AM_CXXFLAGS to link against Boost.
      - Link against $(BOOST_REGEX_LIB) in addition to other Boost libs.
      - Add $(BOOST_LDFLAGS) to AM_LDFLAGS so that we get the library path
      that we configured Boost to use.
      - Add -lpthread to AM_LDFLAGS rather than ad-hoc '-lpthread' additions
      to various library builds.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: oyamauchi@fb.com
      
      FB internal diff: D998504
      de4088dd
    • Peter Griess's avatar
      Add missing ax_boost_system.m4. · 28312163
      Peter Griess authored
      Summary:
      - Link ConcurrentSkiplistBenchmark with $(BOOST_SYSTEM_LIB) to resolve
      linker errors for boost::system symbols.
      
      Test Plan:
      - fbconfig -r folly && fbmake runtests
      - ./configure && make check on Ubuntu/FC/Mac
      
      Reviewed By: oyamauchi@fb.com
      
      FB internal diff: D998503
      28312163
    • Soren Lassen's avatar
      Added initializer_list ctors to sorted_vector_{set,map} · 1db90a14
      Soren Lassen authored
      Test Plan: unittest
      
      Reviewed By: tudorb@fb.com
      
      FB internal diff: D987910
      1db90a14
    • Soren Lassen's avatar
      Support constexpr StringPiece. · 21f20989
      Soren Lassen authored
      Test Plan: fbconfig folly/test --platform=gcc-4.8.1-glibc-2.17 && fbmake dbg _bin/folly/test/range_test && _bin/folly/test/range_test
      
      Reviewed By: tudorb@fb.com
      
      FB internal diff: D989142
      21f20989
    • Tim Hanson's avatar
      Add MaxString<__uint128_t> · 14fde8ae
      Tim Hanson authored
      Summary: For GCC 3.6+, define a template specialization for MaxString<__uint128_t>.
      
      @override-unit-failures
      
      Test Plan: Unit tests
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      FB internal diff: D995290
      14fde8ae
    • Rajat Goel's avatar
      Add bad input to Uri in exception messages · 3437a028
      Rajat Goel authored
      Summary:
      It helps if you can directly see the offending URI from the error
      message (specially when you dont want to handle errors and let process crash).
      
      @override-unit-failures
      
      Test Plan: unit-tests
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      FB internal diff: D993025
      3437a028
    • Louis Brandy's avatar
      add functions to return string's internal pointers · e3a49e3d
      Louis Brandy authored
      Summary: See title. This avoids unnecessary copies when needing to access string data directly. These will throw if the dynamic isn't a string.
      
      @override-unit-failures
      
      Test Plan: Unit test.
      
      Reviewed By: delong.j@fb.com
      
      FB internal diff: D986331
      e3a49e3d
    • Daniel Sommermann's avatar
      Add a comment about takeOwnership() · 524d0e74
      Daniel Sommermann authored
      Summary:
      It is dangerous to pass memory into an IOBuf since usually in C++
      programs, memory is allocated using `new`, while IOBuf by default frees
      memory that it has taken ownership of with `free()`. For now, add a
      comment warning about this (address sanitizer will warn you about this
      when it happens in a live process).
      
      Test Plan: NA
      
      Reviewed By: tudorb@fb.com
      
      FB internal diff: D990056
      
      @override-unit-failures
      524d0e74
    • Tudor Bosman's avatar
      Fix bad bug in folly::ThreadLocal · 762965ce
      Tudor Bosman authored
      Summary:
      There were a few bugs, actually:
      
      1. prevSize < jemallocMinInPlaceExpandable compared an element count with
      a byte size; this hid the next bug for a while (as we needed 4096
      ThreadLocalPtr objects in order to trigger it)
      
      2. if rallocm(... ALLOCM_NO_MOVE) succeeds in expanding in place, we don't
      increment elementsCapacity_, which is bad.
      
      Switched to allocm() so we always take advantage of all memory that was
      actually allocated.
      
      @override-unit-failures
      Clearly unrelated
      +Warning: This development build of composer is over 30 days old. It
      is recommended to update it by running
      "hphp/test/slow/ext_phar/composer.php self-update" to get the latest
      version.
      
      Test Plan: test added, which failed before and doesn't any more
      
      Reviewed By: lucian@fb.com
      
      FB internal diff: D987009
      762965ce
    • Tudor Bosman's avatar
      Add declaration for allocm · 6d372314
      Tudor Bosman authored
      Test Plan: compiled
      
      Reviewed By: lucian@fb.com
      
      FB internal diff: D986998
      6d372314
    • Louis Brandy's avatar
      add test for numeric -> string conversions · 442a46c3
      Louis Brandy authored
      Summary: We don't test this functionality (pulling a number out as a string). Almost commited a bug this would have caught.
      
      Test Plan: Run the test.
      
      Reviewed By: delong.j@fb.com
      
      FB internal diff: D987607
      442a46c3
    • Tom Jackson's avatar
      dynamic::get_ptr · 7eccc5a3
      Tom Jackson authored
      Summary: For testing containment and using the value in one operation.
      
      Test Plan: Unit tests
      
      Reviewed By: tudorb@fb.com
      
      FB internal diff: D986986
      7eccc5a3
    • Nicholas Ormrod's avatar
      Tidied up some includes. · e32d53e9
      Nicholas Ormrod authored
      Summary: Changed #include "..." to #include <...> where possible.
      
      Test Plan: recompile
      
      Reviewed By: delong.j@fb.com
      
      FB internal diff: D986803
      e32d53e9
    • Philip Pronin's avatar
      File::dup · c7854d92
      Philip Pronin authored
      Test Plan: fbconfig -r folly && fbmake opt -j32
      
      @override-unit-failures
      
      Reviewed By: soren@fb.com
      
      FB internal diff: D985595
      c7854d92
    • Stephane Sezer's avatar
      Fix performance issues with folly::Uri::authority(). · 2c3828bc
      Stephane Sezer authored
      Summary: String concatenation was not performed correctly in folly::Uri::authority(). This commit fixes the issue by pre-allocating enough space and buliding the string left to right.
      
      Test Plan: Unit tests in folly/test.
      
      Reviewed By: tudorb@fb.com
      
      FB internal diff: D981069
      2c3828bc
    • Tudor Bosman's avatar
      Add noexcept specification for move ctor, move assignment, dtor in fbstring · cca262b3
      Tudor Bosman authored
      Test Plan: fbstring_test, test added
      
      Reviewed By: ngbronson@fb.com
      
      FB internal diff: D983278
      cca262b3
    • Andrew Gallagher's avatar
      folly: add a FOLLY_SANITIZE_ADDRESS macro to Portability.h · d3468ea8
      Andrew Gallagher authored
      Summary:
      Defines a macro to portably test whether address sanitizer is
      enabled across the different compilers we use.
      
      Test Plan:
      Compiled source file with address sanitizer and verified macro
      was defined.
      
      Reviewed By: delong.j@fb.com
      
      FB internal diff: D978196
      d3468ea8
    • Stephane Sezer's avatar
      Add an authority() method to folly::Uri. · 464cc74d
      Stephane Sezer authored
      Summary: facebook::strings::URL has an authority() method. Having the same thing for folly::Uri help converting users of the URL class. This method just takes username, password, host, and port, and builds a string in the form <username>:<password>@<host>:<port>.
      
      Test Plan: None.
      
      Reviewed By: rajat@fb.com
      
      FB internal diff: D977450
      464cc74d
  2. 22 Sep, 2013 2 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