Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 5 Mar 2019 22:39:28 +0100
From: Sebastian Kemper <sebastian_ml@....net>
To: musl@...ts.openwall.com
Subject: Re: Asterisk 16 function redefines

On Tue, Mar 05, 2019 at 09:56:01PM +0100, Szabolcs Nagy wrote:
> * Markus Wichmann <nullplan@....net> [2019-03-05 21:05:30 +0100]:
> > On Tue, Mar 05, 2019 at 08:28:50PM +0100, Sebastian Kemper wrote:
> > > #define calloc(nmemb, size) \
> > > 	__ast_repl_calloc(nmemb, size, __FILE__, __LINE__, __PRETTY_FUNCTION__)
> > > #define malloc(size) \
> > > 	__ast_repl_malloc(size, __FILE__, __LINE__, __PRETTY_FUNCTION__)
> > > #define free(ptr) \
> > > 	__ast_free(ptr, __FILE__, __LINE__, __PRETTY_FUNCTION__)
> > > 
> > > Compile output example:
> > > 
> > > /home/sk/tmp/openwrt/staging_dir/toolchain-mips_24kc_gcc-7.4.0_musl/include/sched.h:76:28: error: expected declaration specifiers or '...' before string constant
> > >  void *calloc(size_t, size_t);
> > >                             ^
> > 
> > Welcome to the wonderful world of the preprocessor. The define above is
> > in effect here, so the compiler never sees the valid function prototype,
> > the compiler sees
> > 
> > void *__ast_repl_calloc(size_t, size_t, "sched.h", 76, "");
> > 
> > And can't deal with that. Maybe they should include the replacements as
> > the very last thing.
> 
> yeah that's one solution: don't include libc
> headers after these macros (it may require
> significant changes though, a quick workaround
> hack is to preinclude sched.h before the
> macros)

Hello Szabolcs,

That indeed solves the compile problem. Thank you very much! When I read
your reply it started to make sense :) Thanks to Markus as well, of
course. I needed the explicit instruction ("include sched.h") to get the
picture.

Kind regards,
Seb

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.