This completes the initial creation of rtems/inttypes.h based on all existing PRIxxx definitions contained in RTEMS Project owned code.
closes #2983. --- cpukit/configure.ac | 36 +++++++++++++++------- cpukit/include/rtems/inttypes.h | 60 ++++++++++++++++++++++++++++++------ testsuites/support/include/tmacros.h | 42 +------------------------ 3 files changed, 77 insertions(+), 61 deletions(-) diff --git a/cpukit/configure.ac b/cpukit/configure.ac index 28a11bd..ab01db8 100644 --- a/cpukit/configure.ac +++ b/cpukit/configure.ac @@ -238,6 +238,30 @@ RTEMS_CPUOPT([__RTEMS_ADA__], [1], [Define to 1 if ada/gnat bindings are built-in]) +# These are used to provide <rtems/inttypes.h +AC_CHECK_SIZEOF([mode_t]) +AC_CHECK_SIZEOF([off_t]) +AC_CHECK_SIZEOF([time_t]) +AC_CHECK_SIZEOF([size_t]) + +## Provide sizeof(mode_t) information via cpuopts.h +RTEMS_CPUOPT([__RTEMS_SIZEOF_MODE_T__], + [true], + [${ac_cv_sizeof_mode_t}], + [sizeof(mode_t)]) + +## Provide sizeof(off_t) information via cpuopts.h +RTEMS_CPUOPT([__RTEMS_SIZEOF_OFF_T__], + [true], + [${ac_cv_sizeof_off_t}], + [sizeof(off_t)]) + +## Provide sizeof(time_t) information via cpuopts.h +RTEMS_CPUOPT([__RTEMS_SIZEOF_TIME_T__], + [true], + [${ac_cv_sizeof_time_t}], + [sizeof(time_t)]) + ## Then we propagate a private copy of the value into cpuopts.h ## so it is always available to the RTEMS header files. @@ -251,7 +275,7 @@ RTEMS_CPUOPT([__RTEMS_MINOR__], [$rtems_minor], [minor version portion of an RTEMS release]) -RTEMS_CPUOPT([__RTEMS_REVISION__], +RTEMS_CPUOPT([__RTEMS_REVISION___], [true], [$rtems_revision], [revision version portion of an RTEMS release]) @@ -278,16 +302,6 @@ RTEMS_CHECK_GCC_WEAK AC_CHECK_DECLS([_POSIX_LOGIN_NAME_MAX],,,[#include <limits.h>]) AC_CHECK_DECLS([CHAR_BIT],,,[#include <limits.h>]) -# FIXME: We should get rid of this. -# So far, only used in libfs/src/nfsclient/src/dirutils.c -AC_CHECK_SIZEOF([mode_t]) -AC_CHECK_SIZEOF([off_t]) - -# FIXME: We should get rid of this. It's a cludge. -AC_CHECK_SIZEOF([time_t]) - -AC_CHECK_SIZEOF([size_t]) - # FIXME: Mandatory in SUSv4, optional in SUSv3. # Not implemented in GCC/newlib, so far. AC_CHECK_DECLS([WORD_BIT],,,[#include <limits.h>]) diff --git a/cpukit/include/rtems/inttypes.h b/cpukit/include/rtems/inttypes.h index 19022af..ef02ccf 100644 --- a/cpukit/include/rtems/inttypes.h +++ b/cpukit/include/rtems/inttypes.h @@ -21,6 +21,7 @@ #define _RTEMS_INTTYPES_H #include <inttypes.h> +#include <rtems/score/cpuopts.h> #ifdef __cplusplus extern "C" { @@ -34,41 +35,82 @@ extern "C" { */ /** Helper macro to print "modet" in octal */ -#if SIZEOF_MODE_T == 8 +#if __RTEMS_SIZEOF_MODE_T__ == 8 #define PRIomode_t PRIo64 -#elif SIZEOF_MODE_T == 4 +#elif __RTEMS_SIZEOF_MODE_T__ == 4 #define PRIomode_t PRIo32 #else -#error "PRIomode_t: unsupport size of mode_t" +#error "PRIomode_t: unsupported size of mode_t" #endif /** Helper macro to print "off_t" in octal */ -#if SIZEOF_OFF_T == 8 +#if __RTEMS_SIZEOF_OFF_T__ == 8 #define PRIooff_t PRIo64 -#elif SIZEOF_OFF_T == 4 +#elif __RTEMS_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 +#if __RTEMS_SIZEOF_OFF_T__ == 8 #define PRIdoff_t PRId64 -#elif SIZEOF_OFF_T == 4 +#elif __RTEMS_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 +#if __RTEMS_SIZEOF_TIME_T__ == 8 #define PRIdtime_t PRId64 -#elif SIZEOF_TIME_T == 4 +#elif __RTEMS_SIZEOF_TIME_T__ == 4 #define PRIdtime_t PRId32 #else #error "PRIdtime_t: unsupported size of time_t" #endif +/* + * Various inttypes.h-stype macros to assist printing + * certain system types on different targets. + */ + +#if defined(RTEMS_USE_16_BIT_OBJECT) +#define PRIxrtems_id PRIx16 +#else +#define PRIxrtems_id PRIx32 +#endif + +/* c.f. cpukit/score/include/rtems/score/priority.h */ +#define PRIdPriority_Control PRIu64 +#define PRIxPriority_Control PRIx64 +/* rtems_task_priority is a typedef to Priority_Control */ +#define PRIdrtems_task_priority PRIu32 +#define PRIxrtems_task_priority PRIx32 + +/* c.f. cpukit/score/include/rtems/score/watchdog.h */ +#define PRIdWatchdog_Interval PRIu32 +/* rtems_interval is a typedef to Watchdog_Interval */ +#define PRIdrtems_interval PRIdWatchdog_Interval + +/* c.f. cpukit/score/include/rtems/score/thread.h */ +#define PRIdThread_Entry_numeric_type PRIuPTR +/* rtems_task_argument is a typedef to Thread_Entry_numeric_type */ +#define PRIdrtems_task_argument PRIdThread_Entry_numeric_type + +/* rtems_event_set is a typedef to unit32_t */ +#define PRIxrtems_event_set PRIx32 + +/* HACK: newlib defines pthread_t as a typedef to __uint32_t */ +/* HACK: There is no portable way to print pthread_t's */ +#define PRIxpthread_t PRIx32 + +/* rtems_signal_set is a typedef to uint32_t */ +#define PRIxrtems_signal_set PRIx32 + +/* newlib's ino_t is a typedef to "unsigned long" */ +#define PRIxino_t "lx" + /**@}*/ #ifdef __cplusplus diff --git a/testsuites/support/include/tmacros.h b/testsuites/support/include/tmacros.h index 4898aea..2b267ca 100644 --- a/testsuites/support/include/tmacros.h +++ b/testsuites/support/include/tmacros.h @@ -18,6 +18,7 @@ #define __TMACROS_h #include <inttypes.h> +#include <rtems/inttypes.h> #include <bsp.h> /* includes <rtems.h> */ #include <ctype.h> @@ -305,47 +306,6 @@ extern "C" { } \ } while (0) -/* - * Various inttypes.h-stype macros to assist printing - * certain system types on different targets. - */ - -#if defined(RTEMS_USE_16_BIT_OBJECT) -#define PRIxrtems_id PRIx16 -#else -#define PRIxrtems_id PRIx32 -#endif - -/* c.f. cpukit/score/include/rtems/score/priority.h */ -#define PRIdPriority_Control PRIu64 -#define PRIxPriority_Control PRIx64 -/* rtems_task_priority is a typedef to Priority_Control */ -#define PRIdrtems_task_priority PRIu32 -#define PRIxrtems_task_priority PRIx32 - -/* c.f. cpukit/score/include/rtems/score/watchdog.h */ -#define PRIdWatchdog_Interval PRIu32 -/* rtems_interval is a typedef to Watchdog_Interval */ -#define PRIdrtems_interval PRIdWatchdog_Interval - -/* c.f. cpukit/score/include/rtems/score/thread.h */ -#define PRIdThread_Entry_numeric_type PRIuPTR -/* rtems_task_argument is a typedef to Thread_Entry_numeric_type */ -#define PRIdrtems_task_argument PRIdThread_Entry_numeric_type - -/* rtems_event_set is a typedef to unit32_t */ -#define PRIxrtems_event_set PRIx32 - -/* HACK: newlib defines pthread_t as a typedef to __uint32_t */ -/* HACK: There is no portable way to print pthread_t's */ -#define PRIxpthread_t PRIx32 - -/* rtems_signal_set is a typedef to uint32_t */ -#define PRIxrtems_signal_set PRIx32 - -/* newlib's ino_t is a typedef to "unsigned long" */ -#define PRIxino_t "lx" - /** * This assists in clearly disabling warnings on GCC in certain very * specific cases. -- 1.8.3.1 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel