Fixing static initilize fiasco in Benchmark.cpp
authorMaxim Sokolov <maxim@fb.com>
Tue, 2 Dec 2014 00:03:36 +0000 (16:03 -0800)
committerDave Watson <davejwatson@fb.com>
Thu, 11 Dec 2014 15:59:11 +0000 (07:59 -0800)
commitc5dea7b63c6727382c9d6383e1cdc58f7cf1e290
tree2481ad697ae3251705bb7cf8e2b8c5a65a442c4e
parentd904cfb90748db6f792291b9e84cd87ce26a9d50
Fixing static initilize fiasco in Benchmark.cpp

Summary:
Benchmark.cpp code is dependent on initialization order, which leads
to benchmarks not running. The root cause is that on some linkers the code which
adds benchmarks to the benchmarks vector is run before the vector initialization.

The original bug report: https://github.com/facebook/folly/issues/18
See: http://www.parashift.com/c++-faq-lite/static-init-order.html

Test Plan: run benchmark_test and compare result with master output

Reviewed By: andrei.alexandrescu@fb.com, njormrod@fb.com

Subscribers: trunkagent, sdwilsh, folly-diffs@

FB internal diff: D1710588

Signature: t1:1710588:1417468175:fd2705a573cef5c4ff020b60c6aec3d83bcdbbab
folly/Benchmark.cpp