This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: libcpp: registering both a pragma and a pragma namespace with the same name
- From: "Iyer, Balaji V" <balaji dot v dot iyer at intel dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>, Jakub Jelinek <jakub at redhat dot com>
- Cc: Andrew Pinski <pinskia at gmail dot com>, Tom Tromey <tromey at redhat dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 11 Apr 2013 14:16:12 +0000
- Subject: RE: libcpp: registering both a pragma and a pragma namespace with the same name
- References: <5165E691 dot 8020907 at redhat dot com> <CA+=Sn1k6u-4wk6mzivFtThAgLMBHJzfbzFTLFxM6Dj6iHOHw2g at mail dot gmail dot com> <20130411053231 dot GH16463 at tucnak dot redhat dot com> <5166A846 dot 6020604 at redhat dot com> <20130411123609 dot GN16463 at tucnak dot redhat dot com> <5166B290 dot 6070902 at redhat dot com>
> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
> owner@gcc.gnu.org] On Behalf Of Aldy Hernandez
> Sent: Thursday, April 11, 2013 8:55 AM
> To: Jakub Jelinek
> Cc: Andrew Pinski; Tom Tromey; Iyer, Balaji V; gcc-patches
> Subject: Re: libcpp: registering both a pragma and a pragma namespace with the
> same name
>
> On 04/11/13 07:36, Jakub Jelinek wrote:
> > 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.
> > http://software.intel.com/sites/products/documentation/studio/composer
> > /en-us/2011Update/compiler_c/cref_cls/common/cppref_pragma_simd.htm
> > #pragma simd [clause[ [,] clause]...]
> >
> > Thus, you'd parse it as PRAGMA_SIMD, then you'd just parse all the
> > (optional) clauses for it.
>
> Ughh, you are correct. Sorry for the noise.
>
> Balaji, I assume you have enough to continue?
I believe so. Thank you Jakub, Andrew and Aldy!
Sincerely,
Balaji V. Iyer.
>
> Thanks y'all.
> Aldy
>
> >
> > 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).
> >
> > Jakub
> >