mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-07 06:00:25 +08:00
This patch is based on grepping the C++ frontend for %P i.e. diagnostics that refer to a parameter number. It fixes up these diagnostics to highlight the pertinent param where appropriate (and possible), along with various other tweaks, as described in the ChangeLog. gcc/cp/ChangeLog: PR c++/85110 * call.c (conversion_null_warnings): Try to use the location of the expression for the warnings. Add notes showing the parameter of the function decl, where available. (get_fndecl_argument_location): For implicitly-declared functions, use the fndecl location rather than that of the param. (maybe_inform_about_fndecl_for_bogus_argument_init): New function. (convert_like_real): Use it in various places to avoid repetition. (complain_about_bad_argument): Likewise. * cp-tree.h (maybe_inform_about_fndecl_for_bogus_argument_init): New declaration. * decl2.c (check_default_args): Put all diagnostics for the fndecl into a diagnostic group. Use the location of the parameter when complaining about parameters with missing default arguments in preference to that of the fndecl. Attempt to record the location of the first parameter with a default argument and emit a note for the first parameter that's missing one. * typeck.c (convert_arguments): When complaining about parameters with incomplete types, attempt to use the location of the argument. Where available, add a note showing the pertinent parameter in the fndecl. (convert_for_assignment): When complaining about bad conversions at function calls, use the location of the unstripped argument. (convert_for_initialization): When checking for bogus references, add an auto_diagnostic_group, and update the note to use the location of the pertinent parameter, rather than just the callee. gcc/testsuite/ChangeLog: PR c++/85110 * g++.dg/diagnostic/missing-default-args.C: New test. * g++.dg/diagnostic/param-type-mismatch-3.C: New test. * g++.dg/diagnostic/param-type-mismatch.C: Add tests for invalid references and incomplete types. * g++.dg/warn/Wconversion-null-4.C: New test. From-SVN: r266856
…
…
…
…
…
…
…
…
…
…
This directory contains the GNU Compiler Collection (GCC). The GNU Compiler Collection is free software. See the files whose names start with COPYING for copying permission. The manuals, and some of the runtime libraries, are under different terms; see the individual source files for details. The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs. See the file gcc/doc/gcc.texi (together with other files that it includes) for usage and porting information. An online readable version of the manual is in the files gcc/doc/gcc.info*. See http://gcc.gnu.org/bugs/ for how to report bugs usefully. Copyright years on GCC source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.
Description
Languages
C++
31.9%
C
31.3%
Ada
12%
D
6.5%
Go
6.4%
Other
11.5%