Skip to content

Preparation for Callback changes #12035

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 4 commits into from
Jan 21, 2020
Merged

Conversation

kjbracey
Copy link
Contributor

@kjbracey kjbracey commented Dec 5, 2019

Summary of changes

Code tweaks to support upcoming Callback changes.

  • Use nullptr or {} instead of NULL or 0 with Callback.
  • Don't rely on Callback including <string.h>.
  • Add mstd::launder.
  • Merge Callback Greentea tests.

Documentation

None


Pull request type

[X] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] 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)
[X] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers


@ciarmcom ciarmcom requested review from a team December 5, 2019 16:00
@ciarmcom
Copy link
Member

ciarmcom commented Dec 5, 2019

@kjbracey-arm, thank you for your changes.
@ARMmbed/mbed-os-test @ARMmbed/mbed-os-core @ARMmbed/mbed-os-storage @ARMmbed/mbed-os-ipcore @ARMmbed/mbed-os-wan @ARMmbed/mbed-os-maintainers please review.

@40Grit
Copy link

40Grit commented Dec 9, 2019

@AGlass0fMilk

Copy link
Member

@bulislaw bulislaw left a comment

Choose a reason for hiding this comment

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

Is it worth it? If it breaks our code in so many places?

@@ -695,12 +695,28 @@ utest::v1::status_t test_setup(const size_t number_of_cases)
}

Case cases[] = {
#ifdef DO_BIG_TEST
Copy link
Member

Choose a reason for hiding this comment

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

How is that decided?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's set when callback/main.cpp is included from callback_big/main.cpp.

It's just a break-up of the test set into 3 images (callback/callback_big/callback_small). Breakup was done because so many template instantiations didn't fit into a tiny target.

Original split was done by copy-paste, but the 3 tests had started to diverge.

See commit 8b9f33a

@kjbracey
Copy link
Contributor Author

kjbracey commented Dec 18, 2019

Is it worth it? If it breaks our code in so many places?

There's kind of no alternative. Generic templates are totally fouled up by the ambiguity of 0. For SharedPtr it's just a slight optimisation, but here where we accept any type we have to distinguish nullptr specifically. We can never cope with 0 without limiting and complicating what Callback can do. That generic template problem is why nullptr was added.

@adbridge
Copy link
Contributor

@kjbracey-arm also looks like this needs a rebase now ..

@adbridge
Copy link
Contributor

adbridge commented Jan 6, 2020

@kjbracey-arm also looks like this needs a rebase now ..

@kjbracey-arm bump....

@kjbracey
Copy link
Contributor Author

kjbracey commented Jan 8, 2020

Rebased

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 8, 2020

CI started

@mbed-ci
Copy link

mbed-ci commented Jan 8, 2020

Test run: FAILED

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

Failed test jobs:

  • jenkins-ci/mbed-os-ci_greentea-test

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 9, 2020

features/cellular/framework/AT/ATHandler.cpp

One conflict now, please rebase

@0xc0170 0xc0170 removed the needs: CI label Jan 9, 2020
Increasingly clever compilers can hit funny aliasing problems with
object stores like mbed::Callback. Add access to the C++17 launder
facility.
Avoids overload problems with Callback(nullptr) versus Callback(fnptr).
@adbridge
Copy link
Contributor

CI started

@mbed-ci
Copy link

mbed-ci commented Jan 20, 2020

Test run: SUCCESS

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

@adbridge adbridge merged commit 80fe861 into ARMmbed:master Jan 21, 2020
@adbridge adbridge added release-version: 6.0.0-alpha-2 Second pre-release version of 6.0.0 and removed ready for merge labels Jan 21, 2020
@mergify
Copy link

mergify bot commented Jan 21, 2020

This PR does not contain release version label after merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-version: 6.0.0-alpha-2 Second pre-release version of 6.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants