Re: [oe] [PATCH] rocksdb: Fix compile error for DEBUG_BUILD
On Thu, Jan 09, 2020 at 04:30:41PM +0800, Robert Yang wrote: > 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. Silencing a warning can be worse than ignoring it. The first question should be *why* a variable has this problem. Often the problem is that something is wrong with the code that was supposed to set the variable, and just setting some default might also result in misbehaving code - only the warning is no longer visible hiding the problem. >From a distribution point of view it does not make sense to fix random warnings in the old codebases of the few upstreams that default to -Werror while noone cares about warnings indicating actual problems in all the other recipes - -Werror is a very useful tool for upstream but mostly pain for distributions. > // Robert cu Adrian -- ___ Openembedded-devel mailing list Openembedded-devel@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Re: [oe] [PATCH] rocksdb: Fix compile error for DEBUG_BUILD
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 -- ___ Openembedded-devel mailing list Openembedded-devel@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Re: [oe] [PATCH] rocksdb: Fix compile error for DEBUG_BUILD
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. > // Robert cu Adrian -- ___ Openembedded-devel mailing list Openembedded-devel@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Re: [oe] [PATCH] rocksdb: Fix compile error for DEBUG_BUILD
On Wed, Jan 8, 2020 at 11:15 PM 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? > I think this should be used when we have warnings which we have no easy control over and no good fixes. > Yes, it works. > > I think that the correct way to fix it is initialize it rather than ignore the > error. Thats fine, Also submit this patch to rocksdb upstream as well. > > // Robert > > > > > cu > > Adrian > > > -- > ___ > Openembedded-devel mailing list > Openembedded-devel@lists.openembedded.org > http://lists.openembedded.org/mailman/listinfo/openembedded-devel -- ___ Openembedded-devel mailing list Openembedded-devel@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Re: [oe] [PATCH] rocksdb: Fix compile error for DEBUG_BUILD
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. // Robert cu Adrian -- ___ Openembedded-devel mailing list Openembedded-devel@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Re: [oe] [PATCH] rocksdb: Fix compile error for DEBUG_BUILD
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? cu Adrian -- ___ Openembedded-devel mailing list Openembedded-devel@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-devel
[oe] [PATCH] rocksdb: Fix compile error for DEBUG_BUILD
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] Signed-off-by: Robert Yang --- .../0001-db-write_thread.cc-Initialize-state.patch | 31 ++ meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb | 1 + 2 files changed, 32 insertions(+) create mode 100644 meta-oe/recipes-dbs/rocksdb/files/0001-db-write_thread.cc-Initialize-state.patch diff --git a/meta-oe/recipes-dbs/rocksdb/files/0001-db-write_thread.cc-Initialize-state.patch b/meta-oe/recipes-dbs/rocksdb/files/0001-db-write_thread.cc-Initialize-state.patch new file mode 100644 index 000..97ddbce --- /dev/null +++ b/meta-oe/recipes-dbs/rocksdb/files/0001-db-write_thread.cc-Initialize-state.patch @@ -0,0 +1,31 @@ +From 49dcd22dcf1aae5995c42eac0fda68516fc1cd43 Mon Sep 17 00:00:00 2001 +From: Robert Yang +Date: Wed, 19 Jun 2019 17:57:24 +0800 +Subject: [PATCH] db/write_thread.cc: Initialize state + +Fixed an error when compiled without -O2: +db/write_thread.cc:183:14: error: 'state' may be used uninitialized in this function [-Werror=maybe-uninitialized] + +Upstream-Status: Pending + +Signed-off-by: Robert Yang +--- + db/write_thread.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/db/write_thread.cc b/db/write_thread.cc +index 835992c..6f99a11 100644 +--- a/db/write_thread.cc b/db/write_thread.cc +@@ -59,7 +59,7 @@ uint8_t WriteThread::BlockingAwaitState(Writer* w, uint8_t goal_mask) { + + uint8_t WriteThread::AwaitState(Writer* w, uint8_t goal_mask, + AdaptationContext* ctx) { +- uint8_t state; ++ uint8_t state = 0; + + // 1. Busy loop using "pause" for 1 micro sec + // 2. Else SOMETIMES busy loop using "yield" for 100 micro sec (default) +-- +2.7.4 + diff --git a/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb b/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb index 68c6bc2..44a451c 100644 --- a/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb +++ b/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb @@ -12,6 +12,7 @@ PV = "6.5.2" SRC_URI = "git://github.com/facebook/${BPN}.git;branch=${SRCBRANCH} \ file://0001-Fix-build-breakage-from-lock_guard-error-6161.patch \ + file://0001-db-write_thread.cc-Initialize-state.patch \ " S = "${WORKDIR}/git" -- 2.7.4 -- ___ Openembedded-devel mailing list Openembedded-devel@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-devel