Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame^] | 1 | From 49dcd22dcf1aae5995c42eac0fda68516fc1cd43 Mon Sep 17 00:00:00 2001 |
| 2 | From: Robert Yang <liezhi.yang@windriver.com> |
| 3 | Date: Wed, 19 Jun 2019 17:57:24 +0800 |
| 4 | Subject: [PATCH] db/write_thread.cc: Initialize state |
| 5 | |
| 6 | Fixed an error when compiled without -O2: |
| 7 | db/write_thread.cc:183:14: error: 'state' may be used uninitialized in this function [-Werror=maybe-uninitialized] |
| 8 | |
| 9 | Upstream-Status: Pending |
| 10 | |
| 11 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> |
| 12 | --- |
| 13 | db/write_thread.cc | 2 +- |
| 14 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 15 | |
| 16 | diff --git a/db/write_thread.cc b/db/write_thread.cc |
| 17 | index 835992c..6f99a11 100644 |
| 18 | --- a/db/write_thread.cc |
| 19 | +++ b/db/write_thread.cc |
| 20 | @@ -59,7 +59,7 @@ uint8_t WriteThread::BlockingAwaitState(Writer* w, uint8_t goal_mask) { |
| 21 | |
| 22 | uint8_t WriteThread::AwaitState(Writer* w, uint8_t goal_mask, |
| 23 | AdaptationContext* ctx) { |
| 24 | - uint8_t state; |
| 25 | + uint8_t state = 0; |
| 26 | |
| 27 | // 1. Busy loop using "pause" for 1 micro sec |
| 28 | // 2. Else SOMETIMES busy loop using "yield" for 100 micro sec (default) |
| 29 | -- |
| 30 | 2.7.4 |
| 31 | |