folly.git
10 years agoAdded SCOPE_FAIL and SCOPE_SUCCESS macros in non-portable C++.
Daniel Marinescu [Thu, 14 Nov 2013 04:41:24 +0000 (20:41 -0800)]
Added SCOPE_FAIL and SCOPE_SUCCESS macros in non-portable C++.

Summary:
Added SCOPE_FAIL and SCOPE_SUCCESS macros in non-portable C++. The macros are similar to D's scope(failure) and scope(success).
Currently the supported platforms are GCC and MSVC. For all others, std::uncaught_exception() is used, which will fail if the macros are used in a destructor called during stack unwinding.
@override-unit-failures

Test Plan:
1. Added new unit test to ScopeGuardTest.cpp.
2. Ran fbconfig -r folly && fbmake dbg
3. Ran _build/dbg/folly/test/scope_guard_test to make sure my unit test was running and passing.

Reviewed By: andrei.alexandrescu@fb.com

FB internal diff: D1033621

11 years agoAdd missing files to Makefile headers
Yasser Ganjisaffar [Mon, 11 Nov 2013 18:03:16 +0000 (10:03 -0800)]
Add missing files to Makefile headers

Summary:
This two header files are missing from the Makefile which make the
open source version broken.

Test Plan: code using open source version compiles

Reviewed By: meyering@fb.com

FB internal diff: D1050326

11 years agoAdd Formatter::writeTo(FILE*)
Tudor Bosman [Tue, 29 Oct 2013 19:00:50 +0000 (12:00 -0700)]
Add Formatter::writeTo(FILE*)

Summary: Because I needed it.

Test Plan: test added

Reviewed By: delong.j@fb.com

FB internal diff: D1032179

11 years agoUpdate Overview.md
denisspb [Wed, 30 Oct 2013 17:27:00 +0000 (10:27 -0700)]
Update Overview.md

Summary: just added few words about Subprocess.

Reviewed By: delong.j@fb.com

Test Plan: none

11 years agomake move-ctor and destructor noexcept for folly::Optional
Avani Nandini [Tue, 29 Oct 2013 07:11:49 +0000 (00:11 -0700)]
make move-ctor and destructor noexcept for folly::Optional

Summary:
as per summary
@override-unit-failures

Test Plan: run unit tests

Reviewed By: delong.j@fb.com

FB internal diff: D1031726

11 years agoFix passing MoveWrapper into lambdas
Alex Landau [Tue, 29 Oct 2013 21:06:18 +0000 (14:06 -0700)]
Fix passing MoveWrapper into lambdas

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

11 years agoupdating folly makefiles
Dave Watson [Sat, 26 Oct 2013 20:13:26 +0000 (13:13 -0700)]
updating folly makefiles

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

11 years agomove MoveWrapper to folly
Dave Watson [Fri, 25 Oct 2013 19:35:25 +0000 (12:35 -0700)]
move MoveWrapper to folly

Summary: Add MoveWrapper to folly.

@override-unit-failures

Test Plan: arc unit

Reviewed By: hans@fb.com

FB internal diff: D1030005

11 years agoAdd missing define guard for folly-config.h
Sara Golemon [Fri, 25 Oct 2013 20:57:53 +0000 (13:57 -0700)]
Add missing define guard for folly-config.h

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

11 years agoAdd missing include
Sara Golemon [Thu, 24 Oct 2013 21:40:22 +0000 (14:40 -0700)]
Add missing include

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

11 years agofix typo in comment
Andrey Goder [Mon, 21 Oct 2013 22:48:26 +0000 (15:48 -0700)]
fix typo in comment

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

11 years agoexponential capacity growth for io::TypedIOBuf
Philip Pronin [Thu, 17 Oct 2013 03:13:33 +0000 (20:13 -0700)]
exponential capacity growth for io::TypedIOBuf

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

11 years agoavoid using ifunc + ASan
Philip Pronin [Wed, 16 Oct 2013 07:01:53 +0000 (00:01 -0700)]
avoid using ifunc + ASan

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

11 years agoIssue with find and npos
Rajat Goel [Wed, 16 Oct 2013 00:25:36 +0000 (17:25 -0700)]
Issue with find and npos

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

11 years agoChange FBString's #define throw
Nicholas Ormrod [Wed, 16 Oct 2013 00:02:24 +0000 (17:02 -0700)]
Change FBString's #define throw

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

11 years agofix a few bugs in FBString
Philip Pronin [Tue, 15 Oct 2013 21:39:44 +0000 (14:39 -0700)]
fix a few bugs in FBString

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

11 years agofolly, tao: don't impose C constraints on folly's Portability.h
Jim Meyering [Tue, 15 Oct 2013 17:23:46 +0000 (10:23 -0700)]
folly, tao: don't impose C constraints on folly's Portability.h

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

11 years agoInclude cpp only when needed
Sathya Gunasekar [Tue, 15 Oct 2013 02:50:20 +0000 (19:50 -0700)]
Include cpp only when needed

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

11 years agoRemove trailing comma in configure.ac.
Peter Griess [Sat, 12 Oct 2013 12:12:57 +0000 (05:12 -0700)]
Remove trailing comma in configure.ac.

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

11 years agoRemove check that depends on malloc implementation.
Peter Griess [Thu, 10 Oct 2013 17:51:28 +0000 (10:51 -0700)]
Remove check that depends on malloc implementation.

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

11 years agoDetect and use std::is_trivially_copyable<T> where possible.
Peter Griess [Thu, 10 Oct 2013 17:12:00 +0000 (10:12 -0700)]
Detect and use std::is_trivially_copyable<T> where possible.

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

11 years agoOnly run FBString.testConstructionFromLiteralZero under GNU libstdc++
Peter Griess [Wed, 9 Oct 2013 08:24:28 +0000 (01:24 -0700)]
Only run FBString.testConstructionFromLiteralZero under GNU libstdc++

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

11 years agoSet -std=XXX flags earlier; use in AC_COMPILE_IFELSE()
Peter Griess [Wed, 9 Oct 2013 18:50:05 +0000 (11:50 -0700)]
Set -std=XXX flags earlier; use in AC_COMPILE_IFELSE()

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

11 years agoDetect C++ implementations that support constexpr strlen()
Peter Griess [Wed, 9 Oct 2013 06:01:34 +0000 (23:01 -0700)]
Detect C++ implementations that support constexpr strlen()

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

11 years agoCheck for std::this_thread::sleep_for.
Peter Griess [Wed, 9 Oct 2013 03:57:32 +0000 (20:57 -0700)]
Check for std::this_thread::sleep_for.

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

11 years agoDetect libc++ in configure.ac.
Peter Griess [Tue, 8 Oct 2013 23:57:39 +0000 (16:57 -0700)]
Detect libc++ in configure.ac.

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

11 years agoUse Mach built-ins in lieu of clock_gettime(3) and friends.
Peter Griess [Mon, 23 Sep 2013 21:22:58 +0000 (16:22 -0500)]
Use Mach built-ins in lieu of clock_gettime(3) and friends.

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

11 years agoMigrating folly to gcc-4.7.1
Nicholas Ormrod [Fri, 11 Oct 2013 22:33:07 +0000 (15:33 -0700)]
Migrating folly to gcc-4.7.1

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

11 years agomake IOBuf::coalesce return ByteRange
Philip Pronin [Thu, 10 Oct 2013 19:12:36 +0000 (12:12 -0700)]
make IOBuf::coalesce return ByteRange

Test Plan: fbconfig -r folly/io && fbmake opt -j32 && fbmake runtests_opt

@override-unit-failures

Reviewed By: soren@fb.com

FB internal diff: D1005735

11 years agoCast lambda to function pointer for boost::split().
Peter Griess [Thu, 26 Sep 2013 15:05:57 +0000 (10:05 -0500)]
Cast lambda to function pointer for boost::split().

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

11 years agoBe more careful when using SSE intrinsics.
Peter Griess [Sat, 21 Sep 2013 16:40:58 +0000 (11:40 -0500)]
Be more careful when using SSE intrinsics.

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

11 years agoFix test for memory allocators that want to look backwards.
Peter Griess [Thu, 26 Sep 2013 18:27:05 +0000 (13:27 -0500)]
Fix test for memory allocators that want to look backwards.

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

11 years agoHandle libc++ usage of inline namespaces for std::
Peter Griess [Tue, 10 Sep 2013 16:36:38 +0000 (11:36 -0500)]
Handle libc++ usage of inline namespaces for std::

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

11 years agoUse #if rather than #ifdef to check autoconf guards.
Peter Griess [Mon, 7 Oct 2013 15:38:11 +0000 (08:38 -0700)]
Use #if rather than #ifdef to check autoconf guards.

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

11 years agoTurn one more folly::format error into a fatal
bsimmers [Sat, 5 Oct 2013 02:46:40 +0000 (19:46 -0700)]
Turn one more folly::format error into a fatal

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

11 years agoFix misc compilation errors in ThreadCachedIntTest.
Peter Griess [Thu, 26 Sep 2013 14:25:58 +0000 (09:25 -0500)]
Fix misc compilation errors in ThreadCachedIntTest.

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

11 years agoExplicitly use !basic_istream::fail() in test.
Peter Griess [Thu, 26 Sep 2013 13:55:12 +0000 (08:55 -0500)]
Explicitly use !basic_istream::fail() in test.

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

11 years agoUse boost::has_trivial_copy_constructor rather than std.
Peter Griess [Tue, 10 Sep 2013 20:19:34 +0000 (15:19 -0500)]
Use boost::has_trivial_copy_constructor rather than std.

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

11 years agoAvoid static_assert in tuple_element for Clang/libc++
Peter Griess [Thu, 26 Sep 2013 02:07:50 +0000 (21:07 -0500)]
Avoid static_assert in tuple_element for Clang/libc++

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

11 years agoChange ScopeGuardTest to work around libc++'s different terminate() semantics.
Peter Griess [Thu, 26 Sep 2013 18:43:15 +0000 (13:43 -0500)]
Change ScopeGuardTest to work around libc++'s different terminate() semantics.

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

11 years agoUse RW_SPINLOCK_USE_X86_INTRINSIC_ in RWSpinLockTest
Peter Griess [Thu, 26 Sep 2013 14:35:29 +0000 (09:35 -0500)]
Use RW_SPINLOCK_USE_X86_INTRINSIC_ in RWSpinLockTest

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

11 years agoDisable memory reporting for non-GNU C++ libraries.
Peter Griess [Mon, 23 Sep 2013 21:44:57 +0000 (16:44 -0500)]
Disable memory reporting for non-GNU C++ libraries.

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

11 years agoDisable timed sychronization tests on Apple platforms.
Peter Griess [Thu, 26 Sep 2013 14:53:39 +0000 (09:53 -0500)]
Disable timed sychronization tests on Apple platforms.

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

11 years agoAdd missing #include <vector>.
Peter Griess [Mon, 23 Sep 2013 21:32:05 +0000 (16:32 -0500)]
Add missing #include <vector>.

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

11 years agoApple defines MAP_ANON, not MAP_ANONYMOUS
Peter Griess [Thu, 26 Sep 2013 15:09:19 +0000 (10:09 -0500)]
Apple defines MAP_ANON, not MAP_ANONYMOUS

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

11 years agoLink spooky hash tests missing libfollybenchmark.a.
Peter Griess [Fri, 4 Oct 2013 23:48:25 +0000 (18:48 -0500)]
Link spooky hash tests missing libfollybenchmark.a.

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

11 years agoClean up platform-dependant format strings.
Peter Griess [Mon, 23 Sep 2013 21:38:05 +0000 (16:38 -0500)]
Clean up platform-dependant format strings.

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

11 years agoOnly run eventfd tests on Linux.
Peter Griess [Thu, 26 Sep 2013 14:20:24 +0000 (09:20 -0500)]
Only run eventfd tests on Linux.

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

11 years agoFix ifunc test in configure.ac to make unknown attribute warnings fatal.
Peter Griess [Tue, 10 Sep 2013 20:33:09 +0000 (15:33 -0500)]
Fix ifunc test in configure.ac to make unknown attribute warnings fatal.

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

11 years agoPass 'nostdinc' to AM_INIT_AUTOMAKE().
Peter Griess [Fri, 20 Sep 2013 21:00:49 +0000 (16:00 -0500)]
Pass 'nostdinc' to AM_INIT_AUTOMAKE().

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

11 years agoClean up use of Boost and PThread libraries.
Peter Griess [Mon, 23 Sep 2013 16:47:58 +0000 (09:47 -0700)]
Clean up use of Boost and PThread libraries.

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

11 years agoAdd missing ax_boost_system.m4.
Peter Griess [Mon, 23 Sep 2013 22:48:56 +0000 (17:48 -0500)]
Add missing ax_boost_system.m4.

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

11 years agoAdded initializer_list ctors to sorted_vector_{set,map}
Soren Lassen [Fri, 27 Sep 2013 19:23:06 +0000 (12:23 -0700)]
Added initializer_list ctors to sorted_vector_{set,map}

Test Plan: unittest

Reviewed By: tudorb@fb.com

FB internal diff: D987910

11 years agoSupport constexpr StringPiece.
Soren Lassen [Sun, 29 Sep 2013 00:53:52 +0000 (17:53 -0700)]
Support constexpr StringPiece.

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

11 years agoAdd MaxString<__uint128_t>
Tim Hanson [Thu, 3 Oct 2013 20:17:10 +0000 (13:17 -0700)]
Add MaxString<__uint128_t>

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

11 years agoAdd bad input to Uri in exception messages
Rajat Goel [Wed, 2 Oct 2013 03:07:23 +0000 (20:07 -0700)]
Add bad input to Uri in exception messages

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

11 years agoadd functions to return string's internal pointers
Louis Brandy [Wed, 11 Sep 2013 16:15:59 +0000 (09:15 -0700)]
add functions to return string's internal pointers

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

11 years agoAdd a comment about takeOwnership()
Daniel Sommermann [Mon, 30 Sep 2013 21:02:07 +0000 (14:02 -0700)]
Add a comment about takeOwnership()

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

11 years agoFix bad bug in folly::ThreadLocal
Tudor Bosman [Fri, 27 Sep 2013 00:19:24 +0000 (17:19 -0700)]
Fix bad bug in folly::ThreadLocal

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

11 years agoAdd declaration for allocm
Tudor Bosman [Fri, 27 Sep 2013 00:19:01 +0000 (17:19 -0700)]
Add declaration for allocm

Test Plan: compiled

Reviewed By: lucian@fb.com

FB internal diff: D986998

11 years agoadd test for numeric -> string conversions
Louis Brandy [Fri, 27 Sep 2013 17:02:51 +0000 (10:02 -0700)]
add test for numeric -> string conversions

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

11 years agodynamic::get_ptr
Tom Jackson [Fri, 27 Sep 2013 00:12:38 +0000 (17:12 -0700)]
dynamic::get_ptr

Summary: For testing containment and using the value in one operation.

Test Plan: Unit tests

Reviewed By: tudorb@fb.com

FB internal diff: D986986

11 years agoTidied up some includes.
Nicholas Ormrod [Thu, 26 Sep 2013 23:33:38 +0000 (16:33 -0700)]
Tidied up some includes.

Summary: Changed #include "..." to #include <...> where possible.

Test Plan: recompile

Reviewed By: delong.j@fb.com

FB internal diff: D986803

11 years agoFile::dup
Philip Pronin [Thu, 26 Sep 2013 08:45:07 +0000 (01:45 -0700)]
File::dup

Test Plan: fbconfig -r folly && fbmake opt -j32

@override-unit-failures

Reviewed By: soren@fb.com

FB internal diff: D985595

11 years agoFix performance issues with folly::Uri::authority().
Stephane Sezer [Wed, 25 Sep 2013 17:50:46 +0000 (10:50 -0700)]
Fix performance issues with folly::Uri::authority().

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

11 years agoAdd noexcept specification for move ctor, move assignment, dtor in fbstring
Tudor Bosman [Tue, 24 Sep 2013 23:49:24 +0000 (16:49 -0700)]
Add noexcept specification for move ctor, move assignment, dtor in fbstring

Test Plan: fbstring_test, test added

Reviewed By: ngbronson@fb.com

FB internal diff: D983278

11 years agofolly: add a FOLLY_SANITIZE_ADDRESS macro to Portability.h
Andrew Gallagher [Fri, 20 Sep 2013 11:28:39 +0000 (04:28 -0700)]
folly: add a FOLLY_SANITIZE_ADDRESS macro to Portability.h

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

11 years agoAdd an authority() method to folly::Uri.
Stephane Sezer [Mon, 23 Sep 2013 21:42:11 +0000 (14:42 -0700)]
Add an authority() method to folly::Uri.

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

11 years agodeprecating boost::shared_ptr
Louis Brandy [Fri, 16 Aug 2013 22:19:09 +0000 (15:19 -0700)]
deprecating boost::shared_ptr

Summary:
Replacing boost::shared_ptr with std::shared_ptr.

Test Plan: .

Reviewed By: andrei.alexandrescu@fb.com

FB internal diff: D932119

11 years agoFix small race in subprocess_test
Tudor Bosman [Sun, 22 Sep 2013 02:03:20 +0000 (19:03 -0700)]
Fix small race in subprocess_test

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

11 years agoAdd various functions to wrapNoInt
Tudor Bosman [Wed, 18 Sep 2013 23:16:22 +0000 (16:16 -0700)]
Add various functions to wrapNoInt

Test Plan: used them

Reviewed By: soren@fb.com

FB internal diff: D976393

11 years agoFixed-size atomic bitset
Tudor Bosman [Tue, 17 Sep 2013 00:27:30 +0000 (17:27 -0700)]
Fixed-size atomic bitset

Summary: No magic; what it says on the package.

Test Plan: atomic_bitset_test

Reviewed By: delong.j@fb.com

FB internal diff: D971875

11 years agoParametrize allocator in AtomicHash{Array,Map}
Max Wang [Thu, 19 Sep 2013 20:47:22 +0000 (13:47 -0700)]
Parametrize allocator in AtomicHash{Array,Map}

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

11 years agoMake folly::Uri::port() return uint16_t instead of uint32_t.
Stephane Sezer [Thu, 19 Sep 2013 19:19:26 +0000 (12:19 -0700)]
Make folly::Uri::port() return uint16_t instead of uint32_t.

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

11 years agoRemove problematic log lines from folly JSON test.
Stephane Sezer [Wed, 18 Sep 2013 23:37:49 +0000 (16:37 -0700)]
Remove problematic log lines from folly JSON test.

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

11 years agofix minor typo in comment
Andrey Goder [Mon, 16 Sep 2013 17:43:15 +0000 (10:43 -0700)]
fix minor typo in comment

Test Plan: n/a

Reviewed By: delong.j@fb.com

FB internal diff: D970791

11 years agoAsyncIO::initializeContext() should provide more debug output when io_queue_init...
Altan Alpay [Thu, 12 Sep 2013 21:08:01 +0000 (14:08 -0700)]
AsyncIO::initializeContext() should provide more debug output when io_queue_init fails

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

11 years agofix memcpy-param-overlap (asan) in GroupVarint
Philip Pronin [Tue, 10 Sep 2013 13:24:40 +0000 (06:24 -0700)]
fix memcpy-param-overlap (asan) in GroupVarint

Test Plan: .

Reviewed By: tudorb@fb.com

FB internal diff: D962972

11 years agofolly: don't inline functions with ASAN disabled
Andrew Gallagher [Tue, 10 Sep 2013 20:22:22 +0000 (13:22 -0700)]
folly: don't inline functions with ASAN disabled

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

11 years agorange checks in DynamicConverter
Nicholas Ormrod [Tue, 10 Sep 2013 16:59:04 +0000 (09:59 -0700)]
range checks in DynamicConverter

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

11 years agodisable asan for qfind_first_byte_of_needles16
Philip Pronin [Tue, 10 Sep 2013 13:25:53 +0000 (06:25 -0700)]
disable asan for qfind_first_byte_of_needles16

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

11 years agofix heap-buffer-overflow (asan) in EliasFanoCoding
Philip Pronin [Tue, 10 Sep 2013 13:21:36 +0000 (06:21 -0700)]
fix heap-buffer-overflow (asan) in EliasFanoCoding

Test Plan:
fbconfig folly/experimental/test:elias_fano_test && fbmake runtests_opt

Reviewed By: tudorb@fb.com

FB internal diff: D962971

11 years agoSome fixes for building stuff with clang
Jordan DeLong [Wed, 4 Sep 2013 01:52:52 +0000 (18:52 -0700)]
Some fixes for building stuff with clang

@override-unit-failures

Summary: Not that much.

Test Plan:
Compiled hphp with clang.

Reviewed By: oyamauchi@fb.com

FB internal diff: D954663

11 years agofolly: disable address sanitizer warnings on fbstring
Andrew Gallagher [Tue, 3 Sep 2013 07:26:59 +0000 (00:26 -0700)]
folly: disable address sanitizer warnings on fbstring

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

11 years agoabort instead of throwing an exception on bad format strings
bsimmers [Tue, 27 Aug 2013 23:27:09 +0000 (16:27 -0700)]
abort instead of throwing an exception on bad format strings

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

11 years agox86intrinsic seems to be problematic for clang
Dave Watson [Thu, 29 Aug 2013 22:40:57 +0000 (15:40 -0700)]
x86intrinsic seems to be problematic for clang

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

11 years agoFix insignificant CRTP bug
Tudor Bosman [Thu, 29 Aug 2013 00:46:16 +0000 (17:46 -0700)]
Fix insignificant CRTP bug

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

11 years agofix folly build on OSX with gcc 4.8
Sean Cannella [Thu, 29 Aug 2013 16:16:54 +0000 (09:16 -0700)]
fix folly build on OSX with gcc 4.8

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

11 years agofolly::io::QueueAppender speedup
Tudor Bosman [Wed, 28 Aug 2013 01:31:27 +0000 (18:31 -0700)]
folly::io::QueueAppender speedup

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

11 years agoUpdate build for Ubuntu 12.10. 12.04 seems to no longer compile
Dave Watson [Mon, 22 Apr 2013 22:05:36 +0000 (15:05 -0700)]
Update build for Ubuntu 12.10. 12.04 seems to no longer compile

Summary: Dave Watson put this in github a few months ago.

Test Plan: None

Reviewed By: delong.j@fb.com

FB internal diff: D912681

11 years agoUnbreak build: -Werror=pragmas (srsly)
Tudor Bosman [Tue, 27 Aug 2013 19:17:48 +0000 (12:17 -0700)]
Unbreak build: -Werror=pragmas (srsly)

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

11 years agoExpand the range where uninitialized warnings are ignored
Tudor Bosman [Tue, 27 Aug 2013 04:39:36 +0000 (21:39 -0700)]
Expand the range where uninitialized warnings are ignored

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

11 years agofolly: adjust more headers to be -Wshadow-clean
Jim Meyering [Sat, 24 Aug 2013 02:46:09 +0000 (19:46 -0700)]
folly: adjust more headers to be -Wshadow-clean

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

11 years agounbreak build
Tudor Bosman [Sat, 24 Aug 2013 00:14:08 +0000 (17:14 -0700)]
unbreak build

Test Plan: built producer_consumer_queue_test with gcc 4.7.1
@override-unit-failures

Reviewed By: chip@fb.com

FB internal diff: D942465

11 years agoUse boost:has_trivial_destructor instead of std::...
Sara Golemon [Fri, 23 Aug 2013 23:22:09 +0000 (16:22 -0700)]
Use boost:has_trivial_destructor instead of std::...

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

11 years agostd::map and std::set are not relocatable
Tudor Bosman [Thu, 22 Aug 2013 14:26:48 +0000 (07:26 -0700)]
std::map and std::set are not relocatable

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

11 years agofolly: improve Subprocess::enforce() error message
Lucian Grijincu [Tue, 20 Aug 2013 22:50:39 +0000 (15:50 -0700)]
folly: improve Subprocess::enforce() error message

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

11 years agomake StringGen clang-compatible
Philip Pronin [Tue, 20 Aug 2013 10:18:39 +0000 (03:18 -0700)]
make StringGen clang-compatible

Test Plan:
fbconfig -r folly/test && fbmake opt -j32

Reviewed By: tjackson@fb.com

FB internal diff: D935182

11 years agoretry flock() if interrupted (EINTR)
Philip Pronin [Sat, 17 Aug 2013 09:06:35 +0000 (02:06 -0700)]
retry flock() if interrupted (EINTR)

Test Plan: fbconfig folly/test:file_test && fbmake runtests_opt

Reviewed By: soren@fb.com

FB internal diff: D932782

11 years agoFix overeager assertion
Tudor Bosman [Thu, 15 Aug 2013 21:49:47 +0000 (14:49 -0700)]
Fix overeager assertion

Summary: Also important spelling mistakes.
@override-unit-failures

Test Plan: string_test

Reviewed By: tjackson@fb.com

FB internal diff: D930037