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: Aldy Hernandez <aldyh at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Andrew Pinski <pinskia at gmail dot com>, Tom Tromey <tromey at redhat dot com>, "Iyer, Balaji V" <balaji dot v dot iyer at intel dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 11 Apr 2013 07:10:46 -0500
- 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>
On 04/11/13 00:32, Jakub Jelinek wrote:
On Wed, Apr 10, 2013 at 05:16:17PM -0700, Andrew Pinski wrote:
On Wed, Apr 10, 2013 at 3:24 PM, Aldy Hernandez <aldyh@redhat.com> wrote:
Hi Tom. Hi folks.
We've asked Balaji to rewrite the <#pragma simd> handling for cilkplus as we
currently do for OMP, etc, in init_pragma().
The cilkplus branch currently has something like:
cpp_register_deferred_pragma (parse_in, "simd", "",
PRAGMA_SIMD_EMPTY, true, false);
cpp_register_deferred_pragma (parse_in, "simd", "assert",
PRAGMA_SIMD_ASSERT, true, false);
cpp_register_deferred_pragma (parse_in, "simd", "noassert",
PRAGMA_SIMD_NOASSERT, true, false);
cpp_register_deferred_pragma (parse_in, "simd", "vectorlength",
PRAGMA_SIMD_VECTORLENGTH, true, false);
What about just registering simd as the pragma and then look for the
right keyword after that? Like diagnostic is handled?
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:
if (flag_enable_cilk)
{
cpp_register_deferred_pragma (parse_in, NULL, "simd",
PRAGMA_SIMD_EMPTY, true, false);
cpp_register_deferred_pragma (parse_in, "simd", "assert",
PRAGMA_SIMD_ASSERT, true, false);
// etc
}
In which case, we ICE because we're registering simd as both a pragma
and a pragma namespace:
cpp_error (pfile, CPP_DL_ICE,
"registering \"%s\" as both a pragma and a pragma namespace",
NODE_NAME (node));
> and parse the clauses in c/c-parser.c and cp/parser.c, look at how OpenMP
> pragmas are parsed (those have the "omp" space, you just use NULL,
otherwise
> it is not any different).
I see Balaji is already parsing the simd pragmas in c_parser_pragma.