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

Enabling -Wall GCC option shows some warnings #22

Closed
valkuc opened this issue Oct 8, 2017 · 2 comments
Closed

Enabling -Wall GCC option shows some warnings #22

valkuc opened this issue Oct 8, 2017 · 2 comments
Assignees
Labels

Comments

@valkuc
Copy link
Contributor

valkuc commented Oct 8, 2017

I'm not familar with assembler, please check either those variables are used or can be safely removed:

'a_bit_index' is used uninitialized in this function [-Wuninitialized]	brzo_i2c.c	line 768
'a_bit_index' may be used uninitialized in this function [-Wmaybe-uninitialized]	brzo_i2c.c	line 73
'a_bit_index' may be used uninitialized in this function [-Wmaybe-uninitialized]	brzo_i2c.c	line 389
'a_in_value' is used uninitialized in this function [-Wuninitialized]	brzo_i2c.c	line 768
'a_in_value' may be used uninitialized in this function [-Wmaybe-uninitialized]	brzo_i2c.c	line 73
'a_in_value' may be used uninitialized in this function [-Wmaybe-uninitialized]	brzo_i2c.c	line 389
'a_set' is used uninitialized in this function [-Wuninitialized]	brzo_i2c.c	line 768
'a_set' is used uninitialized in this function [-Wuninitialized]	brzo_i2c.c	line 1082
'a_set' may be used uninitialized in this function [-Wmaybe-uninitialized]	brzo_i2c.c	line 73
'a_set' may be used uninitialized in this function [-Wmaybe-uninitialized]	brzo_i2c.c	line 389
'a_temp1' is used uninitialized in this function [-Wuninitialized]	brzo_i2c.c	line 768
'a_temp1' is used uninitialized in this function [-Wuninitialized]	brzo_i2c.c	line 1082
'a_temp1' may be used uninitialized in this function [-Wmaybe-uninitialized]	brzo_i2c.c	line 73
'a_temp1' may be used uninitialized in this function [-Wmaybe-uninitialized]	brzo_i2c.c	line 389

@pasko-zh pasko-zh self-assigned this Oct 8, 2017
@pasko-zh
Copy link
Owner

These variables are only needed for the inline assembler. They are on the "clobber list": This means, you can set an alias variable name that you can use in the inline assembly. For instance, a_temp1 can be referred to as r_temp1 in the inline assembly.

The "downside" is that if you want to use variables in inline assembly instead of registers, you have to do it this way. And the compiler may give you these warnings, because in the rest of the C code these variable are not used.

The advantage is that the compiler will then replace these variables, e.g., r_temp1, in an optimal way with real registers.

@valkuc
Copy link
Contributor Author

valkuc commented Oct 15, 2017

Ok, no problem!

@valkuc valkuc closed this as completed Oct 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants