How to detect prototype differences?

Thomas Klausner <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.archive-maintainers
Message-ID <[email protected]>
Hi!

I recently found out that the prototypes for backtrace and
backtrace_symbol differ on some operating systems.

These are the same:

Linux:
int backtrace(void **buffer, int size);
char **backtrace_symbols(void *const *buffer, int size);
void backtrace_symbols_fd(void *const *buffer, int size, int fd);

Mac OS X:
int backtrace(void **buffer, int size);
char **backtrace_symbols(void *const *buffer, int size);
void backtrace_symbols_fd(void* const* array, int size, int fd);

SunOS:
int backtrace(void **buffer, int size);
char **backtrace_symbols(void *const *buffer, int size);
void backtrace_symbols_fd(void *const *buffer, int size, int fd);

This one's different:

NetBSD:
size_t backtrace(void **addrlist, size_t len);
char **backtrace_symbols(void * const *addrlist, size_t len);
int backtrace_symbols_fd(void * const *addrlist, size_t len, int fd);

The main difference is that on NetBSD, size_t is used for most
arguments that are int on the other systems; also,
backtrace_symbols_fd returns an int.

I'd like to test for the difference int <-> size_t in a configure
script so I can get integer type/sign conversion-warnings free code on
all these operating systems.

I'm however not sure how to do this. Does anyone have a suggestion?

Thanks,
 Thomas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.