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

macro attributes should be used with brackets #2617

Closed
bitluni opened this issue Oct 18, 2016 · 2 comments
Closed

macro attributes should be used with brackets #2617

bitluni opened this issue Oct 18, 2016 · 2 comments

Comments

@bitluni
Copy link

bitluni commented Oct 18, 2016

Low-level macros are vulnerable to operator priorities which can cause problems. Took me some time to find why my code didn't work

Arduino/tools/sdk/include/eagle_soc.h rows:

# define GPIO_REG_READ(reg)                         READ_PERI_REG(PERIPHS_GPIO_BASEADDR + reg)
# define GPIO_REG_WRITE(reg, val)                 WRITE_PERI_REG(PERIPHS_GPIO_BASEADDR + reg, val)

should bechanged to:

# define GPIO_REG_READ(reg)                         READ_PERI_REG(PERIPHS_GPIO_BASEADDR + (reg))
# define GPIO_REG_WRITE(reg, val)                 WRITE_PERI_REG(PERIPHS_GPIO_BASEADDR + (reg), val)

@devyte
Copy link
Collaborator

devyte commented Oct 11, 2017

@bitluni I still see this in the latest code. Care to make a PR?

@devyte devyte added type: bug waiting for feedback Waiting on additional info. If it's not received, the issue may be closed. level: easy labels Oct 11, 2017
@devyte devyte self-assigned this Feb 28, 2018
@devyte devyte added this to the 2.5.0 milestone Feb 28, 2018
fabianoms added a commit to fabianoms/Arduino that referenced this issue Mar 13, 2018
@igrr igrr added staged-for-release and removed waiting for feedback Waiting on additional info. If it's not received, the issue may be closed. labels Mar 13, 2018
@igrr igrr unassigned devyte Mar 13, 2018
igrr pushed a commit that referenced this issue Mar 13, 2018
bryceschober pushed a commit to bryceschober/Arduino that referenced this issue Apr 5, 2018
related to the issue esp8266#2617.

(cherry picked from commit 3ce888e)
@devyte devyte modified the milestones: 2.5.0, 2.4.2 Aug 1, 2018
@devyte
Copy link
Collaborator

devyte commented Aug 1, 2018

Correcting milestone to 2.4.2

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

No branches or pull requests

3 participants