This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gomp] Fix multiple threadprivate declarations (PR 24455)


On Thu, 2005-10-20 at 16:58 -0400, Diego Novillo wrote:
> On Thursday 20 October 2005 16:53, Richard Henderson wrote:
> 
> > The merge should happen in merge_decls and the error should be
> > *properly* checked in diagnose_mismatched_decls.  Your current
> > patch is clearly a hack in that it doesn't look like the others.
> >
> Yeah, I wasn't too convinced about that either.  OK, will re-arrange.
> 
> > > +/* Record whether a variable has been declared threadprivate by
> > > +   #pragma omp threadprivate.  */
> > > +#define CP_DECL_IS_THREADPRIVATE(DECL) \
> > > +  (DECL_DEBUG_EXPR_IS_FROM (VAR_DECL_CHECK (DECL)))
> >
> > This is bad.  See lang_decl_flags in cp-tree.h.  Do
> >
> They all Mean Something for VAR_DECLs, that's why I stole some other bit.
> 

If you start stealing bits like this in decl's again (i see you've since
changed it), I will seriously beat you senseless. It took me over a
month of hard work to untangle this stuff.  :).

I see you've noticed there is a place in the C+++ FE for C++ specific
bits, but if you run into the need to use non-language-specific bits on
VAR_DECL, remember:

VAR_DECL is derived from struct tree_decl_with_vis, which has 11 empty
bits if you needed them.  You don't need to go to tree_decl_common
anymore to find bits for most DECL node.  Look for the part labeled
"Belong to VAR_DECL exclusively"

We should use these bits, and give them good names, before we start
reusing them on other decl types. VAR_DECL is only sharing the
decl_with_vis structure with FUNCTION_DECL in reality, which means you
should be able to reuse them on both structures if necessary.

If and when they do need to get reused, they should be reused through a
separate macro name that happens to map to the same flag.  IMHO, in
addition, every reused bit should probably be renamed to something
generic, so people don't think that they still have a single specific
meaning just by looking at the field name.   I haven't done this yet,
but will probably do it for 4.2.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]