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: Andrew Pinski <pinskia at gmail dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>
- Cc: 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: Wed, 10 Apr 2013 17:16:17 -0700
- Subject: Re: libcpp: registering both a pragma and a pragma namespace with the same name
- References: <5165E691 dot 8020907 at redhat dot com>
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?
Thanks,
Andrew Pinski
>
> Notice that #pragma simd can be both a pragma name space, and also a lone
> pragma with no arguments:
>
> #pragma simd assert
> -or-
> #pragma simd
>
> It seems like the code in libcpp's do_pragma(), specifically disallows this.
> If we're looking at a possible pragma name space, the next expected token is
> a CPP_NAME.
>
> Is there a way to handle this scenario with the current infrastructure? If
> not, is something like the attached (untested) patch reasonable?
>
> Aldy
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);
>
> Notice that #pragma simd can be both a pragma name space, and also a lone
> pragma with no arguments:
>
> #pragma simd assert
> -or-
> #pragma simd
>
> It seems like the code in libcpp's do_pragma(), specifically disallows this.
> If we're looking at a possible pragma name space, the next expected token is
> a CPP_NAME.
>
> Is there a way to handle this scenario with the current infrastructure? If
> not, is something like the attached (untested) patch reasonable?
>
> Aldy