summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel@rtems.org>2017-04-22 14:15:22 -0500
committerJoel Sherrill <joel@rtems.org>2017-04-22 14:15:22 -0500
commit438ca2f5944082fc1851bdec8834b86173a0fc82 (patch)
tree9e8c2a12e940e25c1ff10eb3d79eb92595d30cb4
parentelnk.c: Fix printf() format warnings (diff)
downloadrtems-438ca2f5944082fc1851bdec8834b86173a0fc82.tar.bz2
rtems/inttypes.h: Add blksize_t and blkcnt_t
-rw-r--r--cpukit/configure.ac14
-rw-r--r--cpukit/include/rtems/inttypes.h22
-rw-r--r--testsuites/psxtests/include/pmacros.h30
3 files changed, 37 insertions, 29 deletions
diff --git a/cpukit/configure.ac b/cpukit/configure.ac
index ab01db8be4..67237e9d07 100644
--- a/cpukit/configure.ac
+++ b/cpukit/configure.ac
@@ -243,6 +243,8 @@ AC_CHECK_SIZEOF([mode_t])
AC_CHECK_SIZEOF([off_t])
AC_CHECK_SIZEOF([time_t])
AC_CHECK_SIZEOF([size_t])
+AC_CHECK_SIZEOF([blksize_t])
+AC_CHECK_SIZEOF([blkcnt_t])
## Provide sizeof(mode_t) information via cpuopts.h
RTEMS_CPUOPT([__RTEMS_SIZEOF_MODE_T__],
@@ -262,6 +264,18 @@ RTEMS_CPUOPT([__RTEMS_SIZEOF_TIME_T__],
[${ac_cv_sizeof_time_t}],
[sizeof(time_t)])
+## Provide sizeof(blksize_t) information via cpuopts.h
+RTEMS_CPUOPT([__RTEMS_SIZEOF_BLKSIZE_T__],
+ [true],
+ [${ac_cv_sizeof_blksize_t}],
+ [sizeof(blksize_t)])
+
+## Provide sizeof(blkcnt_t) information via cpuopts.h
+RTEMS_CPUOPT([__RTEMS_SIZEOF_BLKCNT_T__],
+ [true],
+ [${ac_cv_sizeof_blkcnt_t}],
+ [sizeof(blkcnt_t)])
+
## Then we propagate a private copy of the value into cpuopts.h
## so it is always available to the RTEMS header files.
diff --git a/cpukit/include/rtems/inttypes.h b/cpukit/include/rtems/inttypes.h
index ef02ccff4a..023353fe40 100644
--- a/cpukit/include/rtems/inttypes.h
+++ b/cpukit/include/rtems/inttypes.h
@@ -70,6 +70,28 @@ extern "C" {
#error "PRIdtime_t: unsupported size of time_t"
#endif
+/** Helper macro to print "blksize_t" in decimal */
+#if __RTEMS_SIZEOF_BLKSIZE_T__ == 8
+#define PRIxblksize_t PRIx64
+#elif __RTEMS_SIZEOF_BLKSIZE_T__ == 4
+#define PRIxblksize_t PRIx32
+#else
+/* Warn and fall back to "long" */
+#warning "unsupported size of blksize_t"
+#define PRIxblksize_t "lx"
+#endif
+
+/** Helper macro to print "blkcnt_t" in decimal */
+#if __RTEMS_SIZEOF_BLKCNT_T__ == 8
+#define PRIxblkcnt_t PRIx64
+#elif __RTEMS_SIZEOF_BLKCNT_T__ == 4
+#define PRIxblkcnt_t PRIx32
+#else
+/* Warn and fall back to "long" */
+#warning "unsupported size of blkcnt_t"
+#define PRIxblkcnt_t "lx"
+#endif
+
/*
* Various inttypes.h-stype macros to assist printing
* certain system types on different targets.
diff --git a/testsuites/psxtests/include/pmacros.h b/testsuites/psxtests/include/pmacros.h
index 77cf3fb133..be1b8b7567 100644
--- a/testsuites/psxtests/include/pmacros.h
+++ b/testsuites/psxtests/include/pmacros.h
@@ -1,5 +1,5 @@
/*
- * COPYRIGHT (c) 1989-2009.
+ * COPYRIGHT (c) 1989-2009, 2017.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -91,34 +91,6 @@
#define empty_line() puts( "" )
-#if SIZEOF_OFF_T == 8
-#define PRIdoff_t PRIo64
-#elif SIZEOF_OFF_T == 4
-#define PRIdoff_t PRIo32
-#else
-#error "unsupported size of off_t"
-#endif
-
-#if SIZEOF_BLKSIZE_T == 8
-#define PRIxblksize_t PRIx64
-#elif SIZEOF_BLKSIZE_T == 4
-#define PRIxblksize_t PRIx32
-#else
-/* Warn and fall back to "long" */
-#warning "unsupported size of blksize_t"
-#define PRIxblksize_t "lx"
-#endif
-
-#if SIZEOF_BLKSIZE_T == 8
-#define PRIxblkcnt_t PRIx64
-#elif SIZEOF_BLKSIZE_T == 4
-#define PRIxblkcnt_t PRIx32
-#else
-/* Warn and fall back to "long" */
-#warning "unsupported size of blkcnt_t"
-#define PRIxblkcnt_t "lx"
-#endif
-
#endif
/* end of file */