Resolved: [Error] main.cpp@115,34: [Pe266]: "size" is ambiguous

`size` is part of std library since c++17, and results in build
errors for IAR 8.x.
https://en.cppreference.com/w/cpp/iterator/size
pull/9187/head
Deepika 2018-12-21 13:51:30 -06:00
parent a356db19aa
commit 5f57b89c10
2 changed files with 12 additions and 6 deletions

View File

@ -75,7 +75,6 @@ DIR *dd[MBED_TEST_DIRS];
FILE *fd[MBED_TEST_FILES];
struct dirent ent;
struct dirent *ed;
size_t size;
uint8_t buffer[MBED_TEST_BUFFER];
uint8_t rbuffer[MBED_TEST_BUFFER];
uint8_t wbuffer[MBED_TEST_BUFFER];
@ -107,6 +106,7 @@ void test_simple_file_test()
TEST_ASSERT_EQUAL(0, res);
{
size_t size;
res = fs.mount(&bd);
TEST_ASSERT_EQUAL(0, res);
res = file[0].open(&fs, "hello", O_WRONLY | O_CREAT);

View File

@ -75,7 +75,6 @@ DIR *dd[MBED_TEST_DIRS];
FILE *fd[MBED_TEST_FILES];
struct dirent ent;
struct dirent *ed;
size_t size;
uint8_t buffer[MBED_TEST_BUFFER];
uint8_t rbuffer[MBED_TEST_BUFFER];
uint8_t wbuffer[MBED_TEST_BUFFER];
@ -89,6 +88,7 @@ void test_seek_tests()
TEST_ASSERT_EQUAL(0, res);
{
size_t size;
res = MBED_TEST_FILESYSTEM::format(&bd);
TEST_ASSERT_EQUAL(0, res);
res = fs.mount(&bd);
@ -271,6 +271,7 @@ void test_simple_file_seek()
TEST_ASSERT_EQUAL(0, res);
{
size_t size;
res = fs.mount(&bd);
TEST_ASSERT_EQUAL(0, res);
res = file[0].open(&fs, "hello/kitty42", O_RDONLY);
@ -318,7 +319,7 @@ void test_simple_file_seek()
res = memcmp(buffer, "kittycatcat", size);
TEST_ASSERT_EQUAL(0, res);
size_t size = file[0].size();
size = file[0].size();
res = file[0].seek(0, SEEK_CUR);
TEST_ASSERT_EQUAL(size, res);
res = file[0].close();
@ -337,6 +338,7 @@ void test_large_file_seek()
TEST_ASSERT_EQUAL(0, res);
{
size_t size;
res = fs.mount(&bd);
TEST_ASSERT_EQUAL(0, res);
res = file[0].open(&fs, "hello/kitty42", O_RDONLY);
@ -384,7 +386,7 @@ void test_large_file_seek()
res = memcmp(buffer, "kittycatcat", size);
TEST_ASSERT_EQUAL(0, res);
size_t size = file[0].size();
size = file[0].size();
res = file[0].seek(0, SEEK_CUR);
TEST_ASSERT_EQUAL(size, res);
res = file[0].close();
@ -403,6 +405,7 @@ void test_simple_file_seek_and_write()
TEST_ASSERT_EQUAL(0, res);
{
size_t size;
res = fs.mount(&bd);
TEST_ASSERT_EQUAL(0, res);
res = file[0].open(&fs, "hello/kitty42", O_RDWR);
@ -450,7 +453,7 @@ void test_simple_file_seek_and_write()
res = memcmp(buffer, "kittycatcat", size);
TEST_ASSERT_EQUAL(0, res);
size_t size = file[0].size();
size = file[0].size();
res = file[0].seek(0, SEEK_CUR);
TEST_ASSERT_EQUAL(size, res);
res = file[0].close();
@ -469,6 +472,7 @@ void test_large_file_seek_and_write()
TEST_ASSERT_EQUAL(0, res);
{
size_t size;
res = fs.mount(&bd);
TEST_ASSERT_EQUAL(0, res);
res = file[0].open(&fs, "hello/kitty42", O_RDWR);
@ -518,7 +522,7 @@ void test_large_file_seek_and_write()
res = memcmp(buffer, "kittycatcat", size);
TEST_ASSERT_EQUAL(0, res);
size_t size = file[0].size();
size = file[0].size();
res = file[0].seek(0, SEEK_CUR);
TEST_ASSERT_EQUAL(size, res);
res = file[0].close();
@ -537,6 +541,7 @@ void test_boundary_seek_and_write()
TEST_ASSERT_EQUAL(0, res);
{
size_t size;
res = fs.mount(&bd);
TEST_ASSERT_EQUAL(0, res);
res = file[0].open(&fs, "hello/kitty42", O_RDWR);
@ -583,6 +588,7 @@ void test_out_of_bounds_seek()
TEST_ASSERT_EQUAL(0, res);
{
size_t size;
res = fs.mount(&bd);
TEST_ASSERT_EQUAL(0, res);
res = file[0].open(&fs, "hello/kitty42", O_RDWR);