Re: 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]>
Thomas D. Dean schrieb:
> On 06/07/13 09:53, Georg-Johann Lay wrote:
>> 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?
>>
> 
> Look at avr/io.h, where the warning is issued.  avr5 is not one of the 
> defined device types.
> 
> You have to use a specific device.
> 
> Tom Dean

That's not a good approach.  Reading avr/io.h, the solution reads

#define __COMPILING_AVR_LIBC__


Libraries are typically defined for groups of devices, not for each of 
the ~ 200 AVR devices...

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.