Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: 5.8: LTO exposes some new issues



> On 28 July 2020 at 08:53 Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> Roman Perepelitsa wrote on Mon, 27 Jul 2020 14:19 +0200:
> > +++ b/Src/zsh.h
> > @@ -1205,9 +1207,15 @@ struct hashtable {
> > -#ifdef HASHTABLE_INTERNAL_MEMBERS
> > -    HASHTABLE_INTERNAL_MEMBERS	/* internal use in hashtable.c                */
> > -#endif
> > +    /* HASHTABLE INTERNAL MEMBERS */
> > +    ScanStatus scan;		/* status of a scan over this hashtable       */
> > +
> > +#ifdef ZSH_HASH_DEBUG
> > +    /* Members of struct hashtable used for debugging hash tables           */ \
> > +    HashTable next, last;	/* linked list of all hash tables           */ \
> > +    char *tablename;		/* string containing name of the hash table */ \
> > +    PrintTableStats printinfo;	/* pointer to function to print table stats */
> > +#endif /* !ZSH_HASH_DEBUG */
> >  };
> 
> Thanks for looking into this.
> 
> It's clearly correct, but as written, the patch loses the distinction
> that these members are private to hashtable.c and should not be accessed
> by other parts of the code.  Could you address that, please?  If
> there's an easy way to have the compiler enforce this restriction,
> great; else, we can at least add a comment.

One way is to have a "struct { ... } private" substructure,
which it makes it clear what's going on within the code (though comments
are obviously useful, too).

pws



Messages sorted by: Reverse Date, Date, Thread, Author