[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: kalloc.c and recent gcc's

From: Thomas Schwinge
Subject: Re: kalloc.c and recent gcc's
Date: Mon, 29 Aug 2005 00:49:42 +0200
User-agent: Mutt/1.5.9i

Note that this is not my patch we're discussing, but as Alfred is
currently on vacations, ...

On Sun, Aug 28, 2005 at 02:51:37PM -0700, Thomas Bushnell BSG wrote:
> Thomas Schwinge <schwinge-lists-gnu.org-bug-hurd@nic-nac-project.de> writes:
> >> > +void (*__malloc_initialize_hook) (void) = (void *) init_hook;
> >> 
> >> Do you really need the void * cast?
> > The cast avoids the following warning:
> > [...]
> Ideally, fix the declaration of init_hook.

That's exactly where the problem lies.
Alfred seems to have created the patch using glibc's documentation as an
example, only that there is an error in that documentation:
     /* Prototypes for __malloc_hook, __free_hook */
     #include <malloc.h>
     /* Prototypes for our hooks.  */
     static void *my_init_hook (void);
     /* Override initializing hook from the C library. */
     void (*__malloc_initialize_hook) (void) = my_init_hook;
     static void
     my_init_hook (void)

I'll report that in glibc's bugzilla.

So, we need the following:
static void init_hook (void);
void (*__malloc_initialize_hook) (void) = init_hook;
static void
init_hook (void) {

Can we be sure that we don't have to also hook realloc() and memalign()?

> Failing that, at least
> give a correct cast instead of kludging with void *.
> void (*__malloc_initialize_hook) (void) = (void (*)(void)) init_hook;

That's also what I did before having a look at glibc's documentation.

Neal, could you please fix the patch accordingly before checking it in?
Or is some testing needed?  (I don't know how to do that, here.)

> Thomas

(Recycled.  ;-)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]