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

Platform: Allow copy of non copyable objects #5485

Merged
merged 3 commits into from Nov 16, 2017

Conversation

Projects
None yet
6 participants
@pan-
Member

pan- commented Nov 13, 2017

Description

This patch adds the compile time configuration "non-copyable-warning" to mbed platform library. When this configuration flag is set to true, compile time errors resulting of the copy of a NonCopyable object are transformed into compile time and runtime warning.

This may be useful for functional legacy code that erroneously copy non copyable resources. It is highly encouraged to fix non complying code; copy of objects not designed to be copied may lead to resources leak, operation on invalid memory location as well as random malfunctioning.

This patch turns compile time errors resulting of the copy of a NonCopyable object into compile time and runtime warnings when the code is compiled with the develop or release profile. The compile time error is still issued when the code is compiled with the debug profile.

Compile time error can be enforced by setting the compile time configuration "force-non-copyable-error" to true.

This patch also adds the macro MBED_PRETTY_FUNCTION which yield the string literal of the enclosing function signature.

Status

READY

Migrations

NO

@pan-

This comment has been minimized.

Member

pan- commented Nov 13, 2017

@sg- @janjongboom Could you review this PR ?

@sg-

This comment has been minimized.

Member

sg- commented Nov 13, 2017

This should be enabled by default (warning, not error) for develop and release profile but error when in debug profile as other traps are also enabled.

@pan- pan- force-pushed the pan-:non-copyable-warning branch Nov 13, 2017

@pan- pan- changed the title from Platform: Non copyable warning to Platform: Allow copy of non copyable objects Nov 13, 2017

@pan-

This comment has been minimized.

Member

pan- commented Nov 13, 2017

@sg- I've updated the PR to implement the expected behavior.

@sg-

sg- approved these changes Nov 13, 2017

@janjongboom

This comment has been minimized.

Contributor

janjongboom commented Nov 14, 2017

\o/

@0xc0170

Many style changes that distract from actual changes, can you please split the style changes into own separate commit?

@@ -5,7 +5,7 @@
* \defgroup platform_toolchain Toolchain functions
* @{
*/

This comment has been minimized.

@0xc0170

0xc0170 Nov 14, 2017

Member

For future reviews, please style changes in a separate commit

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Nov 14, 2017

@pan- 👍 Like the way it is with this patch

@tommikas jenkins has not yet started (no url here) ?

@tommikas

This comment has been minimized.

Contributor

tommikas commented Nov 14, 2017

@0xc0170 Yep, started a scan so it should soon start running.

pan- added some commits Nov 14, 2017

Platform: Add MBED_PRETTY_FUNCTION macro.
This macro yields a string literal of the enclosing function name.
Platform: Turn NonCopyable compile time error into warnings.
Turn the compile time error issued when a NonCopyable resource is copied
into a compile time and runtime warning.

If the application is compiled with the debug profile the compile time
error remains.

The compile time error can be enforced by setting the library option
force-non-copyable-error to true.

@pan- pan- force-pushed the pan-:non-copyable-warning branch to 80c9f8b Nov 14, 2017

@pan-

This comment has been minimized.

Member

pan- commented Nov 14, 2017

@0xc0170 EOL whitespace in its own commit.

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Nov 14, 2017

/morph build

@0xc0170 0xc0170 added needs: CI and removed needs: review labels Nov 14, 2017

@mbed-ci

This comment has been minimized.

mbed-ci commented Nov 14, 2017

Build : SUCCESS

Build number : 513
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5485/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci

This comment has been minimized.

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Nov 15, 2017

/morph test

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Nov 15, 2017

@0xc0170 Yep, started a scan so it should soon start running.

@tommikas After additional commit yesterday, no status here, can you manually trigger it please?

@mbed-ci

This comment has been minimized.

@0xc0170 0xc0170 merged commit 4198695 into ARMmbed:master Nov 16, 2017

6 checks passed

AWS-CI uVisor Build & Test Success
Details
ci-morph-build build completed
Details
ci-morph-exporter build completed
Details
ci-morph-test test completed
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@pan- pan- deleted the pan-:non-copyable-warning branch Jul 3, 2018

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