On Thu, Nov 13, 2014 at 02:38:06PM +0100, Thomas Schwinge wrote:
> Hi Jakub!
> 
> On Thu, 13 Nov 2014 14:10:10 +0100, Jakub Jelinek <ja...@redhat.com> wrote:
> > On Thu, Nov 13, 2014 at 01:19:55PM +0100, Thomas Schwinge wrote:
> > > --- include/gomp-constants.h
> > > +++ include/gomp-constants.h
> > > @@ -28,6 +28,9 @@
> > >  /* Enumerated variable mapping types used to communicate between GCC and
> > >     libgomp.  These values are used for both OpenMP and OpenACC.  */
> > >  
> > > +#define _GOMP_MAP_FLAG_SPECIAL           (1 << 2)
> > > +#define _GOMP_MAP_FLAG_FORCE             (1 << 3)
> > 
> > I'm worried about reserved namespace issues if you use _ followed by
> > capital letter.
> 
> Please remind me what those are reserved for?

See e.g.
http://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html
http://pubs.opengroup.org/onlinepubs/007904975/functions/xsh_chap02_02.html
and remember that if you use gomp-constants.h in the compiler, it can be
built by the system compiler, which can be a very different implementation.

> >  Can't it be just GOMP_MAP_FLAG_* ?
> 
> My worry is the other way round: gomp-constants.h is also #included from
> <openacc.h> (to grab some of its constants), and using plain GOMP_* would
> pollute the user's namespace?  (I'm working on a patch to clean that up,
> and also use gomp-constants.h more often, also for OpenMP code.)  (Such a
> shared (GCC/libgomp) header files had been discussed before, and now
> introduced in
> <http://news.gmane.org/find-root.php?message_id=%3C20140923191931.2177e60f%40octopus%3E>.)

I think including gomp-constants.h in openacc.h, if that is a publicly
installed header, is a bad idea, you'll pollute namespace of that header.
Just duplicate the values in there under the right standard required names,
and you want, either add a testcase or some static assertions (e.g.
of the kind extern char typedef1[condition ? 1 : -1]; in some macros)
to verify that the openacc.h constants match the gomp-constants.h where
required.

        Jakub

Reply via email to