-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing feature
Description
__attribute__((returns_nonnull)) void* func();
static void f1()
{
if (func()) {} // warning
}
static void f2()
{
void* p = func();
if (p) {} // no warning
}<source>:5:9: warning: nonnull function call 'func()' will evaluate to 'true' on first encounter [-Wpointer-bool-conversion]
5 | if (func()) {} // warning
| ~~ ^~~~~~
<source>:1:16: note: declared 'returns_nonnull' here
1 | __attribute__((returns_nonnull)) void* func();
|
https://godbolt.org/z/x3r5oP6db
I guess this is out of scope of the existing warning and would require a clang-tidy or static analyzer check instead.
Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing feature