GCC modified for the FreeChainXenon project
![]() As can be seen on the testcase, GCC 11 no longer warns if the format string is wrapped inside of ()s. This regressed with r11-2457-gdf5cf47a978, which added if (TREE_NO_WARNING (param)) return; to check_function_arguments_recurse. That function is used with a callback for two cases, for -Wformat and for -Wnonnull. For the latter it is desirable to not warn in parameters or their subexpressions where that warning is suppressed, but for -Wformat the function is used solely to discover the string literals if any so that the c-format.cc code can diagnose them. I believe no warning suppression should stand in the way of that, -Wformat* warnings should be decided from warning suppression on the CALL_EXPR only. In the PR Martin argued that now that we have specialized warning_suppressed_p we should use it, so instead of adding a bool arg to check_function_arguments_recurse I've added opt_code to the function, but will defer the warning_suppressed_p change to him. For OPT_Wformat_ we don't want to call it anyway at all (as I said, I think there should be no suppression for it during the string discovery, there isn't just one -Wformat= option, there are many and warning_suppression_p even with no_warnings actually tests the TREE_NO_WARNING bit). Initially, I thought I'd restrict also call to fn with format_arg attribute handling in check_function_arguments_recurse to OPT_Wformat_ only, but after looking around, it perhaps is intentional that way, most functions with format_arg attribute don't have nonnull attribute for that arg too, various gettext implementations handle NULL argument by passing it through, but when result of gettext (NULL) etc. is passed to non-NULL argument, it makes sense to warn. 2022-01-21 Jakub Jelinek <jakub@redhat.com> PR c++/104148 * c-common.h (check_function_arguments_recurse): Add for_format arg. * c-common.cc (check_function_nonnull): Pass false to check_function_arguments_recurse's last argument. (check_function_arguments_recurse): Add for_format argument, if true, don't stop on warning_suppressed_p. * c-format.cc (check_format_info): Pass true to check_function_arguments_recurse's last argument. * c-c++-common/Wformat-pr104148.c: New test. |
||
---|---|---|
c++tools | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
intl | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcody | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgo | ||
libgomp | ||
libiberty | ||
libitm | ||
libobjc | ||
liboffloadmic | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
ar-lib | ||
build.log | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
COPYING3 | ||
COPYING3.LIB | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
lt~obsolete.m4 | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
multilib.am | ||
README | ||
symlink-tree | ||
test-driver | ||
ylwrap |
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.