avr-g++ with avr/io.h seems to hide warnings

Guest #5335251
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.
Attached files:

Reply

A question of your own? This thread is over 8 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.