Set and test no-warning bit to avoid -Wnonnull for synthesized expressions.
authorMartin Sebor <msebor@redhat.com>
Fri, 31 Jul 2020 16:27:33 +0000 (10:27 -0600)
committerMartin Sebor <msebor@redhat.com>
Fri, 31 Jul 2020 16:27:33 +0000 (10:27 -0600)
commitdf5cf47a978aaeb53fc2b18ff0b22eb4531a27d8
tree7a00548585cab2802e93e64d5924e4d2d178b52e
parent4143efc1eed44050201b20c78d0206bc266e30c4
Set and test no-warning bit to avoid -Wnonnull for synthesized expressions.

Resolves:
PR c++/96003 spurious -Wnonnull calling a member on the result of static_cast

gcc/c-family/ChangeLog:

PR c++/96003
* c-common.c (check_function_arguments_recurse): Return early when
no-warning bit is set.

gcc/cp/ChangeLog:

PR c++/96003
* class.c (build_base_path): Set no-warning bit on the synthesized
conditional expression in static_cast.

gcc/testsuite/ChangeLog:

PR c++/96003
* g++.dg/warn/Wnonnull7.C: New test.
gcc/c-family/c-common.c
gcc/cp/class.c
gcc/testsuite/g++.dg/warn/Wnonnull7.C [new file with mode: 0644]