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

Clarify intention between comparison to zero and the shift operation #6263

Merged
merged 2 commits into from Mar 7, 2018

Conversation

Projects
None yet
6 participants
@pauluap

pauluap commented Mar 4, 2018

Description

Building with (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 gives this warning

../events/equeue/equeue.c: In function 'equeue_incid':
../events/equeue/equeue.c:40:17: warning: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
if (!(e->id << q->npw2)) {

Pull request type

  • Fix
  • Refactor
  • New target
  • Feature
  • Breaking change
Paul Thompson
Clarify intention between comparison to zero and the shift operation
Building with (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 gives this warning

../events/equeue/equeue.c: In function 'equeue_incid':
../events/equeue/equeue.c:40:17: warning: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
     if (!(e->id << q->npw2)) {
@0xc0170

This comment has been minimized.

Member

0xc0170 commented Mar 5, 2018

@pauluap Thanks for the fix. Can you please sign https://os.mbed.com/contributor_agreement/ ?

Please use the github template to specify what type of PR is it (I updated it for now)

@0xc0170 0xc0170 added the needs: work label Mar 5, 2018

@pauluap

This comment has been minimized.

pauluap commented Mar 5, 2018

I clicked "accept" on the contributor agreement link, not sure if you get notified of that

@0xc0170 0xc0170 added needs: review and removed needs: work labels Mar 5, 2018

@geky

Thanks for taking care of that warning 👍

@@ -37,7 +37,7 @@ static inline int equeue_clampdiff(unsigned a, unsigned b) {
// Increment the unique id in an event, hiding the event from cancel
static inline void equeue_incid(equeue_t *q, struct equeue_event *e) {
e->id += 1;
if (!(e->id << q->npw2)) {
if (0 == (e->id << q->npw2)) {

This comment has been minimized.

@geky

geky Mar 5, 2018

Member

nit: Could you flip the order of this comparison? It's easier to read with constants on the right, and all of our compilers have warnings against asignments in if statements anyways.

Paul Thompson
@geky

geky approved these changes Mar 5, 2018

Thanks! Look good to me

@cmonr

This comment has been minimized.

Contributor

cmonr commented Mar 6, 2018

/morph build

@cmonr cmonr added needs: CI and removed needs: review labels Mar 6, 2018

@cmonr

cmonr approved these changes Mar 6, 2018

@mbed-ci

This comment has been minimized.

mbed-ci commented Mar 6, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci

This comment has been minimized.

@mbed-ci

This comment has been minimized.

@studavekar

This comment has been minimized.

Collaborator

studavekar commented Mar 6, 2018

/morph mbed2-build

@cmonr cmonr merged commit 4b322d6 into ARMmbed:master Mar 7, 2018

19 checks passed

AWS-CI uVisor Build & Test Success
Details
ci-morph-build build completed
Details
ci-morph-exporter build completed
Details
ci-morph-mbed2-build 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
travis-ci/docs Local docs testing has passed
Details
travis-ci/events Local events testing has passed
Details
travis-ci/littlefs Passed, code size is 10060B (+0.00%)
Details
travis-ci/mbed2-ATMEL Local mbed2-ATMEL testing has passed
Details
travis-ci/mbed2-MAXIM Local mbed2-MAXIM testing has passed
Details
travis-ci/mbed2-NORDIC Local mbed2-NORDIC testing has passed
Details
travis-ci/mbed2-NUVOTON Local mbed2-NUVOTON testing has passed
Details
travis-ci/mbed2-NXP Local mbed2-NXP testing has passed
Details
travis-ci/mbed2-RENESAS Local mbed2-RENESAS testing has passed
Details
travis-ci/mbed2-SILICON_LABS Local mbed2-SILICON_LABS testing has passed
Details
travis-ci/mbed2-STM Local mbed2-STM testing has passed
Details
travis-ci/tools Local tools testing has passed
Details

@pauluap pauluap deleted the pauluap:equeue_gcc7_c++x11_warning branch Apr 16, 2018

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