[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-chat] troublesome compilation warning
From: |
jepler |
Subject: |
Re: [avr-chat] troublesome compilation warning |
Date: |
Mon, 22 Aug 2005 21:35:52 -0500 |
User-agent: |
Mutt/1.4.2i |
The following program compiles without warnings with the following flags:
-mmcu=at90s2313 -ansi -pedantic -Wall -ffreestanding -c extension.c
on avr-gcc 3.2.2. It is the use of __extension__ that makes the use of the
non-ANSI construct not give a warning. With the same flags, the PSTR
definition from pgmspace.h (shown in the comment) does print the warning you
mention.
So, anyway, add __extension__ and gcc will not complain about your use of a
non-ANSI construct.
Jeff
/* -------------------------------------------------------------------- */
/* avr-gcc -mmcu=at90s2313 -ansi -pedantic -Wall -ffreestanding */
/* -------------------------------------------------------------------- */
#include <avr/pgmspace.h>
#undef PSTR
/* #define PSTR(s) ({static char __c[] PROGMEM = (s); __c;}) */
#define PSTR(s) (__extension__({static char __c[] PROGMEM = (s); __c;}))
extern void f(const char *);
void main(void) { f(PSTR("hi")); }
/* -------------------------------------------------------------------- */
pgpkSe7E_PvKD.pgp
Description: PGP signature