How to use pgmspace.h in a library source without warning?

Georg-Johann Lay <[email protected]>
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <[email protected]>
Suppose the following include in a library source.c:

#include <avr/pgmspace.h>

and the source compiled with, e.g. -mmcu=avr5 or -mmcu=avr35 etc.

This throws a warning like:

$ avr-gcc -mmcu=avr5 source.c -c

In file included from INSTALL/avr/include/avr/pgmspace.h:88:0,
                  from source.c:1:
INSTALL/avr/include/avr/io.h:428:6: warning: #warning "device type not 
defined" [-Wcpp]

Is there a way to build library modules that use pgmspace functionality 
without such annoying warning?

The -mmcu= options are queried directly from the compiler, for example 
with avr-gcc 4.7:

$ avr-gcc -print-multi-lib
.;
avr25;@mmcu=avr25
avr3;@mmcu=avr3
avr31;@mmcu=avr31
avr35;@mmcu=avr35
avr4;@mmcu=avr4
avr5;@mmcu=avr5
avr51;@mmcu=avr51
avr6;@mmcu=avr6
avrxmega2;@mmcu=avrxmega2
avrxmega4;@mmcu=avrxmega4
avrxmega5;@mmcu=avrxmega5
avrxmega6;@mmcu=avrxmega6
avrxmega7;@mmcu=avrxmega7
tiny-stack;@msp8
avr25/tiny-stack;@mmcu=avr25@msp8

The options are given by the parts after the ;

Thanks for advice


Johann
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.