Dead code (was: Re: Good numbers from Ritter's new string allocator)
Alexandre Oliva
aoliva@redhat.com
Fri Nov 23 16:20:00 GMT 2001
On Nov 29, 2001, Paolo Carlini <pcarlini@unitus.it> wrote:
> So: do you think it would be feasible for you to contribute to the
> project?
I've just given it a look, and I'm afraid I foresee some
difficulties.
First of all, since this is code in libstdc++, we can't just link
libiberty in, because there are licensing issues that might have to be
resolved. We'd probably be better off just compiling in this
particular module of libiberty along with libstdc++. And we should
probably use the C compiler to compile that, in order to avoid issues
such as getpagesize() not being declared.
What I'd recomment is to add a new C source file to libstdc++ with
contents such as:
#ifdef HAVE_CONFIG_H
#include <config.h>
#undef HAVE_CONFIG_H
#endif
#if ! HAVE_GETPAGESIZE
/* Don't introduce this function in libstdc++. */
static int getpagesize(void);
#include "..../libiberty/getpagesize.c"
#endif
int
__libstdcxx_getpagesize()
{
return getpagesize();
}
Then, add to libstdc++'s configure.in the following chunk of code, if
there's nothing similar already there:
AC_LANG_SAVE
AC_LANG_C
AC_CHECK_HEADERS([unistd.h sys/param.h])
AC_CHECK_FUNCS([getpagesize sysconf])
AC_LANG_RESTORE
Then, instead of calling getpagesize(), you'd declare
extern "C" int __libstdcxx_getpagesize(void);
and call this function wherever you'd call getpagesize().
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me
More information about the Libstdc++
mailing list