Skip to content

msp430: Discard order argument when using __sync_xxx for atomics#6587

Merged
OlegHahm merged 2 commits intoRIOT-OS:masterfrom
jnohlgard:pr/stdatomic-sync-discard-order
Mar 8, 2017
Merged

msp430: Discard order argument when using __sync_xxx for atomics#6587
OlegHahm merged 2 commits intoRIOT-OS:masterfrom
jnohlgard:pr/stdatomic-sync-discard-order

Conversation

@jnohlgard
Copy link
Copy Markdown
Member

Fixes the false positive -Wunused-value warning when building with gcc-4.6.3 on msp430.
Previously we had to explicitly ignore the value to avoid getting

error: value computed is not used [-Werror=unused-value]

The compiler mistakenly thinks that the atomic_fetch_add call is without side effects when used in the original implementation with the comma operator. I think it is likely a compiler bug, but the compiler is age old and I don't have any more time to spend on this.

With this PR, the order argument is silently discarded by the preprocessor, instead of evaluated and the result discarded. The order argument is ignored in our implementations of the helper library anyway, and it would just bad coding practice if you pass functions with side effects as the order argument on the atomic operation, so it should not really make any difference.

@jnohlgard jnohlgard added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Platform: MSP Platform: This PR/issue effects MSP-based platforms CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Feb 10, 2017
@jnohlgard jnohlgard added this to the Release 2017.04 milestone Feb 10, 2017
@jnohlgard jnohlgard mentioned this pull request Feb 10, 2017
55 tasks
@jnohlgard jnohlgard force-pushed the pr/stdatomic-sync-discard-order branch from b3ecebc to c5118c5 Compare February 10, 2017 10:04
@jnohlgard
Copy link
Copy Markdown
Member Author

required for #5616 to build on msp430

@jnohlgard
Copy link
Copy Markdown
Member Author

ping @kaspar030
Straightforward changeset, prerequisite for building #5616 without warnings.
There seem to be a compiler bug that thinks that the function is without side effects, therefore giving a warning that the return value is unused in the caller.

@jnohlgard jnohlgard force-pushed the pr/stdatomic-sync-discard-order branch from c5118c5 to 16d9f0e Compare March 6, 2017 18:51
@OlegHahm OlegHahm added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Mar 6, 2017
Copy link
Copy Markdown
Member

@OlegHahm OlegHahm left a comment

Choose a reason for hiding this comment

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

Just a nit: the commit message of the second commit seems too long.

@jnohlgard jnohlgard force-pushed the pr/stdatomic-sync-discard-order branch from 16d9f0e to b95eca2 Compare March 7, 2017 09:11
@jnohlgard
Copy link
Copy Markdown
Member Author

@OlegHahm addressed commit message, ready for review

@jnohlgard jnohlgard requested a review from OlegHahm March 7, 2017 09:12
Joakim Nohlgård added 2 commits March 7, 2017 10:21
This line gave a -Wunused-value in gcc-4.6 before the stdatomic.h header
for msp430 was modified as a workaround.
@jnohlgard jnohlgard force-pushed the pr/stdatomic-sync-discard-order branch from b95eca2 to 0f74b5b Compare March 7, 2017 09:21
Copy link
Copy Markdown
Member

@OlegHahm OlegHahm left a comment

Choose a reason for hiding this comment

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

ACK

@OlegHahm OlegHahm merged commit 408d18b into RIOT-OS:master Mar 8, 2017
@jnohlgard jnohlgard deleted the pr/stdatomic-sync-discard-order branch September 24, 2018 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: MSP Platform: This PR/issue effects MSP-based platforms Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants