This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libcpp: registering both a pragma and a pragma namespace with the same name

On Thu, Apr 11, 2013 at 07:10:46AM -0500, Aldy Hernandez wrote:
> >Yeah, the above is definitely wrong.  Just
> >   if (flag_cilkplus)
> >     cpp_register_deferred_pragma (parse_in, NULL, "simd", PRAGMA_SIMD, true, false);
> Well, the thing is that you can't just use NULL for "#pragma simd"
> as a pragma and then define "#pragma simd assert" to use "simd" as a
> pragma namespace.  I had already tried that:

My understanding is that the pragma is #pragma simd, it isn't a namespace,
and assert, vectorlength etc. are clauses.
#pragma simd [clause[ [,] clause]...]

Thus, you'd parse it as PRAGMA_SIMD, then you'd just parse all the
(optional) clauses for it.

Say for OpenMP 4.0 #pragma omp simd (which is IMHO different just by using
a non-NULL namespace).  Upon seeing PRAGMA_OMP_SIMD (in your case
PRAGMA_SIMD), the C++ parser in cp_parser_pragma just calls a function to
handle parsing of it, for PRAGMA_OMP_SIMD on gomp-4_0-branch that is
cp_parser_omp_construct (after checking that the pragma doesn't appear
outside of function context (== pragma_external).  That then just
calls cp_parser_omp_simd which uses a helper function
(cp_parser_omp_all_clauses) to parse the clauses and newline at the end
of the pragma line, then whatever else needs to be parsed after it (for
cycle nest).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]