This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: target ARM-none-eabi warning: implicit declaration of function 'MIN'


On 14/04/14 15:03, Corinna Vinschen wrote:
> On Apr 12 13:45, Martin Velek wrote:
>> Hello,
>>
>> I am traying to build newlib 2.1.0 with arm-none-eabi-gcc -v version
>> 4.8.3 20140228 (release) [ARM/embedded-4_8-branch revision 208322]
>> (GNU Tools for ARM Embedded Processors)
>>
>> ./configure --target=arm-none-eabi --disable-newlib-supplied-syscalls
>> --with-gnu-ld --with-gnu-as --disable-shared
>> --enable-newlib-io-long-long --disable-nls --enable-newlib-reent-small
>> --disable-libgloss --enable-newlib-io-c99-formats
>> --disable-newlib-atexit-dynamic-alloc --enable-newlib-global-atexit
>> --enable-newlib-reent-small --disable-newlib-wide-orient
>> --disable-multilib --enable-newlib-multithread --enable-lite-exit
>> --with-cpu=cortex-m3 --with-mode=thumb --disable-multilib
>> --with-float=soft --disable-libssp --with-no-thumb-interwork
>> --enable-newlib-register-fini --disable-newlib-mb
>> --disable-newlib-unbuf-stream-opt CFLAGS_FOR_TARGET="-DMALLOC_PROVIDED
>> -DREENTRANT_SYSCALLS_PROVIDED -D__FILENAME_MAX__=256 -fstack-usage
>> -ffunction-sections -fdata-sections -Wstack-usage=512 -mcpu=cortex-m3
>> -mthumb -std=gnu99 -mfloat-abi=soft -nostdlib -g3"
>>
>> [NOTE: I have collected these options from Internet, some of them may
>> be redundant, without effect, etc.]
>>
>> I got warning:
>>
>> ../../../.././newlib/libc/search/hash_bigkey.c: In function '__big_insert':
>> ../../../.././newlib/libc/search/hash_bigkey.c:111:3: warning:
>> implicit declaration of function 'MIN'
>> [-Wimplicit-function-declaration]
>>    move_bytes = MIN(space, key_size);
>>    ^
>>
>> It is caused by missing MIN macro definition in newlib/libc/sys/arm/sys/param.h.
> 
> Hey ARM devs, would it make sense to add the macros, like this?
> 
> Index: libc/sys/arm/sys/param.h
> ===================================================================
> RCS file: /cvs/src/src/newlib/libc/sys/arm/sys/param.h,v
> retrieving revision 1.4
> diff -u -p -r1.4 param.h
> --- libc/sys/arm/sys/param.h	2 Feb 2005 19:00:30 -0000	1.4
> +++ libc/sys/arm/sys/param.h	14 Apr 2014 14:03:01 -0000
> @@ -16,4 +16,7 @@
>  #define BYTE_ORDER LITTLE_ENDIAN
>  #endif
>  
> +#define MAX(a,b) ((a) > (b) ? (a) : (b))
> +#define MIN(a,b) ((a) < (b) ? (a) : (b))
> +
>  #endif
> 
> 
> Corinna
> 


It seems a little odd to me that such generic definitions have to come
from machine-specific headers.

Other than that, I have no objections.

R.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]