diff options
author | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-12-09 10:15:33 +0000 |
---|---|---|
committer | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-12-09 10:15:33 +0000 |
commit | 8f8581126c7e6b5303339be2e403d6e56376fc29 (patch) | |
tree | 3fdf7a613ede189fb83e23fa5489d2355cd2179b /gcc/tree-pretty-print.c | |
parent | 51e9c45eea3fd1094919458cff7ff2c7f2977be3 (diff) |
Escape non-printable chars in strings.
* tree-pretty-print.c (pretty_print_string): Escape non-printable
chars in strings.
* gcc.dg/tree-ssa/dump-3.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243477 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-pretty-print.c')
-rw-r--r-- | gcc/tree-pretty-print.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index 95db7100428..5b3e23e40f7 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -3869,7 +3869,14 @@ pretty_print_string (pretty_printer *pp, const char *str) break; default: - pp_character (pp, str[0]); + if (!ISPRINT (str[0])) + { + char buf[5]; + sprintf (buf, "\\x%x", (unsigned char)str[0]); + pp_string (pp, buf); + } + else + pp_character (pp, str[0]); break; } str++; |