EmbDev.net

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


Author: lutz_dd (Guest)
Posted on:
Attached files:

Rate this post
0 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
"warning: left operand of comma operator has no effect [-Wunused-value]"
should be returned by the compiler.

.
>>> avr-g++ -c -mmcu=atmega128rfa1 -pedantic -Wall -o weg.o weg.c
OK ... compiler warns
.
>>> avr-gcc -c -mmcu=atmega128rfa1 -pedantic -Wall -o weg.o weg.c
OK ... compiler warns
.
>>> 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.
.
>>> 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
Author: lutz_dd (Guest)
Posted on:

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

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.