[oe] [PATCH] rocksdb: Fix compile error for DEBUG_BUILD

Robert Yang liezhi.yang at windriver.com
Thu Jan 9 08:30:41 UTC 2020



On 1/9/20 4:14 PM, Adrian Bunk wrote:
> On Thu, Jan 09, 2020 at 03:13:57PM +0800, Robert Yang wrote:
>>
>>
>> On 1/8/20 5:27 PM, Adrian Bunk wrote:
>>> On Wed, Jan 08, 2020 at 02:09:03PM +0800, Robert Yang wrote:
>>>> Fixed do_compile error when DEBUG_BUILD = "1":
>>>> db/write_thread.cc:183:14: error: 'state' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>>>> ...
>>>
>>> -Og warnings are not 100% reliable, and in general -Werror is
>>> problematic for distributions.
>>>
>>> Does building with -DFAIL_ON_WARNINGS=OFF fix this problem?
>>
>> Yes, it works.
>>
>> I think that the correct way to fix it is initialize it rather than ignore
>> the error.
> 
> Is the error a bug in the code, or is it a bogus warning from the compiler?
> 
> When the warning happens only with -Og this is a known case of bogus
> warnings in gcc, and the correct way to fix it is to ignore the bogus
> warning.

I checked the code, it won't be used before uninitialized. But I still think
that assign it an initial value is better than ignore the warnings, there
  might be other vars really have this issue.

// Robert

> 
>> // Robert
> 
> cu
> Adrian
> 


More information about the Openembedded-devel mailing list