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

Correct force inline syntax for IAR compiler #11523

Merged

Conversation

hugueskamba
Copy link
Collaborator

@hugueskamba hugueskamba commented Sep 19, 2019

Description

The IAR compiler generates the following warning:
[Warning] Ticker.h@87,0: [Pe606]: this pragma must immediately precede a declaration

Unlinke other compilers supported, the IAR compiler requires the
pre-processor extension to force inline a method to be placed before
the keyword template if the method is declared with one.

Pull request type

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

Reviewers

@evedon

Release Notes

Copy link
Contributor

@evedon evedon left a comment

Choose a reason for hiding this comment

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

Unfortunately I don't see any other solution; we have to make a specific case for IAR compiler.

Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

How was this found and is there reference that this is needed for IAR? is this just a case here in Ticker (we do not have force inline for any other templated objects) ?

@hugueskamba
Copy link
Collaborator Author

How was this found and is there reference that this is needed for IAR? is this just a case here in Ticker (we do not have force inline for any other templated objects) ?

The IAR compiler generates the following warning:
[Warning] Ticker.h@87,0: [Pe606]: this pragma must immediately precede a declaration.
(Added to the PR description)

@@ -83,8 +83,11 @@ class Ticker : public TimerEvent, private NonCopyable<Ticker> {
* @param func pointer to the function to be called
* @param t the time between calls in seconds
*/
template <typename F>
MBED_FORCEINLINE void attach(F &&func, float t)
#if defined(__ICCARM__)
Copy link
Contributor

Choose a reason for hiding this comment

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

That's pretty grim, but it does appear to be the only forceinline template in the tree. I was thinking there were a bunch in the atomic stuff, but no.

I'd pull the void attach(...) out of the #if onto its own line.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unlinke other compilers supported, the IAR compiler requires the
pre-processor extension to force inline a method to be placed before
the keyword `template` if the method is declared with one.
@hugueskamba hugueskamba force-pushed the hk-correct-force-inline-syntax-for-iar branch from f65df2e to e2aeb60 Compare September 19, 2019 12:20
@0xc0170
Copy link
Contributor

0xc0170 commented Sep 20, 2019

CI started

@OPpuolitaival
Copy link
Contributor

CI internal problem in memory benchmark.. restarting the job

@mbed-ci
Copy link

mbed-ci commented Sep 20, 2019

Test run: FAILED

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

Failed test jobs:

  • jenkins-ci/mbed-os-ci_dynamic-memory-usage

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 20, 2019

All green 👍

@0xc0170 0xc0170 merged commit e6d9d51 into ARMmbed:master Sep 20, 2019
@hugueskamba hugueskamba deleted the hk-correct-force-inline-syntax-for-iar branch September 20, 2019 13:05
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.

None yet

6 participants