avr-libc-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-commit] [2425] * include/stdint.h (INT8_C): Also define for __


From: Joern Rennecke
Subject: [avr-libc-commit] [2425] * include/stdint.h (INT8_C): Also define for __cplusplus >= 201103L.
Date: Thu, 01 May 2014 12:44:16 +0000

Revision: 2425
          http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2425
Author:   amylaar
Date:     2014-05-01 12:44:15 +0000 (Thu, 01 May 2014)
Log Message:
-----------
        * include/stdint.h (INT8_C): Also define for __cplusplus >= 201103L.
        If __INT8_C is defined, use GNU C preprocessor builtin-macro
        for the definition.
        (INT16_C INT32_C, INT64_C, UINT8_C, UINT16_C, UINT32_C): Likewise.
        (UINT64_C, INTMAX_C, UINTMAX_C): Likewise.

Modified Paths:
--------------
    trunk/avr-libc/ChangeLog
    trunk/avr-libc/include/stdint.h

Modified: trunk/avr-libc/ChangeLog
===================================================================
--- trunk/avr-libc/ChangeLog    2014-04-29 13:08:15 UTC (rev 2424)
+++ trunk/avr-libc/ChangeLog    2014-05-01 12:44:15 UTC (rev 2425)
@@ -1,3 +1,11 @@
+2014-05-01  Joern Rennecke <address@hidden>
+
+       * include/stdint.h (INT8_C): Also define for __cplusplus >= 201103L.
+       If __INT8_C is defined, use GNU C preprocessor builtin-macro
+       for the definition.
+       (INT16_C INT32_C, INT64_C, UINT8_C, UINT16_C, UINT32_C): Likewise.
+       (UINT64_C, INTMAX_C, UINTMAX_C): Likewise.
+
 2014-04-29  Aurelien Jarno  <address@hidden>
 
        * include/util/setbaud.h: correct typo.

Modified: trunk/avr-libc/include/stdint.h
===================================================================
--- trunk/avr-libc/include/stdint.h     2014-04-29 13:08:15 UTC (rev 2424)
+++ trunk/avr-libc/include/stdint.h     2014-05-01 12:44:15 UTC (rev 2425)
@@ -1,6 +1,7 @@
 /* Copyright (c) 2002,2004,2005 Marek Michalkiewicz
    Copyright (c) 2005, Carlos Lamas
    Copyright (c) 2005,2007 Joerg Wunsch
+   Copyright (c) 2013 Embecosm
    All rights reserved.
 
    Redistribution and use in source and binary forms, with or without
@@ -594,7 +595,8 @@
 
 #endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */
 
-#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
+#if (!defined __cplusplus || __cplusplus >= 201103L \
+     || defined __STDC_CONSTANT_MACROS)
 
 /** \name Macros for integer constants
     C++ implementations should define these macros only when
@@ -603,6 +605,20 @@
     These definitions are valid for integer constants without suffix and
     for macros defined as integer constant without suffix */
 
+/* The GNU C preprocessor defines special macros in the implementation
+   namespace to allow a definition that works in #if expressions.  */
+#ifdef __INT8_C
+#define INT8_C(c) __INT8_C(c)
+#define INT16_C(c) __INT16_C(c)
+#define INT32_C(c) __INT32_C(c)
+#define INT64_C(c) __INT64_C(c)
+#define UINT8_C(c) __UINT8_C(c)
+#define UINT16_C(c) __UINT16_C(c)
+#define UINT32_C(c) __UINT32_C(c)
+#define UINT64_C(c) __UINT64_C(c)
+#define INTMAX_C(c) __INTMAX_C(c)
+#define UINTMAX_C(c) __UINTMAX_C(c)
+#else
 /** \ingroup avr_stdint
     define a constant of type int8_t */
 
@@ -665,9 +681,12 @@
 
 #define UINTMAX_C(value) __CONCAT(value, ULL)
 
+#endif /* !__INT8_C */
+
 /address@hidden/
 
-#endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */
+#endif /* (!defined __cplusplus || __cplusplus >= 201103L \
+          || defined __STDC_CONSTANT_MACROS) */
 
 
 #endif /* _STDINT_H_ */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]