diff options
author | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-09-10 07:02:28 +0000 |
---|---|---|
committer | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-09-10 07:02:28 +0000 |
commit | 7eb2fa379c0fd67b3e1da1863642ad1e5bcfb0c3 (patch) | |
tree | 25c2c2a9f804e8e188bb2dafa14aa6b5ef4f7798 | |
parent | 15fe8e1db4a8c4000d11eb06c7f28478577329c5 (diff) |
* print-tree.c (print_node): In a STRING_CST, escape non-ascii
characters, and only print TREE_STRING_LENGTH chars.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56994 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/print-tree.c | 15 |
2 files changed, 19 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3daf7425a0f..fb214bdd22b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2002-09-09 Per Bothner <per@bothner.com> + + * print-tree.c (print_node): In a STRING_CST, escape non-ascii + characters, and only print TREE_STRING_LENGTH chars. + 2002-09-09 Steve Ellcey <sje@cup.hp.com> * config/ia64/hpux.h (TARGET_HPUX_LD): New, define true. diff --git a/gcc/print-tree.c b/gcc/print-tree.c index 949b7f51be0..bb03d81f2a8 100644 --- a/gcc/print-tree.c +++ b/gcc/print-tree.c @@ -711,7 +711,20 @@ print_node (file, prefix, node, indent) break; case STRING_CST: - fprintf (file, " \"%s\"", TREE_STRING_POINTER (node)); + { + const char *p = TREE_STRING_POINTER (node); + int i = TREE_STRING_LENGTH (node); + fputs (" \"", file); + while (--i >= 0) + { + char ch = *p++; + if (ch >= ' ' && ch < 127) + putc (ch, file); + else + fprintf(file, "\\%03o", ch & 0xFF); + } + fputc ('\"', file); + } /* Print the chain at second level. */ if (indent == 4) print_node (file, "chain", TREE_CHAIN (node), indent + 4); |