[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dealing with false alarms
From: |
Bruno Haible |
Subject: |
Re: dealing with false alarms |
Date: |
Sat, 11 May 2024 15:21:53 +0200 |
For example, gcc does not have the notion that "variable X is initialized
if condition Y is met". It only distinguishes between "variable X is
initialized" and "variable X is uninitialized". This leads to many, many
false alarms.
> 3) In case of a false alarm, report it as a GCC bug and optionally add a
> GCC_LINT conditional, so that
> - users can silence the warning if they want to and if the warning
> category is generally somewhat useful,
> - readers of the code can see that the problem was already handled.
In some (few) cases, the code can be refactored in such a way that the
warning disappears _and_ the code become easier to understand. Such a
refactoring can be applied.
Example:
https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=3bb26f17cbb32c4129c4a26cd6122bd2227ddf05
Bruno