[En-Nut-Discussion] calloc and toolchain.h

Harald Kipp harald.kipp at egnite.de
Sat Feb 9 11:17:10 CET 2013


Hi Uwe,

On 06.02.2013 14:30, Uwe Bonnes wrote:

> httpserv.c:188:5: warning: implicit declaration of function 'calloc' [-Wimplicit-function-declaration]
> httpserv.c:188:13: warning: incompatible implicit declaration of built-in function 'calloc' [enabled by default]
> httpserv.c:229:5: warning: implicit declaration of function 'free' [-Wimplicit-function-declaration]
> httpserv.c:229:5: warning: incompatible implicit declaration of built-in function 'free' [enabled by default]
> 
> Searching for teh definition of calloc, I see toolchain.h involved. As you
> did some recent changes around toolchain.c, can you perhaps explain what
> needs to be included or configured to remove above warnings?

Although heap memory functions are provided by Nut/OS, the function
prototypes are taken from the standard C library header stdlib.h, if it
is provided by the related library and includes all standard functions.
This is true for all newlib based toolchains.

To minimize dependencies, application code should not rely on indirectly
included headers, but include all required API prototypes. Of course,
there are exceptions. For example, if a header file includes function
protos based on stdio FILE pointers, the application itself don't need
and must not be forced to include stdio.h.

The reported problem is fixed in r4982.

Regards,

Harald




More information about the En-Nut-Discussion mailing list