URL:
  <http://savannah.nongnu.org/bugs/?36571>

                 Summary: stdint.h: INTn_C not standard compliant
                 Project: AVR C Runtime Library
            Submitted by: gjlayde
            Submitted on: Do 31 Mai 2012 20:02:57 GMT
                Category: Header
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Header files
                  Status: None
        Percent Complete: 0%
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 1.8.0
           Fixed Release: None

    _______________________________________________________

Details:

C99: 7.18.4 Macros for integer constants

writes in clause #3 on the INTn_C function-like macros: 

Each invocation of one of these macros shall expand
to an integer constant expression suitable for use
in #if preprocessing directives.

However, stdint.h defines respective macros like so

#define INT8_C(value) ((int8_t) value)

which cannot be used in #if preprocessing directives.

FYI, avr-gcc built-in defines similar macros like so, provided -mint8 is off:

$ echo | avr-gcc -x c - -E -dM | sort | grep 'INT.*_C'

#define __INT8_C(c) c
#define __INT16_C(c) c
#define __INT32_C(c) c ## L
#define __INT64_C(c) c ## LL
#define __INTMAX_C(c) c ## LL
#define __UINT8_C(c) c
#define __UINT16_C(c) c ## U
#define __UINT32_C(c) c ## UL
#define __UINT64_C(c) c ## ULL
#define __UINTMAX_C(c) c ## ULL

With -mint8 on, it should be something around (no appropriate compiler handy
at the moment)

#define __INT8_C(c) c
#define __INT16_C(c) c ## L
#define __INT32_C(c) c ## LL
#define __INTMAX_C(c) c ## LL
#define __UINT8_C(c) c ## U
#define __UINT16_C(c) c ## UL
#define __UINT32_C(c) c ## ULL
#define __UINTMAX_C(c) c ## ULL

So avr-libc could adopt these or just

#define INT8_C(c) __INT8_C(c)

which works since gcc 4.5, maybe also 4.4.







    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?36571>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
AVR-libc-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to