Fix issues under caffe round 1
Summary: Some automation to fix uninitialized members for caffe2 code. Ran canary to make sure I don't have any regression in prod, but not sure how to test comprehensively for caffe2
Reviewed By: ezyang
Differential Revision: D13776185
fbshipit-source-id: fb2a479971cc0276d8784be1c44f01252410bd24
diff --git a/c10/util/Logging.h b/c10/util/Logging.h
index 2b082d0..2d39d21 100644
--- a/c10/util/Logging.h
+++ b/c10/util/Logging.h
@@ -168,7 +168,7 @@
}
private:
- std::string* msg_;
+ std::string* msg_{};
};
#define BINARY_COMP_HELPER(name, op) \
diff --git a/caffe2/core/db.h b/caffe2/core/db.h
index ff7461a..385f736 100644
--- a/caffe2/core/db.h
+++ b/caffe2/core/db.h
@@ -282,8 +282,8 @@
unique_ptr<DB> db_;
unique_ptr<Cursor> cursor_;
mutable std::mutex reader_mutex_;
- uint32_t num_shards_;
- uint32_t shard_id_;
+ uint32_t num_shards_{};
+ uint32_t shard_id_{};
C10_DISABLE_COPY_AND_ASSIGN(DBReader);
};
diff --git a/caffe2/core/event.h b/caffe2/core/event.h
index f991daa..0f43197 100644
--- a/caffe2/core/event.h
+++ b/caffe2/core/event.h
@@ -229,7 +229,7 @@
#ifdef CAFFE2_USE_EXCEPTION_PTR
std::exception_ptr caught_exception_;
- int64_t exception_timestamp_;
+ int64_t exception_timestamp_{};
#endif // CAFFE2_USE_EXCEPTION_PTR
static EventCreateFunction event_creator_[MaxDeviceTypes];
diff --git a/caffe2/core/workspace.h b/caffe2/core/workspace.h
index 8aca51d..c54e947 100644
--- a/caffe2/core/workspace.h
+++ b/caffe2/core/workspace.h
@@ -308,7 +308,7 @@
}
public:
- std::atomic<int> last_failed_op_net_position;
+ std::atomic<int> last_failed_op_net_position{};
private:
struct Bookkeeper {
diff --git a/caffe2/utils/simple_queue.h b/caffe2/utils/simple_queue.h
index 5adedf1..100a4a0 100644
--- a/caffe2/utils/simple_queue.h
+++ b/caffe2/utils/simple_queue.h
@@ -69,7 +69,7 @@
std::mutex mutex_;
std::condition_variable cv_;
std::queue<T> queue_;
- bool no_more_jobs_;
+ bool no_more_jobs_{};
// We do not allow copy constructors.
SimpleQueue(const SimpleQueue& /*src*/) {}
};