nonnull v.s. BUG() if !x (was: [PATCH v2] config.c: NULL check when reading protected config)
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Jul 27, 2022, 09:12 UTC
- Message-ID
- <220727.86v8rilxx1.gmgdl@evledraar.gmail.com>
- In-Reply-To
- <pull.1299.v2.git.git.1658874067077.gitgitgadget@gmail.com>
On Tue, Jul 26 2022, Glen Choo via GitGitGadget wrote:
> From: Glen Choo <chooglen@google.com>
> + if (!filename)
> + BUG("filename cannot be NULL");Looks good, but as an aside I wonder if we wouldn't get better code analysis with "nonnull" for this sort of thing, but we can leave this for now: https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gcc/Common-Function-Attributes.html#Common-Function-Attributes