This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Warn about unclosed pragma omp declare target.
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Ilya Tocar <tocarip dot intel at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Ilya Verbin <iverbin at gmail dot com>
- Date: Mon, 2 Feb 2015 13:05:00 +0100
- Subject: Re: [PATCH] Warn about unclosed pragma omp declare target.
- Authentication-results: sourceware.org; auth=none
- References: <20140729144501 dot GA102135 at msticlxl7 dot ims dot intel dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Jul 29, 2014 at 06:45:01PM +0400, Ilya Tocar wrote:
> Hi,
>
> As discussed here in https://gcc.gnu.org/ml/gcc/2014-01/msg00189.html
> Gcc should complain about pragma omp declare target without
> corresponding pragma omp end declare target. This patch adds a warning
> for those cases.
> Bootstraps/passes make-check.
> Ok for trunk?
>
> ChangeLog:
>
> 2014-07-29 Ilya Tocar <ilya.tocar@intel.com>
>
> * c-decl.c (omp_declare_target_location_stack): New.
> * c-lang.h (omp_declare_target_location_stack): Declare.
> * c-parser.c (warn_unclosed_pragma_omp_target): New.
> (c_parser_translation_unit): Call it.
> (c_parser_omp_declare_target): Remeber location.
> (c_parser_omp_end_declare_target): Forget location.
Sorry for the long delay on this.
Can you check what will happen if you have unclosed #pragma omp declare target
in some header you precompile? If you get the warning during the header
compilation and then not during compilation using that PCH header,
supposedly it might be fine and the patch might be ok as is.
I mean something like
a.h:
#pragma omp declare target
int i;
a.c:
#include "a.c"
#pragma omp declare target
int j;
#pragma omp declare target
int k;
int
main ()
{
}
gcc -fopenmp -o a.gch a.h
gcc -fopenmp -o a a.c
If we wanted to warn even on a.c, supposedly the vector would need to be
marked for GC.
Jakub