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
Correct force inline syntax for IAR compiler #11523
Conversation
There was a problem hiding this 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.
There was a problem hiding this 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) ?
The IAR compiler generates the following warning: |
@@ -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__) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
f65df2e
to
e2aeb60
Compare
CI started |
CI internal problem in memory benchmark.. restarting the job |
Test run: FAILEDSummary: 1 of 11 test jobs failed Failed test jobs:
|
All green 👍 |
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
Reviewers
@evedon
Release Notes