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
This commit is contained in:
parent
c26302d535
commit
d5e48350b4
|
@ -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>
|
2013-07-10 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
PR c++/57869
|
PR c++/57869
|
||||||
|
|
|
@ -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 ();
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -1,5 +1,10 @@
|
||||||
2013-07-10 Jakub Jelinek <jakub@redhat.com>
|
2013-07-10 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
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
|
* include/cpplib.h (cpp_token_val_index): Change parameter type to
|
||||||
const cpp_token *.
|
const cpp_token *.
|
||||||
* lex.c (cpp_token_val_index): Likewise.
|
* lex.c (cpp_token_val_index): Likewise.
|
||||||
|
|
|
@ -1543,8 +1543,8 @@ lex_raw_string (cpp_reader *pfile, cpp_token *token, const uchar *base,
|
||||||
else if (c == '\n')
|
else if (c == '\n')
|
||||||
{
|
{
|
||||||
if (pfile->state.in_directive
|
if (pfile->state.in_directive
|
||||||
|| pfile->state.parsing_args
|
|| (pfile->state.parsing_args
|
||||||
|| pfile->state.in_deferred_pragma)
|
&& pfile->buffer->next_line >= pfile->buffer->rlimit))
|
||||||
{
|
{
|
||||||
cur--;
|
cur--;
|
||||||
type = CPP_OTHER;
|
type = CPP_OTHER;
|
||||||
|
|
Loading…
Reference in New Issue