On Fri, Dec 30, 2022 at 12:21:37PM -0500, Lewis Hyatt via Gcc-patches wrote:
> libcpp's directives-only mode does not expect deferred pragmas to be
> registered, but to date the c-family registration process has not checked for
> this case. That issue became more visible since r13-1544, which added the
> commonly used GCC diagnostic pragmas to the set of those registered in
> preprocessing modes. Fix it by checking for directives-only mode in
> c-family/c-pragma.cc.
> 
> gcc/c-family/ChangeLog:
> 
>       PR preprocessor/108244
>       * c-pragma.cc (c_register_pragma_1): Don't attempt to register any
>       deferred pragmas if -fdirectives-only.
>       (init_pragma): Likewise.
> 
> gcc/testsuite/ChangeLog:
> 
>       * c-c++-common/cpp/pr108244-1.c: New test.
>       * c-c++-common/cpp/pr108244-2.c: New test.
>       * c-c++-common/cpp/pr108244-3.c: New test.

Ok, with a nit:

> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/cpp/pr108244-3.c
> @@ -0,0 +1,6 @@
> +/* { dg-do preprocess } */
> +/* { dg-additional-options "-fdirectives-only -fopenmp" } */
> +/* { dg-require-effective-target "fopenmp" } */
> +#pragma omp parallel
> +#ifdef t
> +#endif

This test should be in gcc/testsuite/c-c++-common/gomp/
directory instead, without the dg-require-effective-target.

        Jakub

Reply via email to