Opened 12 years ago

Last modified 7 years ago

#587 closed defect (Fixed)

osx warns on malloc_good_size declaration

Reported by: phobos Owned by:
Priority: Low Milestone:
Component: Core Tor/Tor Version: 0.2.0.9-alpha
Severity: Keywords:
Cc: phobos, nickm Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

util.c: In function '_tor_malloc_roundup':
util.c:234: warning: implicit declaration of function 'malloc_good_size'

/usr/include/malloc/malloc.h

size_t (*good_size)(malloc_zone_t *zone, size_t size);

checking malloc/malloc.h usability... yes
checking malloc/malloc.h presence... yes
checking for malloc/malloc.h... yes

and orconfig.h has:

#define HAVE_MALLOC_MALLOC_H 1

[Automatically added by flyspray2trac: Operating System: OSX 10.4 Tiger]

Child Tickets

Change History (13)

comment:1 Changed 12 years ago by nickm

Is HAVE_MALLOC_GOOD_SIZE defined?

comment:2 Changed 12 years ago by nickm

Also, my osx has a declaration for malloc_good_size in its malloc/malloc.h header in addition to the function pointer
thing you paste above. Can you check whether that's not so for yours?

comment:3 Changed 12 years ago by phobos

Yes, my both of my OSX machines have malloc/malloc.h. And yes, HAVE_MALLOC_GOOD_SIZE is defined in orconfig.h.

comment:4 Changed 12 years ago by arma

Andrew: Nick asked if your malloc/malloc.h had a declaration as well as
a function pointer.

Nick: perhaps you can paste what it looks like so Andrew is more likely to
answer usefully?

Andrew: exactly what OS X version is this? Does it give you this warning on
both panther and tiger?

Nick: does it not give you any sort of warning on your OS X? Do you use tiger?

comment:5 Changed 12 years ago by nickm

andrew: Could you just mail me your malloc/malloc.h?

It works fine for me, with no warning. I use tiger.

comment:6 Changed 12 years ago by phobos

This is on 10.3 (panther) and 10.4 (tiger). I pasted above the only time "good_size" shows up in the malloc.h.
I'll mail it shortly.

comment:7 Changed 12 years ago by nickm

Ah. I'm on 10.5, where it works fine.

My malloc/malloc.h has a prototype as follows:

extern size_t malloc_good_size(size_t size);

It looks like phobos's malloc/malloc.h lacks this.

comment:8 Changed 12 years ago by nickm

Phobos: can you use find and grep to see if _any_ of your header files declare it? Something like this should
work:

find /usr/include/ |xargs grep malloc_good_size

Thanks!

comment:9 Changed 12 years ago by phobos

none of the header files in /usr/include declare malloc_good_size.

comment:10 Changed 12 years ago by nickm

Should be fixed in r13339. Give it a try?

(Short version: looks like this was apple's fault.)

comment:11 Changed 12 years ago by phobos

yes, fixed. thanks.

comment:12 Changed 12 years ago by phobos

flyspray2trac: bug closed.

comment:13 Changed 7 years ago by nickm

Component: Tor ClientTor
Note: See TracTickets for help on using tickets.