quiet -Wmaybe-uninitialized
authorLouis Brandy <ldbrandy@fb.com>
Thu, 3 Nov 2016 17:35:18 +0000 (10:35 -0700)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Thu, 3 Nov 2016 17:38:39 +0000 (10:38 -0700)
Summary: gcc-4.9 doesn't appreciate this clever loop and worries about `prev` being uninitialized on first use. Assuming the rest of the program behaves properly and preserves the invariant this code is expecting, this isn't bugged. But let's initialize it anyway.

Reviewed By: meyering

Differential Revision: D4120746

fbshipit-source-id: 1a7c323a4b6296a81768a62dd7d72337c5c35bf0

folly/stats/MultiLevelTimeSeries-defs.h

index f20305a73b3fea658aa5363c1b250ec42f2f279a..3e8c853d66c6b1799a0ec1e5ce2fd943ccea5753 100644 (file)
@@ -50,7 +50,7 @@ MultiLevelTimeSeries<VT, CT>::MultiLevelTimeSeries(
 
   levels_.reserve(durations.size());
   int i = 0;
-  Duration prev;
+  Duration prev{0};
   for (auto dur : durations) {
     if (dur == Duration(0)) {
       CHECK_EQ(i, durations.size() - 1);