summaryrefslogtreecommitdiff
path: root/tests/stdio_test.cpp
diff options
context:
space:
mode:
authorThorsten Glaser <tg@mirbsd.org>2013-02-17 16:50:58 +0000
committerElliott Hughes <enh@google.com>2013-02-19 14:12:55 -0800
commitc641cafbc387849510d7f408e85f72fa3608916d (patch)
tree102909efb095eaa603f94de0617720b5364875b9 /tests/stdio_test.cpp
parent593abb7b593a34d501c90512953a7368add6d185 (diff)
use architecture-specific ssize_t definition
after change 32822 was rejected, this is the more light-weight version of the fix: libc/include/sys/types.h already - via libc/kernel/common/linux/posix_types.h - includes a definition of __kernel_ssize_t from libc/kernel/arch-*/asm/posix_types.h which is architecture-specific, toolchain-agnostic and also gets rid of the gcc -Wformat warning (which it issues correctly, since this i̲s̲ indeed a bug in bionic) Change-Id: Ie4503ab16628bc25815a836d07556f665e9795c7
Diffstat (limited to 'tests/stdio_test.cpp')
-rw-r--r--tests/stdio_test.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp
index 70a71fb87..d2311fd54 100644
--- a/tests/stdio_test.cpp
+++ b/tests/stdio_test.cpp
@@ -169,3 +169,12 @@ TEST(stdio, getline_invalid) {
ASSERT_EQ(getline(&buffer, &buffer_length, fp), -1);
ASSERT_EQ(EBADF, errno);
}
+
+TEST(stdio, printf_ssize_t) {
+ // We used to have a ssize_t definition that confused GCC into saying:
+ // error: format '%zd' expects argument of type 'signed size_t',
+ // but argument 4 has type 'ssize_t {aka long int}' [-Werror=format]
+ ssize_t v = 1;
+ char buf[32];
+ snprintf(buf, sizeof(buf), "%zd", v);
+}