Skip to content

Commit 51b8d6e

Browse files
authored
Merge pull request #9187 from deepikabhavnani/iar8_build_failures
Resolves build failures with IAR 8.x
2 parents b4f1c25 + 5f57b89 commit 51b8d6e

File tree

3 files changed

+18
-11
lines changed
  • components/storage/blockdevice

3 files changed

+18
-11
lines changed

components/storage/blockdevice/COMPONENT_FLASHIAP/TESTS/filesystem/fopen/fopen.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ LittleFileSystem fs("sd");
7575

7676
static char fslittle_fopen_utest_msg_g[FSLITTLE_UTEST_MSG_BUF_SIZE];
7777
#define FSLITTLE_FOPEN_TEST_MOUNT_PT_NAME "sd"
78-
#define FSLITTLE_FOPEN_TEST_MOUNT_PT_PATH "/"FSLITTLE_FOPEN_TEST_MOUNT_PT_NAME
78+
#define FSLITTLE_FOPEN_TEST_MOUNT_PT_PATH "/" FSLITTLE_FOPEN_TEST_MOUNT_PT_NAME
7979
#define FSLITTLE_FOPEN_TEST_WORK_BUF_SIZE_1 64
8080
#define FSLITTLE_FOPEN_TEST_FILEPATH_MAX_DEPTH 20
8181
static const int MAX_TEST_SIZE = 256 * 1024 * 2;
@@ -734,7 +734,6 @@ control_t fslittle_fopen_test_06(const size_t call_count)
734734
control_t fslittle_fopen_test_07(const size_t call_count)
735735
{
736736
FILE *f = NULL;
737-
int ret = -1;
738737
int errno_val = 0;
739738
const char *filename = sd_badfile_path;
740739

@@ -1016,7 +1015,7 @@ control_t fslittle_fopen_test_11(const size_t call_count)
10161015
return CaseNext;
10171016
}
10181017

1019-
1018+
#if ! defined(__ARMCC_VERSION) && defined(__GNUC__)
10201019
/* file data for test_12 */
10211020
static fslittle_kv_data_t fslittle_fopen_test_12_kv_data[] = {
10221021
{ "/sd/test_12/subdir/testfil1.txt", "testfil1.txt"},
@@ -1026,6 +1025,7 @@ static fslittle_kv_data_t fslittle_fopen_test_12_kv_data[] = {
10261025
{ "/sd/test_12/testfil5.txt", "testfil5.txt"},
10271026
{ NULL, NULL},
10281027
};
1028+
#endif
10291029

10301030
/** @brief test for operation of readdir().
10311031
*
@@ -1036,6 +1036,7 @@ static fslittle_kv_data_t fslittle_fopen_test_12_kv_data[] = {
10361036
*/
10371037
control_t fslittle_fopen_test_12(const size_t call_count)
10381038
{
1039+
#if ! defined(__ARMCC_VERSION) && defined(__GNUC__)
10391040
char buf[FSLITTLE_FOPEN_TEST_WORK_BUF_SIZE_1];
10401041
char *pos = NULL;
10411042
int32_t count = 0;
@@ -1048,8 +1049,6 @@ control_t fslittle_fopen_test_12(const size_t call_count)
10481049
FSLITTLE_FENTRYLOG("%s:entered\n", __func__);
10491050
(void) call_count;
10501051

1051-
#if ! defined(__ARMCC_VERSION) && defined(__GNUC__)
1052-
10531052
/* start from a known state i.e. directory to be created in not present */
10541053
while (node->filename != NULL) {
10551054
fslittle_filepath_remove_all((char *) node->filename);
@@ -1156,13 +1155,15 @@ control_t fslittle_fopen_test_13(const size_t call_count)
11561155
return CaseNext;
11571156
}
11581157

1158+
#if ! defined(__ARMCC_VERSION) && defined(__GNUC__)
11591159
/* file data for test_14 */
11601160
static fslittle_kv_data_t fslittle_fopen_test_14_kv_data[] = {
11611161
/* a file is included in the filepath even though its not created by the test,
11621162
* as the fslittle_filepath_make_dirs() works with it present. */
11631163
{ "/sd/test_14/testfile.txt", "testdata"},
11641164
{ NULL, NULL},
11651165
};
1166+
#endif
11661167

11671168
/** @brief test for operation of stat()
11681169
*

components/storage/blockdevice/COMPONENT_SD/TESTS/filesystem/files/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ DIR *dd[MBED_TEST_DIRS];
7575
FILE *fd[MBED_TEST_FILES];
7676
struct dirent ent;
7777
struct dirent *ed;
78-
size_t size;
7978
uint8_t buffer[MBED_TEST_BUFFER];
8079
uint8_t rbuffer[MBED_TEST_BUFFER];
8180
uint8_t wbuffer[MBED_TEST_BUFFER];
@@ -107,6 +106,7 @@ void test_simple_file_test()
107106
TEST_ASSERT_EQUAL(0, res);
108107

109108
{
109+
size_t size;
110110
res = fs.mount(&bd);
111111
TEST_ASSERT_EQUAL(0, res);
112112
res = file[0].open(&fs, "hello", O_WRONLY | O_CREAT);

components/storage/blockdevice/COMPONENT_SD/TESTS/filesystem/seek/main.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ DIR *dd[MBED_TEST_DIRS];
7575
FILE *fd[MBED_TEST_FILES];
7676
struct dirent ent;
7777
struct dirent *ed;
78-
size_t size;
7978
uint8_t buffer[MBED_TEST_BUFFER];
8079
uint8_t rbuffer[MBED_TEST_BUFFER];
8180
uint8_t wbuffer[MBED_TEST_BUFFER];
@@ -89,6 +88,7 @@ void test_seek_tests()
8988
TEST_ASSERT_EQUAL(0, res);
9089

9190
{
91+
size_t size;
9292
res = MBED_TEST_FILESYSTEM::format(&bd);
9393
TEST_ASSERT_EQUAL(0, res);
9494
res = fs.mount(&bd);
@@ -271,6 +271,7 @@ void test_simple_file_seek()
271271
TEST_ASSERT_EQUAL(0, res);
272272

273273
{
274+
size_t size;
274275
res = fs.mount(&bd);
275276
TEST_ASSERT_EQUAL(0, res);
276277
res = file[0].open(&fs, "hello/kitty42", O_RDONLY);
@@ -318,7 +319,7 @@ void test_simple_file_seek()
318319
res = memcmp(buffer, "kittycatcat", size);
319320
TEST_ASSERT_EQUAL(0, res);
320321

321-
size_t size = file[0].size();
322+
size = file[0].size();
322323
res = file[0].seek(0, SEEK_CUR);
323324
TEST_ASSERT_EQUAL(size, res);
324325
res = file[0].close();
@@ -337,6 +338,7 @@ void test_large_file_seek()
337338
TEST_ASSERT_EQUAL(0, res);
338339

339340
{
341+
size_t size;
340342
res = fs.mount(&bd);
341343
TEST_ASSERT_EQUAL(0, res);
342344
res = file[0].open(&fs, "hello/kitty42", O_RDONLY);
@@ -384,7 +386,7 @@ void test_large_file_seek()
384386
res = memcmp(buffer, "kittycatcat", size);
385387
TEST_ASSERT_EQUAL(0, res);
386388

387-
size_t size = file[0].size();
389+
size = file[0].size();
388390
res = file[0].seek(0, SEEK_CUR);
389391
TEST_ASSERT_EQUAL(size, res);
390392
res = file[0].close();
@@ -403,6 +405,7 @@ void test_simple_file_seek_and_write()
403405
TEST_ASSERT_EQUAL(0, res);
404406

405407
{
408+
size_t size;
406409
res = fs.mount(&bd);
407410
TEST_ASSERT_EQUAL(0, res);
408411
res = file[0].open(&fs, "hello/kitty42", O_RDWR);
@@ -450,7 +453,7 @@ void test_simple_file_seek_and_write()
450453
res = memcmp(buffer, "kittycatcat", size);
451454
TEST_ASSERT_EQUAL(0, res);
452455

453-
size_t size = file[0].size();
456+
size = file[0].size();
454457
res = file[0].seek(0, SEEK_CUR);
455458
TEST_ASSERT_EQUAL(size, res);
456459
res = file[0].close();
@@ -469,6 +472,7 @@ void test_large_file_seek_and_write()
469472
TEST_ASSERT_EQUAL(0, res);
470473

471474
{
475+
size_t size;
472476
res = fs.mount(&bd);
473477
TEST_ASSERT_EQUAL(0, res);
474478
res = file[0].open(&fs, "hello/kitty42", O_RDWR);
@@ -518,7 +522,7 @@ void test_large_file_seek_and_write()
518522
res = memcmp(buffer, "kittycatcat", size);
519523
TEST_ASSERT_EQUAL(0, res);
520524

521-
size_t size = file[0].size();
525+
size = file[0].size();
522526
res = file[0].seek(0, SEEK_CUR);
523527
TEST_ASSERT_EQUAL(size, res);
524528
res = file[0].close();
@@ -537,6 +541,7 @@ void test_boundary_seek_and_write()
537541
TEST_ASSERT_EQUAL(0, res);
538542

539543
{
544+
size_t size;
540545
res = fs.mount(&bd);
541546
TEST_ASSERT_EQUAL(0, res);
542547
res = file[0].open(&fs, "hello/kitty42", O_RDWR);
@@ -583,6 +588,7 @@ void test_out_of_bounds_seek()
583588
TEST_ASSERT_EQUAL(0, res);
584589

585590
{
591+
size_t size;
586592
res = fs.mount(&bd);
587593
TEST_ASSERT_EQUAL(0, res);
588594
res = file[0].open(&fs, "hello/kitty42", O_RDWR);

0 commit comments

Comments
 (0)