<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Apr 15, 2017 12:40 PM, "Gedare Bloom" <<a href="mailto:gedare@rtems.org" target="_blank">gedare@rtems.org</a>> wrote:<br type="attribution"><blockquote class="m_-5009122771107099974quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_-5009122771107099974quoted-text">On Sat, Apr 15, 2017 at 9:17 AM, Joel Sherrill <<a href="mailto:joel@rtems.org" target="_blank">joel@rtems.org</a>> wrote:<br>
> Provide extentions to <inttpes.h> PRIxxx constants for more POSIX types.<br>
</div>extensions<br>
inttypes.h<br>
<div class="m_-5009122771107099974elided-text"><br>
<br>
> Start with existing definitions found in RTEMS Project owned code<br>
> in cpukit/.<br>
><br>
> updates #2983.<br>
> ---<br>
> cpukit/Makefile.am | 1 +<br>
> cpukit/include/rtems/inttypes.<wbr>h | 78 +++++++++++++++++++++++++++++<br>
> cpukit/libdl/rtl-shell.c | 11 +---<br>
> cpukit/libfs/src/nfsclient/src<wbr>/dirutils.c | 19 +------<br>
> cpukit/libfs/src/rfs/rtems-rfs<wbr>-dir.c | 9 +---<br>
> cpukit/libfs/src/rfs/rtems-rfs<wbr>-rtems-file.c | 9 +---<br>
> cpukit/libfs/src/rfs/rtems-rfs<wbr>-rtems.c | 8 +--<br>
> cpukit/libmisc/shell/main_time<wbr>.c | 10 +---<br>
> cpukit/<a href="http://preinstall.am" rel="noreferrer" target="_blank">preinstall.am</a> | 4 ++<br>
> 9 files changed, 90 insertions(+), 59 deletions(-)<br>
> create mode 100644 cpukit/include/rtems/inttypes.<wbr>h<br>
><br>
> diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am<br>
> index 755bc11..1987586 100644<br>
> --- a/cpukit/Makefile.am<br>
> +++ b/cpukit/Makefile.am<br>
> @@ -111,6 +111,7 @@ include_rtems_debugger_HEADERS += libdebugger/rtems-debugger-rem<wbr>ote.h<br>
> endif<br>
><br>
> include_rtems_HEADERS += include/rtems/bspIo.h<br>
> +include_rtems_HEADERS += include/rtems/inttypes.h<br>
> include_rtems_HEADERS += include/rtems/print.h<br>
> include_rtems_HEADERS += include/rtems/printer.h<br>
> include_rtems_HEADERS += include/rtems/userenv.h<br>
> diff --git a/cpukit/include/rtems/inttype<wbr>s.h b/cpukit/include/rtems/inttype<wbr>s.h<br>
> new file mode 100644<br>
> index 0000000..19022af<br>
> --- /dev/null<br>
> +++ b/cpukit/include/rtems/inttype<wbr>s.h<br>
> @@ -0,0 +1,78 @@<br>
> +/**<br>
> + * @file rtems/inttypes.h<br>
> + *<br>
> + * @brief Provide printf() PRIxxx Constante Beyond Standards<br>
</div>Constants<br>
<div class="m_-5009122771107099974quoted-text"><br>
> + *<br>
> + * This include file defines PRIxxx constants beyond those in<br>
> + * the C and POSIX standards. These are used to write portable<br>
> + * printf() format strings for POSIX and RTEMS types not in<br>
> + * <inttypes.h><br>
</div>Do we usually put a lengthy description here with the @file, or later<br>
after the copyright block?<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">The file I copied as a template did it this way. We do not put three comment blocks at the top of a file for sure.</div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="m_-5009122771107099974quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="m_-5009122771107099974elided-text"><br>
> + */<br>
> +<br>
> +/*<br>
> + * COPYRIGHT (c) 2017 On-Line Applications Research Corporation.<br>
> + *<br>
> + * The license and distribution terms for this file may be<br>
> + * found in the file LICENSE in this distribution or at<br>
> + * <a href="http://www.rtems.org/license/LICENSE" rel="noreferrer" target="_blank">http://www.rtems.org/license/L<wbr>ICENSE</a>.<br>
> + */<br>
> +<br>
> +#ifndef _RTEMS_INTTYPES_H<br>
> +#define _RTEMS_INTTYPES_H<br>
> +<br>
> +#include <inttypes.h><br>
> +<br>
> +#ifdef __cplusplus<br>
> +extern "C" {<br>
> +#endif<br>
> +<br>
> +/**<br>
> + * @defgroup RTEMS inttypes.h Extensions<br>
> + *<br>
> + * This module defines portable PRIxxx constants beyond those<br>
> + * in the C and POSIX standard.<br>
> + */<br>
> +<br>
> +/** Helper macro to print "modet" in octal */<br>
> +#if SIZEOF_MODE_T == 8<br>
> +#define PRIomode_t PRIo64<br>
> +#elif SIZEOF_MODE_T == 4<br>
> +#define PRIomode_t PRIo32<br>
> +#else<br>
> +#error "PRIomode_t: unsupport size of mode_t"<br>
> +#endif<br>
> +<br>
> +/** Helper macro to print "off_t" in octal */<br>
> +#if SIZEOF_OFF_T == 8<br>
> +#define PRIooff_t PRIo64<br>
> +#elif SIZEOF_OFF_T == 4<br>
> +#define PRIooff_t PRIo32<br>
> +#else<br>
> +#error "PRIooff_t: unsupported size of off_t"<br>
> +#endif<br>
> +<br>
> +/** Helper macro to print "off_t" in decimal */<br>
> +#if SIZEOF_OFF_T == 8<br>
> +#define PRIdoff_t PRId64<br>
> +#elif SIZEOF_OFF_T == 4<br>
> +#define PRIdoff_t PRId32<br>
> +#else<br>
> +#error "PRIdoff_t: unsupported size of off_t"<br>
> +#endif<br>
> +<br>
> +/** Helper macro to print "time_t" in decimal */<br>
> +#if SIZEOF_TIME_T == 8<br>
> +#define PRIdtime_t PRId64<br>
> +#elif SIZEOF_TIME_T == 4<br>
> +#define PRIdtime_t PRId32<br>
> +#else<br>
> +#error "PRIdtime_t: unsupported size of time_t"<br>
> +#endif<br>
> +<br>
> +/**@}*/<br>
> +<br>
> +#ifdef __cplusplus<br>
> +}<br>
> +#endif<br>
> +<br>
> +#endif<br>
> diff --git a/cpukit/libdl/rtl-shell.c b/cpukit/libdl/rtl-shell.c<br>
> index a10c931..0bb3519 100644<br>
> --- a/cpukit/libdl/rtl-shell.c<br>
> +++ b/cpukit/libdl/rtl-shell.c<br>
> @@ -20,16 +20,7 @@<br>
> #endif<br>
><br>
> #include <inttypes.h><br>
> -<br>
> -/*<br>
> - * Flag the targets where off_t is 32 bits. This is not a compiler type<br>
> - * so we can't rely on prerdefines.<br>
> - */<br>
> -#if defined(__moxie__)<br>
> -#define PRIdoff_t PRIo32<br>
> -#else<br>
> -#define PRIdoff_t PRIo64<br>
> -#endif<br>
> +#include <rtems/inttypes.h><br>
><br>
> #include <stdio.h><br>
> #include <string.h><br>
> diff --git a/cpukit/libfs/src/nfsclient/s<wbr>rc/dirutils.c b/cpukit/libfs/src/nfsclient/s<wbr>rc/dirutils.c<br>
> index 5dd7fcf..7155ef9 100644<br>
> --- a/cpukit/libfs/src/nfsclient/s<wbr>rc/dirutils.c<br>
> +++ b/cpukit/libfs/src/nfsclient/s<wbr>rc/dirutils.c<br>
> @@ -70,22 +70,7 @@<br>
> #include <limits.h> /* PATH_MAX */<br>
><br>
> #include <inttypes.h> /* PRI* */<br>
> -<br>
> -#if SIZEOF_MODE_T == 8<br>
> -#define PRIomode_t PRIo64<br>
> -#elif SIZEOF_MODE_T == 4<br>
> -#define PRIomode_t PRIo32<br>
> -#else<br>
> -#error "unsupport size of mode_t"<br>
> -#endif<br>
> -<br>
> -#if SIZEOF_OFF_T == 8<br>
> -#define PRIdoff_t PRIo64<br>
> -#elif SIZEOF_OFF_T == 4<br>
> -#define PRIdoff_t PRIo32<br>
> -#else<br>
> -#error "unsupported size of off_t"<br>
> -#endif<br>
> +#include <rtems/inttypes.h> /* extended PRI* */<br>
><br>
> #ifdef HAVE_CEXP<br>
> #include <cexpHelp.h><br>
> @@ -142,7 +127,7 @@ char *t;<br>
> t = "@"; break;<br>
> }<br>
><br>
> - printf("%10li, %10" PRIdoff_t "b, %5i.%-5i 0%04" PRIomode_t " %s%s\n",<br>
> + printf("%10li, %10" PRIooff_t "b, %5i.%-5i 0%04" PRIomode_t " %s%s\n",<br>
> buf->st_ino,<br>
> buf->st_size,<br>
> buf->st_uid,<br>
> diff --git a/cpukit/libfs/src/rfs/rtems-r<wbr>fs-dir.c b/cpukit/libfs/src/rfs/rtems-r<wbr>fs-dir.c<br>
> index 5a39cd4..58bf305 100644<br>
> --- a/cpukit/libfs/src/rfs/rtems-r<wbr>fs-dir.c<br>
> +++ b/cpukit/libfs/src/rfs/rtems-r<wbr>fs-dir.c<br>
> @@ -28,16 +28,9 @@<br>
> #endif<br>
><br>
> #include <inttypes.h><br>
> +#include <rtems/inttypes.h><br>
> #include <string.h><br>
><br>
> -#if SIZEOF_OFF_T == 8<br>
> -#define PRIooff_t PRIo64<br>
> -#elif SIZEOF_OFF_T == 4<br>
> -#define PRIooff_t PRIo32<br>
> -#else<br>
> -#error "unsupported size of off_t"<br>
> -#endif<br>
> -<br>
> #include <rtems/rfs/rtems-rfs-block.h><br>
> #include <rtems/rfs/rtems-rfs-buffer.h><br>
> #include <rtems/rfs/rtems-rfs-file-syst<wbr>em.h><br>
> diff --git a/cpukit/libfs/src/rfs/rtems-r<wbr>fs-rtems-file.c b/cpukit/libfs/src/rfs/rtems-r<wbr>fs-rtems-file.c<br>
> index 8902a0d..31df78a 100644<br>
> --- a/cpukit/libfs/src/rfs/rtems-r<wbr>fs-rtems-file.c<br>
> +++ b/cpukit/libfs/src/rfs/rtems-r<wbr>fs-rtems-file.c<br>
> @@ -21,16 +21,9 @@<br>
> #endif<br>
><br>
> #include <inttypes.h><br>
> +#include <rtems/inttypes.h><br>
> #include <string.h><br>
><br>
> -#if SIZEOF_OFF_T == 8<br>
> -#define PRIdoff_t PRId64<br>
> -#elif SIZEOF_OFF_T == 4<br>
> -#define PRIdoff_t PRId32<br>
> -#else<br>
> -#error "unsupported size of off_t"<br>
> -#endif<br>
> -<br>
> #include <rtems/rfs/rtems-rfs-file.h><br>
> #include "rtems-rfs-rtems.h"<br>
><br>
> diff --git a/cpukit/libfs/src/rfs/rtems-r<wbr>fs-rtems.c b/cpukit/libfs/src/rfs/rtems-r<wbr>fs-rtems.c<br>
> index d3393d6..5ce526a 100644<br>
> --- a/cpukit/libfs/src/rfs/rtems-r<wbr>fs-rtems.c<br>
> +++ b/cpukit/libfs/src/rfs/rtems-r<wbr>fs-rtems.c<br>
> @@ -25,13 +25,7 @@<br>
> #include <string.h><br>
> #include <stdlib.h><br>
><br>
> -#if SIZEOF_MODE_T == 8<br>
> -#define PRIomode_t PRIo64<br>
> -#elif SIZEOF_MODE_T == 4<br>
> -#define PRIomode_t PRIo32<br>
> -#else<br>
> -#error "unsupport size of mode_t"<br>
> -#endif<br>
> +#include <rtems/inttypes.h><br>
><br>
> #include <rtems/rfs/rtems-rfs-file.h><br>
> #include <rtems/rfs/rtems-rfs-dir.h><br>
> diff --git a/cpukit/libmisc/shell/main_ti<wbr>me.c b/cpukit/libmisc/shell/main_ti<wbr>me.c<br>
> index 5ea1bf7..61fc22a 100644<br>
> --- a/cpukit/libmisc/shell/main_ti<wbr>me.c<br>
> +++ b/cpukit/libmisc/shell/main_ti<wbr>me.c<br>
> @@ -22,17 +22,9 @@<br>
><br>
> #include <rtems.h><br>
> #include <rtems/shell.h><br>
> +#include <rtems/inttypes.h><br>
> #include "internal.h"<br>
><br>
> -/* Helper macro to print "time_t" */<br>
> -#if SIZEOF_TIME_T == 8<br>
> -#define PRIdtime_t PRId64<br>
> -#elif SIZEOF_TIME_T == 4<br>
> -#define PRIdtime_t PRId32<br>
> -#else<br>
> -#error "PRIdtime_t: unsupported size of time_t"<br>
> -#endif<br>
> -<br>
> static int rtems_shell_main_time(<br>
> int argc,<br>
> char *argv[]<br>
> diff --git a/cpukit/<a href="http://preinstall.am" rel="noreferrer" target="_blank">preinstall.am</a> b/cpukit/<a href="http://preinstall.am" rel="noreferrer" target="_blank">preinstall.am</a><br>
> index 598d034..2ae31ef 100644<br>
> --- a/cpukit/<a href="http://preinstall.am" rel="noreferrer" target="_blank">preinstall.am</a><br>
> +++ b/cpukit/<a href="http://preinstall.am" rel="noreferrer" target="_blank">preinstall.am</a><br>
> @@ -263,6 +263,10 @@ $(PROJECT_INCLUDE)/rtems/bspIo<wbr>.h: include/rtems/bspIo.h $(PROJECT_INCLUDE)/rtems<br>
> $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/bspIo<wbr>.h<br>
> PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/bspIo<wbr>.h<br>
><br>
> +$(PROJECT_INCLUDE)/rtems/intt<wbr>ypes.h: include/rtems/inttypes.h $(PROJECT_INCLUDE)/rtems/$(dir<wbr>stamp)<br>
> + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/intty<wbr>pes.h<br>
> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/intty<wbr>pes.h<br>
> +<br>
> $(PROJECT_INCLUDE)/rtems/print<wbr>.h: include/rtems/print.h $(PROJECT_INCLUDE)/rtems/$(dir<wbr>stamp)<br>
> $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/print<wbr>.h<br>
> PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/print<wbr>.h<br>
> --<br>
> 1.8.3.1<br>
><br>
</div>> ______________________________<wbr>_________________<br>
> devel mailing list<br>
> <a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
> <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman<wbr>/listinfo/devel</a><br>
</blockquote></div><br></div></div></div>