Error with unnamed structures
llewelly@xmission.com
llewelly@xmission.com
Mon May 17 01:45:00 GMT 2004
"Luiz Rafael Culik Guimaraes" <culikr@uol.com.br> writes:
> Dear friends
>
> this code bellow
>
> if __GNUC__ < 3 || defined( XWT_GTK_OLD_INHERITANCE )
> # define INHERIT( x ) x inherit
> # define INH( field ) inherit.field
> #else
> # define INHERIT( x ) x
> # define INH( field ) field
> #endif
> typedef struct tag_xwt_widget
> {
> ULONG sign;
>
> // type is at disposal of drivers to interpret widget data correctly
> int type;
>
> // pointer to raw widget data that is known by underlying driver
> void *widget_data;
>
> // Destroys the underlying data.
> BOOL (*destroy)( struct tag_xwt_widget *widget );
>
> // Sets a given property to a (variable type of) value
> BOOL (*set_property)( struct tag_xwt_widget *widget, char *prop, void*
> pValue );
>
> // Send a group change; pValue is a hash of properties to be changed in
> one step
> // useful to move, resize or reset the whole geometry.
> // drivers must cache all the changes and apply them at once on the best
> function
> BOOL (*set_pgroup)( struct tag_xwt_widget *widget, void* pValue );
>
> // retreive a single property of the underlying widget
> BOOL (*get_property)( struct tag_xwt_widget *widget, char *prop, void*
> pValue );
>
> // creates a hash containing all the properties valid for this widget.
> // properties are to be put in the PHB_ITEM pProps that is to be
> provided by the caller,
> // the modules will receive it ready to accept properties
> BOOL (*get_all_properties)( struct tag_xwt_widget *widget, void*
> pProps );
>
> void hbOwner; // shell holding the owner
> void* pOwner; // commodity reference to the owner object
>
> } XWT_WIDGET, *PXWT_WIDGET;
>
> typedef struct tag_xwt_gtk_base
> {
> GtkWidget *main_widget;
> GtkWidget * (*top_widget)( PXWT_WIDGET self );
> int x;
> int y;
> int width;
> int height;
> int nId;
> } XWT_GTK_BASE, *PXWT_GTK_BASE;
>
>
> typedef struct tag_xwt_gtk_modal
> {
> INHERIT( XWT_GTK_BASE );
> BOOL modal;
> BOOL canceled;
> } XWT_GTK_MODAL, *PXWT_GTK_MODAL;
>
> Compile properly on gcc 3.2.2
But with pedantic gcc 3.2.2 says:
xwt.c:71: warning: ISO C doesn't support unnamed structs/unions
> but if i try to compile with gcc 3.3.x i got errors like
> xwt_gtk.h:63: warning: declaration does not declare anything
> xwt_gtk.h:71: warning: declaration does not declare anything
>
> Is unnamed structures not more supported on gcc 3.3.x
unnamed structures are not part of ISO C. You must use
'-fms-extensions' to enable them.
>
> how to correct the code to work with unnamed structures , or exist an
> compiler switch to enable gcc 3.2 behavior
>
> Regards
> Luiz
More information about the Gcc-help
mailing list