From 651ed94280e4b88bf4fb69be0451cf2766ec9ab0 Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Fri, 4 Nov 2005 00:23:01 +0000 Subject: re PR preprocessor/22042 (stringification BUG) 2005-11-03 Andrew Pinski 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 PR preprocessor/22042 * gcc.dg/cpp/strify4.c: New test. From-SVN: r106463 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/cpp/strify4.c | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/cpp/strify4.c (limited to 'gcc') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 49d41e1..722318f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-11-03 Andrew Pinski + + PR preprocessor/22042 + * gcc.dg/cpp/strify4.c: New test. + 2005-11-03 Joseph S. Myers PR c++/17964 diff --git a/gcc/testsuite/gcc.dg/cpp/strify4.c b/gcc/testsuite/gcc.dg/cpp/strify4.c new file mode 100644 index 0000000..b8b2f11 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/strify4.c @@ -0,0 +1,25 @@ +/* { dg-do run } */ +/* Tests we stringify without changing unprintable characts. + + Andrew Pinski */ + +extern int strcmp (const char *, const char *); +extern int puts (const char *); +extern void abort (void); +#define err(str) do { puts(str); abort(); } while (0) + + +#define S(X) S2(X) +#define S2(X) #X +#define TAB " " /* Note there is a tab character here. */ + +int main (int argc, char *argv[]) +{ + /* The space before "bar" here is vital. */ + char a[] = S(S(TAB)); + + if (strcmp (a, "\"\\\" \\\"\"")) + err ("stringification caused octal"); + + return 0; +} -- cgit v1.1