Skip to content

add way to declare parameter as unused#72

Closed
mehlis wants to merge 1 commit intoRIOT-OS:masterfrom
mehlis:unused-parameter-macro
Closed

add way to declare parameter as unused#72
mehlis wants to merge 1 commit intoRIOT-OS:masterfrom
mehlis:unused-parameter-macro

Conversation

@mehlis
Copy link
Copy Markdown
Contributor

@mehlis mehlis commented Jul 17, 2013

Riot lags some way to declare, that a function parameter
is unused. This commit adds a file called "unused.h",
which defines some nice macros.

http://stackoverflow.com/questions/3599160/unused-parameter-warnings-in-c-code

this commit fixes #62 (the discussion wasn't finally over in this issue)

@Kijewski
Copy link
Copy Markdown
Contributor

Sorry, but I don't quite see the advantage in using UNUSED(variable) compared to the standards compliant (void) variable.

@Kijewski
Copy link
Copy Markdown
Contributor

Let me elaborate further why I'd prefer (void) var:
Using type UNUSED(var) in the parameters does not tell anything why it is unused, it simply hides a warning. You could accomplish that by using the -w parameter …

But (void) var can be used in the appropriate #IF branch, and/or you can assign a proper comment to it:

 (void) var; /* var is unused because of reason */

@RIOT-notifier
Copy link
Copy Markdown

On 07/18/13 12:48, René Kijewski wrote:

Let me elaborate further why I'd prefer |(void) var|:
| (void) var; /* var is unused because of reason /
Also, (void) var; works without any macro magic. I *hate
everything
written in all-capitals within function blocks and try to avoid it like
the pest.

@mehlis
Copy link
Copy Markdown
Contributor Author

mehlis commented Jul 18, 2013

ok, I see. You two prefer an other way :)

@Kijewski make a pull request and I' am totally with you in merging your code!

after having fixed this class of problems, there's just one single warning in riot (-Wall and -Wextra enabled, gcc and clang), so we are on a good way to have a warning free system!

@RIOT-notifier
Copy link
Copy Markdown

On 07/18/13 14:22, Christian Mehlis wrote:

after having fixed this class of problems, there's just one single
warning in riot (-Wall and -Wextra enabled, gcc and clang), so we are on
a good way to have a /warning free/ system!
Guys, this is AWESOME. If it's true for all supported platforms, let's
add -Werror to CFLAGS, make a nice headline and boast about it in our
features list!

+1 for committing (void) stuff.

@mehlis
Copy link
Copy Markdown
Contributor Author

mehlis commented Jul 18, 2013

current "master"+"unused fixes": native and msba2 are warning-free. msb-430h has some warnings.

@OlegHahm
Copy link
Copy Markdown
Member

I agree with @Kijewski the mysterious @RIOT-notifier ;-). So, I guess we can close this one.

@OlegHahm OlegHahm closed this Jul 19, 2013
chrysn pushed a commit to chrysn-pull-requests/RIOT that referenced this pull request Sep 16, 2022
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.

low hanging warnings fruits

4 participants