diff options
author | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-04 00:23:01 +0000 |
---|---|---|
committer | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-04 00:23:01 +0000 |
commit | cc9012f7c74cf3452cdb1b6cde3cf6455e889cd3 (patch) | |
tree | e997615dea22c4f55a4cadbd3c4f72ca8ca0ca82 /libcpp | |
parent | 3f83030a6d8dd8593daacc8337dd2509701702ab (diff) | |
download | gcc-cc9012f7c74cf3452cdb1b6cde3cf6455e889cd3.tar.gz |
2005-11-03 Andrew Pinski <pinskia@physics.uc.edu>
PR preprocessor/22042
* macro.c (_cpp_builtin_macro_text): Lower the needed max
buffer size.
(cpp_quote_string): Don't octalify non printable
charactors.
2005-11-03 Andrew Pinski <pinskia@physics.uc.edu>
PR preprocessor/22042
* gcc.dg/cpp/strify4.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@106463 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 8 | ||||
-rw-r--r-- | libcpp/macro.c | 17 |
2 files changed, 12 insertions, 13 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index c0364802678..3a489b4c1c0 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,11 @@ +2005-11-03 Andrew Pinski <pinskia@physics.uc.edu> + + PR preprocessor/22042 + * macro.c (_cpp_builtin_macro_text): Lower the needed max + buffer size. + (cpp_quote_string): Don't octalify non printable + charactors. + 2005-11-03 Joseph S. Myers <joseph@codesourcery.com> PR c++/17964 diff --git a/libcpp/macro.c b/libcpp/macro.c index 13f5c768090..a0aa93ea994 100644 --- a/libcpp/macro.c +++ b/libcpp/macro.c @@ -139,7 +139,7 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node) name = map->to_file; len = strlen (name); - buf = _cpp_unaligned_alloc (pfile, len * 4 + 3); + buf = _cpp_unaligned_alloc (pfile, len * 2 + 3); result = buf; *buf = '"'; buf = cpp_quote_string (buf + 1, (const unsigned char *) name, len); @@ -292,9 +292,8 @@ builtin_macro (cpp_reader *pfile, cpp_hashnode *node) } /* Copies SRC, of length LEN, to DEST, adding backslashes before all - backslashes and double quotes. Non-printable characters are - converted to octal. DEST must be of sufficient size. Returns - a pointer to the end of the string. */ + backslashes and double quotes. DEST must be of sufficient size. + Returns a pointer to the end of the string. */ uchar * cpp_quote_string (uchar *dest, const uchar *src, unsigned int len) { @@ -308,15 +307,7 @@ cpp_quote_string (uchar *dest, const uchar *src, unsigned int len) *dest++ = c; } else - { - if (ISPRINT (c)) - *dest++ = c; - else - { - sprintf ((char *) dest, "\\%03o", c); - dest += 4; - } - } + *dest++ = c; } return dest; |