c: avoid false positive for useless casts and generic [PR125261]

To reduce the number of false positives, we guard -Wuseless-cast by
c_inhibit_evaluation_warnings and also increment it for a generic
association if we have seen a prior match for a (non-default)
association.  This covers the common case where the default association
comes last.  If there is another association selected after we have
seen a default, we still have false positives.

	PR c/125261

gcc/c/ChangeLog:
	* c-parser.cc (c_parser_generic_selection): Modify logic for
	c_inhibit_evaluation_warnings.
	* c-typeck.cc (build_c_cast): Use c_inhibit_evaluation_warnings.

gcc/testsuite/ChangeLog:
	* gcc.dg/pr125261.c: New test.
3 files changed