Folly Changes for Clang, revision 1

Summary:
Depends on D829162 and D830052

A few changes are needed to get folly compiling with clang.
There are likely more changes to compile all of folly

---folly/Bits.cpp
+++folly/folly-config.h
Moved ifunc check, and added an additional check for clang, instead of hard
coding it to be 1

~~~folly/Range.cpp
Moved the declaration of a function to get rid of clang's unused function
warning.

Test Plan:
This bit of code was a dependency in another project.
That code compiled as it needed to

See other diff for more test details

Reviewed By: oyamauchi@fb.com

FB internal diff: D830075
rework the Subprocess::communicate() API

Summary:
This eliminates the CommunicateFlags argument to communicate().  It now
always reads from both stdout and stderr if they were set up a pipes.
If a non-empty input buffer was supplied, it always writes that to
stdin.

This mimics the communicate() behavior of python's subprocess.py module.
This also makes it impossible to have buffering deadlocks by forgetting
to call communicate() with readStderr().

Test Plan:
Ran the existing subprocess tests, and also added a more complicated
duplex test that requires communication on stdin, stdout, and stderr all
at the same time.

Also grepped for all existing users of Subprocess::communicate(), and
made sure they will work correctly with the new behavior.

Reviewed By: tudorb@fb.com

FB internal diff: D814405
folly: accommodate use of -Wshadow in other projects

Summary:
Without this change, any folly-using project that attempts to enable
gcc's -Wshadow option will be overwhelmed by warnings about violations
in folly's class definitions.  Violations are often due to local
variable or parameter names shadowed by a member function.

Bracket offending content with directives like this:

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
...
#pragma GCC diagnostic pop

This set of modified files is the minimal set to allow tao
to use -Wshadow with no folly-related warning.

Test Plan:
fbmake folly/test && fbmake opt

Reviewed By: simpkins@fb.com

FB internal diff: D848455
rename template parameters in folly::greater_than

Summary: This template is only used in folly::Conv (to avoid tautological comparisons) and as best as I can tell, the rhs/lhs names are not correct as it's currently used (and not consistent with `less_than`). Just swap rhs/lhs variable names.

Test Plan:
Test Results Summary:
Passed: 471
100% successful

Reviewed By: marcelo.juchem@fb.com

FB internal diff: D856785
Add MultiLevelTimeSeries to folly.

Summary:
Add MultiLevelTimeSeries class which represents a timeseries which keeps several
levels of data granularity (similar in principle to the loads reported by the
UNIX 'uptime' command).  It uses several instances (one per level) of
BucketedTimeSeries as the underlying storage.

This can easily be used to track sums (and thus rates or averages) over several
predetermined time periods, as well as all-time sums.  For example, you would
use to it to track query rate or response speed over the last 5, 15, 30, and 60
minutes.

Test Plan: unittest included.

Reviewed By: simpkins@fb.com

FB internal diff: D851444
Use libunwind instead of the heavyweight thing from libgcc

Test Plan: exception_tracer_test

Reviewed By: bmaurer@fb.com

FB internal diff: D858195
add Chrono.h to patch around a gcc 4.6 issue

Test Plan: used it

Reviewed By: soren@fb.com

FB internal diff: D859244
StringPiece comparisons are broken

Summary:
8-bit StringPiece comparisons are broken.
The reason is char_traits is magic for 'char', but not 'const char'.

Test Plan: test added

Reviewed By: chip@fb.com

FB internal diff: D861521
Speed up EventCount, now 64-bit only

Summary:
Don't use two atomic variables when only one will suffice (otherwise, the
increments in doNotify() and prepareWait() would require memory_model_seq_cst,
because they need to globally order a store before a load, and no weaker
model allows you to do that)

Of course, this makes this 64-bit only, but I don't care.

Test Plan: eventcount_test, tests outside of folly

Reviewed By: delong.j@fb.com

FB internal diff: D858963
fix tautological comparisons in Conv.h

Summary:
We have an off-by-one in our enable_if/sfinae logic here. We do not want to actually do the comparison in `less_than` when the rhs is exactly the minimum possible lhs. This results in a tautological comparison.

I added a unit test for these traits that test all the various sfinae cases.

Test Plan: See the clang tautological warnings go away. Under gcc, rerun all tests. All pass.

Reviewed By: marcelo.juchem@fb.com

FB internal diff: D856869