+void foo(void *bar) __attribute__((nonnull(1)));
+
+void foo(void *bar) { if (!bar) abort(); } /* { dg-warning "null" "argument ‘bar’
compared to NULL" } */
This looks like a very useful enhancement. Since the change is limited
to build_binary_op in the two front ends I wonder if the warning also
issued for other expressions? For example, suppose I were to add to
function foo above the following:
bool is_null = bar;
would GCC issue a warning? The same question goes for other expressions
non-binary expressions, including:
bar ? f () : g ();
or in C++:
bool x = static_cast<bool>(bar);
If not, I would think issuing it would make the feature even more
useful (and the diagnostics more consistent).
Martin