[PATCH] [OPENMP] Fix for parsing OpenMP directives with extra braces, brackets and parens

Hal Finkel hfinkel at anl.gov
Tue Nov 5 00:12:06 PST 2013


----- Original Message -----
> 
> 
> ================
> Comment at: include/clang/Parse/Parser.h:638
> @@ -637,3 +637,3 @@
>    /// SkipToTok is specified, it calls SkipUntil(SkipToTok).
>     Finally, true is
>    /// returned.
>    bool ExpectAndConsume(tok::TokenKind ExpectedTok, unsigned Diag,
> ----------------
> hfinkel at anl.gov wrote:
> > Please describe what NoCount does here.
> Ok
> 
> ================
> Comment at: include/clang/Parse/Parser.h:746
> @@ -744,3 +745,3 @@
>    /// If SkipUntil finds the specified token, it returns true,
>    otherwise it
>    /// returns false.
>    bool SkipUntil(tok::TokenKind T, bool StopAtSemi = true,
> ----------------
> hfinkel at anl.gov wrote:
> > And also describe NoCount here (as with the other parameters).
> Ok
> 
> ================
> Comment at: lib/Parse/ParseOpenMP.cpp:181
> @@ -179,2 +180,3 @@
> +    SkipUntil(tok::annot_pragma_openmp_end, false, false, false,
> true);
>      break;
>    }
> ----------------
> hfinkel at anl.gov wrote:
> > This is not your fault, but these boolean parameters are becoming
> > increasingly difficult to read.  I'm afraid that adding one more
> > may push this over the limit into problems. I'd prefer that,
> > before making this change, we change the current code to use some
> > bit values that can be or'd together.
> Ok, I'll rework it for the bit values.
> 
> ================
> Comment at: test/OpenMP/threadprivate_messages.cpp:28
> @@ +27,3 @@
> +#pragma omp threadprivate (a) ( // expected-error {{'#pragma omp
> threadprivate' must precede all references to variable 'a'}}
> expected-warning {{extra tokens at the end of '#pragma omp
> threadprivate' are ignored}}
> +#pragma omp threadprivate (a) [ // expected-error {{'#pragma omp
> threadprivate' must precede all references to variable 'a'}}
> expected-warning {{extra tokens at the end of '#pragma omp
> threadprivate' are ignored}}
> +#pragma omp threadprivate (a) { // expected-error {{'#pragma omp
> threadprivate' must precede all references to variable 'a'}}
> expected-warning {{extra tokens at the end of '#pragma omp
> threadprivate' are ignored}}
> ----------------
> hfinkel at anl.gov wrote:
> > I don't understand why there is both an error and a warning here.
> > Can we get rid of the 'extra tokens' warning? That's misleading
> > because the syntax is fine, the error is semantic.
> I don't think you're right. Actually, there are 2 troubles with this
> code:
> 1. Reference to variable that have been used already.
> 2. Extra symbols at the end of directives ({, ), ] or } ).
> I think we have to report about both bugs, though for the last one we
> should emit a warning message, not error (just like for all other
> pragmas).

You're right; I missed the extra '(', etc.

 -Hal

> 
> 
> http://llvm-reviews.chandlerc.com/D1847
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the cfe-commits mailing list