diff options
author | Martin Sebor <msebor@redhat.com> | 2017-08-14 18:35:13 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2017-08-14 12:35:13 -0600 |
commit | da67acb9b37cf139da014f5bc11e2dbf25a7d597 (patch) | |
tree | d3cc608c3e0c1104bf054ef4e742c6af1439c24f /gcc/c/c-objc-common.c | |
parent | 9e3b1778b6207a10f2f1534fc9f01e6c8320a1dc (diff) | |
download | gcc-da67acb9b37cf139da014f5bc11e2dbf25a7d597.zip gcc-da67acb9b37cf139da014f5bc11e2dbf25a7d597.tar.gz gcc-da67acb9b37cf139da014f5bc11e2dbf25a7d597.tar.bz2 |
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
Diffstat (limited to 'gcc/c/c-objc-common.c')
-rw-r--r-- | gcc/c/c-objc-common.c | 12 |
1 files changed, 11 insertions, 1 deletions
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; } |