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

Allow use of log_x() in if #5844

Merged
merged 1 commit into from
Nov 4, 2021
Merged

Allow use of log_x() in if #5844

merged 1 commit into from
Nov 4, 2021

Conversation

FrankBoesing
Copy link
Contributor

if (1) log_e("error") produces a warning ("missing braces") and probably wrong code if no log level is defined.
This fixes that.

if (1) log_e("error") produces a warning ("missing braces") and probably wrong code if no log level is defined.
This fixes that.
@CLAassistant
Copy link

CLAassistant commented Nov 3, 2021

CLA assistant check
All committers have signed the CLA.

@me-no-dev me-no-dev merged commit 79e0889 into espressif:master Nov 4, 2021
@me-no-dev
Copy link
Member

Nice solution :)

@marcboon
Copy link

marcboon commented Nov 9, 2021

I've seen this solution before, but why 'do {} while(0)' instead of just '{}' ?

@FrankBoesing
Copy link
Contributor Author

Because this is a systax error:

#define foo {}

if (1) foo; 
else {}

This not:

#define foo do {} while(0)

if (1) foo; 
else {}

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

Successfully merging this pull request may close these issues.

4 participants