Thanks Maarten, 

I will patch the codebase and ask the upstream to avoid this issue.

a*

Maarten Brock wrote:
Hi Anthony,

This is a known bug. See
https://sourceforge.net/tracker/?func=detail&aid=1579664&group_id=599&atid=100599

Maarten


  
Try to remove struct keyword from extern struct ... line.

I thing that compiler behaves according to standard, as typedef struct
typename defines type, so struct keyword should not be used, however
struct
tagname ... declares tag, so struct keyword is required.

Ondrej



-----Original Message-----
From: Anthony Asterisk [mailto:anthony.asterisk@gmail.com]
Sent: Wednesday, May 12, 2010 1:57 AM
To: sdcc-user@lists.sourceforge.net
Subject: [Sdcc-user] sdcc reports syntax error if struct and typedef
usesame
name?



When I compile this code:

 cat main.c
#include <string.h>

typedef struct uip_eth_addr {
  unsigned char addr[6];
} uip_eth_addr;

extern struct uip_eth_addr uip_ethaddr;

void main (void)
{
}

user@instant-contiki:~/sdcc_bug3$ sdcc main.c

main.c:7: syntax error: token -> 'uip_eth_addr' ; column 26


If I simply rename the typedef then it compiles fine:

user@instant-contiki:~/sdcc_bug3$ !cat
cat main.c
#include <string.h>

typedef struct uip_eth_addr {
  unsigned char addr[6];
} uip_eth_addr_t;

extern struct uip_eth_addr uip_ethaddr;

void main (void)
{
}
user@instant-contiki:~/sdcc_bug3$ !sd
sdcc main.c


No syntax error!

Both versions compile with GCC.

so is this:

1) a limitation of sdcc
2) a bug in sdcc
3) a non-standard behavror of gcc
    


------------------------------------------------------------------------------

_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user