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

Toolchain attributes - use C++11/C11 #10837

Merged
merged 3 commits into from Jul 4, 2019

Conversation

@kjbracey-arm
Copy link
Contributor

commented Jun 14, 2019

Description

Use standard C++11/C11 forms for MBED_STRUCT_STATIC_ASSERT, MBED_NORETURN and MBED_ALIGN when available.

Using standard forms increases the chances that code analysis tools such Coverity will recognise them - particularly important for "no return".

Fix excess alignment problem caused by non-C++11 MBED_STRUCT_STATIC_ASSERT fallback using int.

Pull request type

[ ] Fix
[X] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change
The `int : 0` bitfield this produced could force integer alignment onto
the structure it was placed in, making a structure that should be 1 byte
be 4 bytes.

Change `int` to `bool` to minimise alignment impact - should be to
nothing.

Alignment/size problem was revealed in a `sizeof` check in an
`Atomic<uint8_t>` test.
@kjbracey-arm kjbracey-arm force-pushed the kjbracey-arm:toolchain11 branch from f531bf7 to 42812c5 Jun 14, 2019
If available, we can use standard static_assert.
Newer language standards have standard forms for `MBED_NORETURN` and
`MBED_ALIGN` attributes. Use them when available.

C++14 also adds `[[deprecated]]`, but as it needs to go in the middle of
structure definitions as `class [[deprecated]] MyClass`, it's not a
total drop-in-replacemend for `MBED_DEPRECATED`, so that is not
attempted here.

Using standard forms increases the chances that code analysis tools such
Coverity will recognise them - particularly important for "no return".
@kjbracey-arm kjbracey-arm force-pushed the kjbracey-arm:toolchain11 branch from 42812c5 to 703af8d Jun 14, 2019
@ciarmcom ciarmcom requested review from ARMmbed/mbed-os-maintainers Jun 14, 2019
@ciarmcom

This comment has been minimized.

Copy link
Member

commented Jun 14, 2019

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

@adbridge

This comment has been minimized.

Copy link
Contributor

commented Jun 20, 2019

@bulislaw one for you perhaps to review ?

@0xc0170
0xc0170 approved these changes Jul 4, 2019
@0xc0170

This comment has been minimized.

Copy link
Member

commented Jul 4, 2019

CI started

@mbed-ci

This comment has been minimized.

Copy link

commented Jul 4, 2019

Test run: SUCCESS

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

@0xc0170 0xc0170 added ready for merge and removed needs: CI labels Jul 4, 2019
@0xc0170 0xc0170 merged commit e4b4539 into ARMmbed:master Jul 4, 2019
26 checks passed
26 checks passed
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jenkins-ci/build-ARM Success
Details
jenkins-ci/build-GCC_ARM Success
Details
jenkins-ci/build-IAR Success
Details
jenkins-ci/cloud-client-test Success
Details
jenkins-ci/dynamic-memory-usage RTOS ROM(+0 bytes) RAM(+0 bytes)
Details
jenkins-ci/exporter Success
Details
jenkins-ci/greentea-test Success
Details
jenkins-ci/mbed2-build-ARM Success
Details
jenkins-ci/mbed2-build-GCC_ARM Success
Details
jenkins-ci/mbed2-build-IAR Success
Details
jenkins-ci/unittests Success
Details
travis-ci/astyle Success!
Details
travis-ci/docs Success!
Details
travis-ci/doxy-spellcheck Success!
Details
travis-ci/events Success! Runtime is 8578 cycles.
Details
travis-ci/gitattributestest Success!
Details
travis-ci/include_check Success!
Details
travis-ci/licence_check Success!
Details
travis-ci/littlefs Success! Code size is 8448B.
Details
travis-ci/psa-autogen Success!
Details
travis-ci/tools-py2.7 Success!
Details
travis-ci/tools-py3.5 Success!
Details
travis-ci/tools-py3.6 Success!
Details
travis-ci/tools-py3.7 Success!
Details
@0xc0170 0xc0170 removed the ready for merge label Jul 4, 2019
@kjbracey-arm kjbracey-arm deleted the kjbracey-arm:toolchain11 branch Jul 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.