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
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
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
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
File::dup

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

@override-unit-failures

Reviewed By: soren@fb.com

FB internal diff: D985595
Tidied up some includes.

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

Test Plan: recompile

Reviewed By: delong.j@fb.com

FB internal diff: D986803
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
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
Add declaration for allocm

Test Plan: compiled

Reviewed By: lucian@fb.com

FB internal diff: D986998
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
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
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
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
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
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
Added initializer_list ctors to sorted_vector_{set,map}

Test Plan: unittest

Reviewed By: tudorb@fb.com

FB internal diff: D987910
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
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
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
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