All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@stusta.de>
To: Robert Yang <liezhi.yang@windriver.com>
Cc: openembedded-devel@lists.openembedded.org
Subject: Re: [PATCH] rocksdb: Fix compile error for DEBUG_BUILD
Date: Thu, 9 Jan 2020 11:01:12 +0200	[thread overview]
Message-ID: <20200109090112.GA26602@localhost> (raw)
In-Reply-To: <aae96c30-db44-b4ef-9c4c-ec44088e18ee@windriver.com>

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


      reply	other threads:[~2020-01-09  9:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-08  6:09 [PATCH] rocksdb: Fix compile error for DEBUG_BUILD Robert Yang
2020-01-08  9:27 ` Adrian Bunk
2020-01-09  7:13   ` Robert Yang
2020-01-09  7:23     ` Khem Raj
2020-01-09  8:14     ` Adrian Bunk
2020-01-09  8:30       ` Robert Yang
2020-01-09  9:01         ` Adrian Bunk [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200109090112.GA26602@localhost \
    --to=bunk@stusta.de \
    --cc=liezhi.yang@windriver.com \
    --cc=openembedded-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.