-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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, thank you for your changes. |
@bulislaw one for you perhaps to review ? |
bulislaw
approved these changes
Jun 20, 2019
0xc0170
approved these changes
Jul 4, 2019
CI started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Use standard C++11/C11 forms for
MBED_STRUCT_STATIC_ASSERT
,MBED_NORETURN
andMBED_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 usingint
.Pull request type