diff options
author | Joel Sherrill <joel@rtems.org> | 2017-04-14 13:55:48 -0500 |
---|---|---|
committer | Joel Sherrill <joel@rtems.org> | 2017-04-18 11:24:44 -0500 |
commit | 54bdf0c7e5d689da76d41ccbbf2c9dc830fd8c4e (patch) | |
tree | 9df296747c4d42e9580c04ad5f7d4e1ca469b532 /cpukit/include/rtems/inttypes.h | |
parent | testsuite: Fix rtems-test-check not excluding tests. (diff) | |
download | rtems-54bdf0c7e5d689da76d41ccbbf2c9dc830fd8c4e.tar.bz2 |
rtems/inttypes.h: New file. Uses contents from cpukit
Provide extentions to <inttpes.h> PRIxxx constants for more POSIX types.
Start with existing definitions found in RTEMS Project owned code
in cpukit/.
updates #2983.
Diffstat (limited to 'cpukit/include/rtems/inttypes.h')
-rw-r--r-- | cpukit/include/rtems/inttypes.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/cpukit/include/rtems/inttypes.h b/cpukit/include/rtems/inttypes.h new file mode 100644 index 0000000000..19022afc54 --- /dev/null +++ b/cpukit/include/rtems/inttypes.h @@ -0,0 +1,78 @@ +/** + * @file rtems/inttypes.h + * + * @brief Provide printf() PRIxxx Constante Beyond Standards + * + * This include file defines PRIxxx constants beyond those in + * the C and POSIX standards. These are used to write portable + * printf() format strings for POSIX and RTEMS types not in + * <inttypes.h> + */ + +/* + * COPYRIGHT (c) 2017 On-Line Applications Research Corporation. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#ifndef _RTEMS_INTTYPES_H +#define _RTEMS_INTTYPES_H + +#include <inttypes.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup RTEMS inttypes.h Extensions + * + * This module defines portable PRIxxx constants beyond those + * in the C and POSIX standard. + */ + +/** Helper macro to print "modet" in octal */ +#if SIZEOF_MODE_T == 8 +#define PRIomode_t PRIo64 +#elif SIZEOF_MODE_T == 4 +#define PRIomode_t PRIo32 +#else +#error "PRIomode_t: unsupport size of mode_t" +#endif + +/** Helper macro to print "off_t" in octal */ +#if SIZEOF_OFF_T == 8 +#define PRIooff_t PRIo64 +#elif SIZEOF_OFF_T == 4 +#define PRIooff_t PRIo32 +#else +#error "PRIooff_t: unsupported size of off_t" +#endif + +/** Helper macro to print "off_t" in decimal */ +#if SIZEOF_OFF_T == 8 +#define PRIdoff_t PRId64 +#elif SIZEOF_OFF_T == 4 +#define PRIdoff_t PRId32 +#else +#error "PRIdoff_t: unsupported size of off_t" +#endif + +/** Helper macro to print "time_t" in decimal */ +#if SIZEOF_TIME_T == 8 +#define PRIdtime_t PRId64 +#elif SIZEOF_TIME_T == 4 +#define PRIdtime_t PRId32 +#else +#error "PRIdtime_t: unsupported size of time_t" +#endif + +/**@}*/ + +#ifdef __cplusplus +} +#endif + +#endif |