EmbDev.net

Forum: ARM programming with GCC/GNU tools avr-g++ with avr/io.h seems to hide warnings


von lutz_dd (Guest)


Attached files:

Rate this post
useful
not useful
My source code has typos by accident ... (1<<ADTS2,1<<ADTS1,1<<ADTS0).
Both ',' have to be '|'.

With compiler options   -Wall -pedantic   the warning
1
"warning: left operand of comma operator has no effect [-Wunused-value]"
should be returned by the compiler.

.
1
>>> avr-g++ -c -mmcu=atmega128rfa1 -pedantic -Wall -o weg.o weg.c
OK ... compiler warns
.
1
>>> avr-gcc -c -mmcu=atmega128rfa1 -pedantic -Wall -o weg.o weg.c
OK ... compiler warns
.
1
>>> avr-g++ -c -mmcu=atmega128rfa1 -pedantic -Wall -DAVR_IO=1 -o weg.o weg.c
NOT_OK ... avr-g+ hides  the warning with the "avr/io.h" included.
It has been tested with avr-g++ (GCC) 4.9.2 by myself and a
fellow has checked GCC 5.4.0.
.
1
>>> avr-gcc -c -mmcu=atmega128rfa1 -pedantic -Wall -DAVR_IO=1 -o weg.o weg.c
OK ... compiler warns
.

Attached files
- "weg.c" is the source code for test (commands are added as comments, 
-DAVR_IO=1 includes "avr/io.h")
- "weg.lis" the command line output (cmd.exe @ Win7)


I would like to know what allows the compiler to hide the warnings ... 
or what is the reason for not having the warning in this special 
context.

: Moved by Moderator
von lutz_dd (Guest)


Rate this post
useful
not useful
Btw. ... adding
1
-Wextra
 does not help.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.