[PATCH] _Cilk_for for C and C++

Jakub Jelinek jakub@redhat.com
Wed Nov 27 18:49:00 GMT 2013


On Wed, Nov 27, 2013 at 12:48:11PM -0500, Jason Merrill wrote:
> On 11/15/2013 02:23 PM, Iyer, Balaji V wrote:
> >One small thing that I have not done that Jakub and several other have asked me before is that, there are no tests in c-c++-common for _Cilk_for. The reason being that the syntax between C and C++ implementations are different. In C++, the induction variable must be defined in the initializer (e.g. it should start wth _Cilk_for (int ii = 0....)). In C, this is not allowed (e.g. it should start as _Cilk_for (ii = 0; ii < 10; ii++)).
> 
> That can be handled with #ifdef __cplusplus.

It isn't allowed even in C99?  For OpenMP,
int a[30];

void
foo ()
{
  #pragma omp for
  for (int i = 0; i < 30; i++)
    a[i] = i;
}
is valid for C99.  So, perhaps you just want
/* { dg-additional-options "-std=c99" { target c } } */
in the c-c++-common tests?

	Jakub



More information about the Gcc-patches mailing list