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: __INT_FAST*_TYPE__ undefined


Hey Kevin,

On Aug 21 11:41, Kévin wrote:
> Hi,
> 
> I have an issue with compiling using newlib and stdint.
> 
> issue
> -----
> 
> when I compile against newlib I get the following error:
> 
> clang -target arm-none-eabi -Os -g -std=c99 -nostdlib -nostdinc -fno-common -ffunction-sections -fdata-sections -ffreestanding -Wpedantic -Wall -Werror -Wextra -Wundef -Wshadow -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -Wstrict-overflow=5 -I/usr/include/newlib/ -I/usr/lib/gcc/arm-none-eabi/*/include/ -I. -mthumb -mcpu=cortex-m3 -o global.o -c global.c
> In file included from global.c:21:
> In file included from /usr/include/newlib/stdint.h:13:
> /usr/include/newlib/sys/_intsup.h:118:6: error: '__INT_FAST8_TYPE__' is not defined, evaluates to 0 [-Werror,-Wundef]
> #if (__INT_FAST8_TYPE__ == 0)
> ...
> 
> analysis
> --------
> 
> global.c:21 is the following
> #include <stdint.h> // standard integer types
> 
> I am not using the system library but newlib (-nostdlib -nostdinc -I/usr/include/newlib/)
> thus the stdint.h included is /usr/include/newlib/stdint.h
> 
> stdint.h has the following (unconditional) include:
> #include <sys/_intsup.h>
> 
> _intsup.h has the following defines:
> #if (__INT_FAST8_TYPE__ == 0)
> #define __FAST8 "hh"
> #elif (__INT_FAST8_TYPE__ == 1 || __INT_FAST8_TYPE__ == 3)
> #define __FAST8 "h"
> #elif (__INT_FAST8_TYPE__ == 2)
> #define __FAST8
> #elif (__INT_FAST8_TYPE__ == 4 || __INT_FAST8_TYPE__ == 6)
> #define __FAST8 "l"
> #elif (__INT_FAST8_TYPE__ == 8 || __INT_FAST8_TYPE__ == 10)
> #define __FAST8 "ll"
> #endif
> this applies to other _INT_FAST and _INT_LEAST
> 
> but __INT_FAST8_TYPE__ is not defined anywhere in newlib, thus clang complains because I am using (-Werror -Wundef).
> 
> solution
> --------
> 
> __INT_FAST8_TYPE__ might be defined in another library such but not in the ones I use/include.

__INT_FAST8_TYPE__ is a GCC builtin, and I'd expect that clang follows suit.
IMHO this is a bug in the compiler.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: signature.asc
Description: PGP signature


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