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++
- From: Ian Lance Taylor <ian at airs dot com>
- To: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Cc: gcc-patches at gcc dot gnu dot org, DJ Delorie <dj at delorie dot com>
- Date: 24 May 2005 09:52:00 -0400
- Subject: Re: PATCH to libiberty: Move to the intersection of C90 an C++
- References: <m3br715nhf.fsf@uniton.integrable-solutions.net>
Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
> -extern size_t htab_size (htab_t);
> -extern size_t htab_elements (htab_t);
> extern double htab_collisions (htab_t);
>
> +
> +/* Return the current size of given hash table. */
> +
> +static inline size_t
> +htab_size (htab_t htab)
> +{
> + return htab->size;
> +}
> +
> +/* Return the current number of elements in given hash table. */
> +
> +static inline size_t
> +htab_elements (htab_t htab)
> +{
> + return htab->n_elements - htab->n_deleted;
> +}
> +
This seems like an unrelated change. Why make it? In libiberty we
try to be backward compatible to C90 compilers, and they won't
understand inline. If there is a performance advantage here, let's
just use a preprocessor macro. Otherwise, I don't think this is
related to converting to C++.
I see that you removed the functions in hashtab.c. I think we might
just as well not mark them inline in hashtab.c, if that is what it
takes to fix this for C++.
The other changes are OK. Thanks.
Ian