From da67acb9b37cf139da014f5bc11e2dbf25a7d597 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Mon, 14 Aug 2017 18:35:13 +0000 Subject: PR c/81117 - Improve buffer overflow checking in strncpy - part 1 gcc/ChangeLog: PR c/81117 * tree-diagnostic.c (default_tree_printer): Handle %G. * gimple-pretty-print.h (percent_G_format): Declare new function. * gimple-pretty-print.c (percent_G_format): Define. * tree-pretty-print.c (percent_K_format): Add argument. gcc/c/ChangeLog: PR c/81117 * c-objc-common.c (c_objc_common_init): Handle 'G'. gcc/c-family/ChangeLog: PR c/81117 * c-format.h (T89_G): New macro. * c-format.c (local_gcall_ptr_node): New variable. (init_dynamic_diag_info): Initialize it. gcc/cp/ChangeLog: PR c/81117 * error.c (cp_printer): Handle 'G'. gcc/testsuite/ChangeLog: PR c/81117 * gcc.dg/format/gcc_diag-10.c: Exercise %G. From-SVN: r251098 --- gcc/c/ChangeLog | 5 +++++ gcc/c/c-objc-common.c | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index cd0c128e..3db4189 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2017-08-14 Martin Sebor + + PR c/81117 + * c-objc-common.c (c_objc_common_init): Handle 'G'. + 2017-08-11 Marek Polacek PR c/81795 diff --git a/gcc/c/c-objc-common.c b/gcc/c/c-objc-common.c index 05212b2..8f4d3eb 100644 --- a/gcc/c/c-objc-common.c +++ b/gcc/c/c-objc-common.c @@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see #include "intl.h" #include "c-family/c-pretty-print.h" #include "tree-pretty-print.h" +#include "gimple-pretty-print.h" #include "langhooks.h" #include "c-objc-common.h" @@ -66,6 +67,8 @@ c_objc_common_init (void) %D: a general decl, %E: an identifier or expression, %F: a function declaration, + %G: a Gimple call statement, + %K: a CALL_EXPR, %T: a type. %V: a list of type qualifiers from a tree. %v: an explicit list of type qualifiers @@ -87,9 +90,16 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec, if (precision != 0 || wide) return false; + if (*spec == 'G') + { + percent_G_format (text); + return true; + } + if (*spec == 'K') { - percent_K_format (text); + t = va_arg (*text->args_ptr, tree); + percent_K_format (text, t); return true; } -- cgit v1.1