Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#672 Can't use typedef enum as element of a struct

closed-fixed
Erik Petrich
5
2013-05-25
2004-01-05
Paul Stoffregen
No

SDCC is recently refusing to compile (what I believe
is) valid code that uses a typedef of a primitive type
enum as a member of a struct. This used to compile,
and "gcc -c -Wall" accepts it without any warnings, and
as nearly as I can tell it's valid C.

Tested with cvs checkout on Jan 5, 2004 using mcs51 on
Linux (redhat9). SDCC :
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08
2.3.7 (Jan 5 2004) (UNIX)

Compile with "sdcc -c enum_test.c" or "sdcc -c
--model-large enum_test.c", or with "gcc -c -Wall
enum_test.c" (tested with gcc 3.2.2, supplied by redhat9).

Error from SDCC is:

enum_test.c:28: error: storage class not allowed here
-:0: error: code not generated for 'parse_event' due to
previous errors
-:0: error: code not generated for 'parse_line' due to
previous errors

Download the enum_test.c code here:

http://www.pjrc.com/tmp/enum_test.c

I will also attempt to attach a copy to this bug....

Discussion

  • Logged In: YES
    user_id=104682

    Attaching a new copy of the sample code, which fixes an
    extra comma in the enum definition. This didn't really
    matter, but now the code compiles without any warnings in
    gcc, even when run as "gcc -Wall -ansi -pedantic -c enum_test.c"

     
  • Sample code

     
    Attachments
  • Erik Petrich
    Erik Petrich
    2004-01-06

    • milestone: --> fixed
    • assigned_to: nobody --> epetrich
    • status: open --> closed-fixed
     
  • Erik Petrich
    Erik Petrich
    2004-01-06

    Logged In: YES
    user_id=635249

    This bug, along with a three other enum related bugs, has
    been fixed. See ChangeLog 1.559 for the list of updated files.