Merge "use architecture-specific ssize_t definition"

This commit is contained in:
Elliott Hughes 2013-02-19 22:13:53 +00:00 committed by Gerrit Code Review
commit ccd403161c
2 changed files with 10 additions and 1 deletions

View File

@ -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;

View File

@ -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);
}