From c7691e082933c6e7597e0e5bc3b4b447ce8c2841 Mon Sep 17 00:00:00 2001 From: jakub Date: Wed, 10 Jul 2013 16:52:19 +0000 Subject: [PATCH] PR preprocessor/57824 * lex.c (lex_raw_string): Allow reading new-lines if in_deferred_pragma or if parsing_args and there is still data in the current buffer. * c-c++-common/raw-string-17.c: New test. * c-c++-common/gomp/pr57824.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200879 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/c-c++-common/gomp/pr57824.c | 14 ++++++++++++++ gcc/testsuite/c-c++-common/raw-string-17.c | 30 ++++++++++++++++++++++++++++++ libcpp/ChangeLog | 5 +++++ libcpp/lex.c | 4 ++-- 5 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/gomp/pr57824.c create mode 100644 gcc/testsuite/c-c++-common/raw-string-17.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c32ac84..cbe3ae0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2013-07-10 Jakub Jelinek + + PR preprocessor/57824 + * c-c++-common/raw-string-17.c: New test. + * c-c++-common/gomp/pr57824.c: New test. + 2013-07-10 Paolo Carlini PR c++/57869 diff --git a/gcc/testsuite/c-c++-common/gomp/pr57824.c b/gcc/testsuite/c-c++-common/gomp/pr57824.c new file mode 100644 index 0000000..a303da2 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr57824.c @@ -0,0 +1,14 @@ +/* PR preprocessor/57824 */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -fopenmp" { target c } } */ +/* { dg-options "-std=c++11 -fopenmp" { target c++ } } */ + +void bar (); + +void foo () +{ +#pragma omp parallel num_threads(sizeof R"( +abc +)") + bar (); +} diff --git a/gcc/testsuite/c-c++-common/raw-string-17.c b/gcc/testsuite/c-c++-common/raw-string-17.c new file mode 100644 index 0000000..30df020 --- /dev/null +++ b/gcc/testsuite/c-c++-common/raw-string-17.c @@ -0,0 +1,30 @@ +/* PR preprocessor/57824 */ +/* { dg-do run } */ +/* { dg-options "-std=gnu99" { target c } } */ +/* { dg-options "-std=c++11" { target c++ } } */ + +#define S(s) s +#define T(s) s "\n" + +const char x[] = R"( +abc +)"; +const char y[] = S(R"( +abc +)"); +const char z[] = "\nabc\n"; +const char w[] = T(R"( +abc)"); + +int +main () +{ + if (sizeof x != sizeof y + || sizeof x != sizeof z + || sizeof x != sizeof w + || __builtin_memcmp (x, y, sizeof x) + || __builtin_memcmp (x, z, sizeof x) + || __builtin_memcmp (x, w, sizeof x)) + __builtin_abort (); + return 0; +} diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 195d728..9213232 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,5 +1,10 @@ 2013-07-10 Jakub Jelinek + PR preprocessor/57824 + * lex.c (lex_raw_string): Allow reading new-lines if + in_deferred_pragma or if parsing_args and there is still + data in the current buffer. + * include/cpplib.h (cpp_token_val_index): Change parameter type to const cpp_token *. * lex.c (cpp_token_val_index): Likewise. diff --git a/libcpp/lex.c b/libcpp/lex.c index 84e2af6..fc89baf 100644 --- a/libcpp/lex.c +++ b/libcpp/lex.c @@ -1543,8 +1543,8 @@ lex_raw_string (cpp_reader *pfile, cpp_token *token, const uchar *base, else if (c == '\n') { if (pfile->state.in_directive - || pfile->state.parsing_args - || pfile->state.in_deferred_pragma) + || (pfile->state.parsing_args + && pfile->buffer->next_line >= pfile->buffer->rlimit)) { cur--; type = CPP_OTHER; -- 2.7.4