Message ID | 20130705151950.GY2336@tucnak.redhat.com |
---|---|
State | New |
Headers | show |
On 07/05/2013 11:19 AM, Jakub Jelinek wrote: > Seems for deferred_pragmas it just works Can we encounter a newline in a deferred pragma? > and for parsing of arguments > also if there is something in the current buffer (otherwise would > that just mean and of say include? I think raw strings shouldn't be allowed > to flow from end of include file to another file). Agreed: "A source file shall not end in a partial preprocessing token". OK. Jason
On Wed, Jul 10, 2013 at 02:32:07AM -0400, Jason Merrill wrote: > On 07/05/2013 11:19 AM, Jakub Jelinek wrote: > >Seems for deferred_pragmas it just works > > Can we encounter a newline in a deferred pragma? Yes, that is the OpenMP testcase in the patch. > >and for parsing of arguments > >also if there is something in the current buffer (otherwise would > >that just mean and of say include? I think raw strings shouldn't be allowed > >to flow from end of include file to another file). > > Agreed: "A source file shall not end in a partial preprocessing token". > > OK. Thanks. Jakub
--- libcpp/lex.c.jj 2013-07-04 18:48:13.000000000 +0200 +++ libcpp/lex.c 2013-07-04 19:16:26.401312503 +0200 @@ -1692,8 +1692,8 @@ lex_raw_string (cpp_reader *pfile, cpp_t 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; --- gcc/testsuite/c-c++-common/raw-string-17.c.jj 2013-07-04 19:22:07.905695049 +0200 +++ gcc/testsuite/c-c++-common/raw-string-17.c 2013-07-04 19:26:30.136244380 +0200 @@ -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; +} --- gcc/testsuite/c-c++-common/gomp/pr57824.c.jj 2013-07-04 19:30:26.040563509 +0200 +++ gcc/testsuite/c-c++-common/gomp/pr57824.c 2013-07-04 19:30:56.928056024 +0200 @@ -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 (); +}