Skip to content

Replace with weak mbed_error_hook implementation (deprecate the hook function) #12569

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

Merged
merged 7 commits into from
Mar 30, 2020

Conversation

DBS06
Copy link
Contributor

@DBS06 DBS06 commented Mar 4, 2020

Summary of changes

mbed_set_error_hook() can only be called inside the application. Therefore it is not possible in the application to catch errors before calling mbed_set_error_hook().
I thought it would be simpler to create a mbed_error_hook() function which is weak and the application can catch errors at any time.

Impact of changes

Replace mbed_set_error_hook() with an application specific mbed_error_hook() implementation.

Migration actions required

Documentation


Pull request type

[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[x] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers


@mergify mergify bot added the needs: work label Mar 4, 2020
@kjbracey
Copy link
Contributor

kjbracey commented Mar 4, 2020

Removing an existing API with no prior warning isn't ideal.

Conceivably to retain compatibility you could have "call the registered handler" be the default weak implementation, and have the ability to override that.

Although that makes it more complex, rather than simpler.

Anyone else have thoughts?

@DBS06
Copy link
Contributor Author

DBS06 commented Mar 4, 2020

Maybe we could set this in mbed-os 5.15.x to deprecated and change it in mbed-os 6.x.x?

@ciarmcom ciarmcom requested review from a team March 4, 2020 14:00
@ciarmcom
Copy link
Member

ciarmcom commented Mar 4, 2020

@DBS06, thank you for your changes.
@ARMmbed/mbed-os-core @ARMmbed/mbed-os-maintainers please review.

@evedon
Copy link
Contributor

evedon commented Mar 4, 2020

I like the idea of using a weak mbed_error_hook implementation but we should only deprecate mbed_set_error_hook() in this PR. Removal should come in a subsequent Mbed 6 release.

@DBS06
Copy link
Contributor Author

DBS06 commented Mar 5, 2020

Is it okay to do it like in my last commit?

@mergify mergify bot removed the needs: review label Mar 5, 2020
@DBS06
Copy link
Contributor Author

DBS06 commented Mar 10, 2020

How should I interpret astyle error and how do I fix it?

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 24, 2020

Travis astyle job prints the failures, see https://travis-ci.org/github/ARMmbed/mbed-os/jobs/658578979

There is spaces left in the code (check for empty spaces after code or comment), all 3 offenders in the code style.

0xc0170
0xc0170 previously approved these changes Mar 24, 2020
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.

In this case, weakly linked is better than a hook.

Although working recently on some CMake where you get an issue with weakly defined symbols in libraries is not ideal world 🙄 but that is not related here, so all fine.

@0xc0170 0xc0170 changed the title Remove mbed_set_error_hook and replace with weak mbed_error_hook implementation Replace with weak mbed_error_hook implementation (deprecate the hook function) Mar 24, 2020
@mergify mergify bot dismissed 0xc0170’s stale review March 25, 2020 13:22

Pull request has been modified.

@adbridge
Copy link
Contributor

@evedon @kjbracey-arm what are your thoughts on this now ?

@0xc0170 0xc0170 merged commit 5a07aab into ARMmbed:master Mar 30, 2020
@mergify mergify bot removed the ready for merge label Mar 30, 2020
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.

7 participants