From: Nick Craig-W. <nc...@ax...> - 2002-07-22 20:27:30
|
sdcc -mmcs51 --model-large --stack-after-data -c bug1a.c struct x { char a; char b[10]; }; struct x test[3] = { { 1, { 1, 2, 3, 4, 5, }, }, { 2, { 1, }, }, { 3, { 1, 2, 3, }, }, }; There are 7 spurious commas in the above which sdcc doesn't complain about. Very perl but not very standard C ;-) (I noticed this when compiling something I'd written with sdcc with gcc). Checked with today's sdcc from CVS -- Nick Craig-Wood nc...@ax... |
From: Bernhard H. <ber...@be...> - 2002-07-23 06:08:11
|
> struct x { > char a; > char b[10]; > }; > > struct x test[3] = > { > { 1, { 1, 2, 3, 4, 5, }, }, > { 2, { 1, }, }, > { 3, { 1, 2, 3, }, }, > }; > > There are 7 spurious commas in the above which sdcc doesn't complain > about. Very perl but not very standard C ;-) (I noticed this when > compiling something I'd written with sdcc with gcc). Which gcc? I've tested it with 2.95.2 and 2.95.3, with --ansi and --pedantic. And with Borland C++ 5.5.1. None is complaining about commas. IIRC in the past somebody complained, that sdcc doesn't accept commas - and the bug was fixed. At the moment I think, it isn't a bug. Is it? Bernhard |
From: Nick Craig-W. <nc...@ax...> - 2002-07-23 08:30:31
|
On Tue, Jul 23, 2002 at 08:08:00AM +0200, Bernhard Held wrote: > > struct x { > > char a; > > char b[10]; > > }; > > > > struct x test[3] = > > { > > { 1, { 1, 2, 3, 4, 5, }, }, > > { 2, { 1, }, }, > > { 3, { 1, 2, 3, }, }, > > }; > > > > There are 7 spurious commas in the above which sdcc doesn't complain > > about. Very perl but not very standard C ;-) (I noticed this when > > compiling something I'd written with sdcc with gcc). > Which gcc? I've tested it with 2.95.2 and 2.95.3, with --ansi > and --pedantic. And with Borland C++ 5.5.1. None is complaining about > commas. IIRC in the past somebody complained, that sdcc doesn't accept > commas - and the bug was fixed. > > At the moment I think, it isn't a bug. Is it? Yes you are quite right. I tried it with gcc and with the ARM compiler and neither issued a warning. I misremembered where the problem was when porting from gcc to sdcc - it was in enums not arrays... If you compile this with SDCC you don't get a warning enum x { A, B, C, }; However if you compile with gcc you get gcc -Wall --pedantic -c bug1b.c bug1b.c:3: warning: comma at end of enumerator list Sorry for the confusing bug report! -- Nick Craig-Wood nc...@ax... |