diff options
author | Martin Liska <mliska@suse.cz> | 2016-12-09 11:15:33 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2016-12-09 10:15:33 +0000 |
commit | cdecc83f3e0c71790841630597c5ab1303c39742 (patch) | |
tree | 3fdf7a613ede189fb83e23fa5489d2355cd2179b /gcc/tree-pretty-print.c | |
parent | 52af5e483d2aab891a364929dedc221771ac1a52 (diff) | |
download | gcc-cdecc83f3e0c71790841630597c5ab1303c39742.zip gcc-cdecc83f3e0c71790841630597c5ab1303c39742.tar.gz gcc-cdecc83f3e0c71790841630597c5ab1303c39742.tar.bz2 |
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.
From-SVN: r243477
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 95db710..5b3e23e 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++; |