[cfe-commits] [PATCH] First OpenMP patch

Hal Finkel hfinkel at anl.gov
Wed Nov 21 12:39:48 PST 2012


----- Original Message -----
> From: "Dmitri Gribenko" <gribozavr at gmail.com>
> To: "Mahesha HS" <mahesha.llvm at gmail.com>
> Cc: "Benjamin Kramer" <benny.kra at gmail.com>, "llvm cfe" <cfe-commits at cs.uiuc.edu>
> Sent: Wednesday, November 21, 2012 11:06:50 AM
> Subject: Re: [cfe-commits] [PATCH] First OpenMP patch
> 
> On Wed, Nov 21, 2012 at 6:02 PM, Mahesha HS <mahesha.llvm at gmail.com>
> wrote:
> > Though -fopenmp and -fno-openmp are mutually exclusive options,
> > underlying functionality, that we intended to implement differ a
> > little. In a nutshell, we, sometime back discussed in CFE DEV list
> > to
> > implement OpenMP as follows. We thought that passing neither
> > -fopenmp
> > nor -fno-openmp  is not same as passing only -fno-openmp.
> >  Following
> > is the intended implementation. This forced me to add two lang
> > options
> > as I could not handle it using only one lang option. If this was
> > not
> > there, I guess, all your comments would not have araised.
> >
> > if (source contains OpenMP statements) {
> >      if (neither -fopenmp nor -fno-openmp present) {
> >          Throw warning.
> >      }
> >      else if (only -fopenmp present) {
> >          Process OpenMP
> >      }
> >      else if (only -fno-openmp) {
> >         Silently ignore OpenMP. Do not throw warning.
> >      }
> >     else if (both -fopenmp and -fno-openmp are present) {
> >         Decide based on which one appears later in the command
> >         line.
> >     }
> > }
> 
> I think the implementation should use the general diagnostics
> infrastructure.  For example, by default add something like
> -Wsource-uses-openmp and disable it in case of -fno-openmp.
> 
> $ g++ -W -Wall /tmp/zzz.cc
> /tmp/zzz.cc:3:0: warning: ignoring #pragma omp barrier
> [-Wunknown-pragmas]
> 
> By the way, the algorithm above is not consistent with gcc, which
> ignores the pragma when no -f flag is passed.

I think that we'd like to act the way that gcc does, except that we don't want to warn about unused OpenMP pragmas when -fno-openmp is given even if -Wall is also specified.

 -Hal

> 
> Dmitri
> 
> --
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 

-- 
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory



More information about the cfe-commits mailing list