This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH to libiberty: Move to the intersection of C90 an C++
On Tue, May 24, 2005 at 07:15:40PM +0200, Gabriel Dos Reis wrote:
> Ian Lance Taylor <ian@airs.com> writes:
>
> | Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
> |
> | > But, that is indeed poor. So, let me try again.
> | > Currently (i.e. without my patch), they are defined as
> | >
> | > inline size_t
> | > htab_size (htab_t htab)
> | > {
> | > return htab->size;
> | > }
> | >
> | > inline size_t
> | > htab_elements (htab_t htab)
> | > {
> | > return htab->n_elements - htab->n_deleted;
> | > }
> |
> | Yes, but, as you know, that is in hashtab.c, not hashtab.h. I don't
> | see any reason they need to be in hashtab.h at all.
> |
> | > I supposed that it was for performance reason why they were
> | > defined inline in hashtab.c, which is why I moved them to hashtab.h
> | > with the "static inline" marker. They won't pose any problem with a
> | > C90 compiler that does not understand inline, and they won't cause any
> | > problem with a C90 compiler that does. I'm also willing to turn them
> | > into macros if you prefer.
> |
> | If we want them in hashtab.h, then I think they should be macros. But
> | upon further reflection, I'm pretty sure we don't want them in
> | hashtab.h at all, and I think we should just remove "inline" in
> | hashtab.c.
>
> I'll implement that (which is also what Jakub says). Thanks,
Well, if we really can't use inline keyword just in hashtab.c,
I think best would be to use a macro.
#define htab_size(htab) ((htab)->size)
size_t
(htab_size) (htab_t htab)
{
return htab_size (htab);
}
and similarly for htab_elements.
Jakub