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.