Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FATFS / IAR compilation issue Pe029 #11259

Merged
merged 2 commits into from
Aug 23, 2019
Merged

Conversation

JanneKiiskila
Copy link
Contributor

@JanneKiiskila JanneKiiskila commented Aug 19, 2019

IAR / FATFS - Pe029 error

IAR compilation fails at _fs = { 0 }; due to

[Error] FATFileSystem.cpp@285,0: [Pe029]: expected an expression

Changing that initializer fixes the issue. IAR is more sensitive
in C/C++ being mixed together than other compilers.

[x] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

@0xc0170 @kjbracey-arm @michalpasztamobica

@ciarmcom
Copy link
Member

@JanneKiiskila, thank you for your changes.
@kjbracey-arm @michalpasztamobica @0xc0170 @ARMmbed/mbed-os-storage @ARMmbed/mbed-os-maintainers please review.

Copy link
Contributor

@kjbracey kjbracey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not actually sure why IAR is rejecting this. Seems like it should be legal to me (after 20 minutes of staring at cppreference).

But it's crummy code anyway, and the memset is worse.

Instead, please get rid of the assignment in the body, and just add _fs() to the member initialiser list. That will clear it out nicely.

@kjbracey
Copy link
Contributor

BTW, which version of IAR are you using, and why isn't this showing up in some CI?

Janne Kiiskila added 2 commits August 22, 2019 10:58
It's 2019 now.
IAR compilation fails at `_fs = { 0 };` due to

```
[Error] FATFileSystem.cpp@285,0: [Pe029]: expected an expression
```

Changing that object initializer list instead, as that seems
to pass IAR compilation, too.

Changed original memset to object initialiser list based on review
feedback from Kevin Bracey.
@JanneKiiskila
Copy link
Contributor Author

JanneKiiskila commented Aug 22, 2019

This is actually showing up on Client CI, hence the PR. Rebased, force pushed and changed the memset to initializer list implementation as per your feedback (very valid one).

Copy link
Contributor

@kjbracey kjbracey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really should have been caught in Mbed OS pull CI before it hit master.

@JanneKiiskila
Copy link
Contributor Author

Fully agree on that.

@JanneKiiskila
Copy link
Contributor Author

Seems different IAR versions behave differently here, IAR 8.32 seems to compile even w/o this fix, but an older one - fails.

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 22, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Aug 22, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 1
Build artifacts

@kjbracey
Copy link
Contributor

Seems different IAR versions behave differently here, IAR 8.32 seems to compile even w/o this fix, but an older one - fails.

Then I reckon it was a now-fixed compiler bug. The code seemed valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants