aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-02-19 22:13:53 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-02-19 22:13:53 +0000
commitccd403161cdcc88a0ffcaecd1bc707e2d4c88a1c (patch)
tree102909efb095eaa603f94de0617720b5364875b9
parent593abb7b593a34d501c90512953a7368add6d185 (diff)
parentc641cafbc387849510d7f408e85f72fa3608916d (diff)
downloadandroid_bionic-ccd403161cdcc88a0ffcaecd1bc707e2d4c88a1c.tar.gz
android_bionic-ccd403161cdcc88a0ffcaecd1bc707e2d4c88a1c.tar.bz2
android_bionic-ccd403161cdcc88a0ffcaecd1bc707e2d4c88a1c.zip
Merge "use architecture-specific ssize_t definition"
-rw-r--r--libc/include/sys/types.h2
-rw-r--r--tests/stdio_test.cpp9
2 files changed, 10 insertions, 1 deletions
diff --git a/libc/include/sys/types.h b/libc/include/sys/types.h
index 8cfeeb69d..459159fe9 100644
--- a/libc/include/sys/types.h
+++ b/libc/include/sys/types.h
@@ -85,7 +85,7 @@ typedef .... pthread_t;
#ifndef _SSIZE_T_DEFINED_
#define _SSIZE_T_DEFINED_
-typedef long int ssize_t;
+typedef __kernel_ssize_t ssize_t;
#endif
typedef __kernel_suseconds_t suseconds_t;
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);
+}