> > Since recent version of GCC allow multiple typedefs of the same name as > long as it refers to the same type, we can avoid some of the > typedef/header issues if we just decide to require a version of gcc that > allows this behavior. This is also valid according ot the C11 standard. > I don't know exactly what version of gcc started to support this, and > it's likely that it won't be backward compatible to e.g. RHEL6. If we > want to support older compilers we'd have to find a different solution, > but I present this here for discussion. I supposed this patch would be better looking than other solutions however the other solution were all based on not having multiple type definitions. Could we use a backported gcc on rhel6 ? I remember for rhel5 there was an official gcc44 package you could install to get a newer compiler, maybe we can use it to support multiple typedefs on rhel6. Frediano > --- > server/dcc-encoders.h | 1 + > server/display-channel.h | 2 ++ > server/image-cache.h | 2 -- > server/main-channel-client.h | 1 - > server/stream.h | 3 +-- > 5 files changed, 4 insertions(+), 5 deletions(-) > > diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h > index 84f9f93..07effa2 100644 > --- a/server/dcc-encoders.h > +++ b/server/dcc-encoders.h > @@ -32,6 +32,7 @@ > #endif > #include "zlib-encoder.h" > > +typedef struct DisplayChannelClient DisplayChannelClient; > typedef struct RedCompressBuf RedCompressBuf; > typedef struct GlzDrawableInstanceItem GlzDrawableInstanceItem; > typedef struct RedGlzDrawable RedGlzDrawable; > diff --git a/server/display-channel.h b/server/display-channel.h > index 647d8c0..2332acf 100644 > --- a/server/display-channel.h > +++ b/server/display-channel.h > @@ -52,6 +52,7 @@ typedef struct DependItem { > RingItem ring_item; > } DependItem; > > +typedef struct Drawable Drawable; > struct Drawable { > uint8_t refs; > RingItem surface_list_link; > @@ -166,6 +167,7 @@ struct _Drawable { > } u; > }; > > +typedef struct DisplayChannel DisplayChannel; > struct DisplayChannel { > CommonGraphicsChannel common; // Must be the first thing > uint32_t bits_unique; > diff --git a/server/image-cache.h b/server/image-cache.h > index 38a318e..4a828d0 100644 > --- a/server/image-cache.h > +++ b/server/image-cache.h > @@ -23,9 +23,7 @@ > #include <common/canvas_base.h> > #include <common/ring.h> > > -/* FIXME: move back to display-channel.h (once structs are private) */ > typedef struct Drawable Drawable; > -typedef struct DisplayChannelClient DisplayChannelClient; > > typedef struct ImageCacheItem { > RingItem lru_link; > diff --git a/server/main-channel-client.h b/server/main-channel-client.h > index e65a2fb..53b1b98 100644 > --- a/server/main-channel-client.h > +++ b/server/main-channel-client.h > @@ -19,7 +19,6 @@ > > #include "red-channel.h" > > -/* FIXME: remove extra MainChannel typedef when possible */ > typedef struct MainChannel MainChannel; > typedef struct MainChannelClient MainChannelClient; > > diff --git a/server/stream.h b/server/stream.h > index 511d752..b6009bf 100644 > --- a/server/stream.h > +++ b/server/stream.h > @@ -42,9 +42,8 @@ > #define RED_STREAM_DEFAULT_LOW_START_BIT_RATE (2.5 * 1024 * 1024) // 2.5Mbps > #define MAX_FPS 30 > > -/* move back to display_channel once struct private */ > typedef struct DisplayChannel DisplayChannel; > - > +typedef struct DisplayChannelClient DisplayChannelClient; > typedef struct Stream Stream; > > typedef struct RedStreamActivateReportItem { > -- > 2.4.11 > > _______________________________________________ > Spice-devel mailing list > Spice-devel@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/spice-devel > _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel