diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-07-10 18:52:19 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-07-10 18:52:19 +0200 |
commit | d5e48350b40fcec6459dceef282f2ecf6eba3201 (patch) | |
tree | 8a55834621f16e95b2d8489959ff64d7803cc254 /gcc | |
parent | c26302d5351c07a12a5c434f392a5df89381dd8e (diff) | |
download | gcc-d5e48350b40fcec6459dceef282f2ecf6eba3201.zip gcc-d5e48350b40fcec6459dceef282f2ecf6eba3201.tar.gz gcc-d5e48350b40fcec6459dceef282f2ecf6eba3201.tar.bz2 |
re PR preprocessor/57824 (Raw string literals not handled correctly in macro arguments or deferred pragmas)
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.
From-SVN: r200879
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/gomp/pr57824.c | 14 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/raw-string-17.c | 30 |
3 files changed, 50 insertions, 0 deletions
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 <jakub@redhat.com> + + 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 <paolo.carlini@oracle.com> 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; +} |