[Spice-devel] [xf86-video-qxl] Eliminate gcc warning "initialization discards 'const' qualifier from pointer target type"

Alon Levy alevy at redhat.com
Mon May 13 04:04:39 PDT 2013


Sorry for the noise, brain fart.

On Mon, 2013-05-13 at 14:01 +0300, Alon Levy wrote:
> ACK from me.
> 
> Soren, are you ok with this?
> 
> On Thu, 2013-03-21 at 13:03 -0500, Jeremy White wrote:
> > Signed-off-by: Jeremy White <jwhite at codeweavers.com>
> > ---
> > 
> > This is the controversial patch; see previous conversation here:
> >
> http://lists.freedesktop.org/archives/spice-devel/2012-September/010801.html
> > 
> > I feel the benefit (nearly zero warnings) outweighs the harm (our
> moral
> > outrage at what we have to do to the code).  I don't think we would
> > successfully get a change in upstream xorg (changing the type
> declaration
> > of OptionInfoRec is the only other approach I could find that
> addressed this).
> > 
> > Cheers,
> > 
> > Jeremy
> > 
> >  src/qxl_driver.c      |   22 +++++++++++++---------
> >  src/spiceqxl_inputs.c |   26 +++++++++++++++++---------
> >  2 files changed, 30 insertions(+), 18 deletions(-)
> > 
> > diff --git a/src/qxl_driver.c b/src/qxl_driver.c
> > index ff58601..8e59b5f 100644
> > --- a/src/qxl_driver.c
> > +++ b/src/qxl_driver.c
> > @@ -62,6 +62,10 @@ extern void compat_init_scrn (ScrnInfoPtr);
> >  
> >  #define BREAKPOINT()   do { __asm__ __volatile__ ("int $03"); }
> while (0)
> >  
> > +static char filter_str[] = "filter";
> > +static char auto_str[]   = "auto";
> > +static char auto_glz_str[]   = "auto_glz";
> > +static char driver_name[] = QXL_DRIVER_NAME;
> >  const OptionInfoRec DefaultOptions[] =
> >  {
> >      { OPTION_ENABLE_IMAGE_CACHE,
> > @@ -93,15 +97,15 @@ const OptionInfoRec DefaultOptions[] =
> >      { OPTION_SPICE_X509_KEY_FILE,
> >        "SpiceX509KeyFile",         OPTV_STRING,    {0}, FALSE},
> >      { OPTION_SPICE_STREAMING_VIDEO,
> > -      "SpiceStreamingVideo",      OPTV_STRING,    {.str =
> "filter"}, FALSE},
> > +      "SpiceStreamingVideo",      OPTV_STRING,    {.str =
> filter_str}, FALSE},
> >      { OPTION_SPICE_PLAYBACK_COMPRESSION,
> >        "SpicePlaybackCompression", OPTV_BOOLEAN,   {1}, FALSE},
> >      { OPTION_SPICE_ZLIB_GLZ_WAN_COMPRESSION,
> > -      "SpiceZlibGlzWanCompression", OPTV_STRING,  {.str = "auto"},
> FALSE},
> > +      "SpiceZlibGlzWanCompression", OPTV_STRING,  {.str =
> auto_str}, FALSE},
> >      { OPTION_SPICE_JPEG_WAN_COMPRESSION,
> > -      "SpiceJpegWanCompression",  OPTV_STRING,    {.str = "auto"},
> FALSE},
> > +      "SpiceJpegWanCompression",  OPTV_STRING,    {.str =
> auto_str}, FALSE},
> >      { OPTION_SPICE_IMAGE_COMPRESSION,
> > -      "SpiceImageCompression",    OPTV_STRING,    {.str =
> "auto_glz"}, FALSE},
> > +      "SpiceImageCompression",    OPTV_STRING,    {.str =
> auto_glz_str}, FALSE},
> >      { OPTION_SPICE_DISABLE_COPY_PASTE,
> >        "SpiceDisableCopyPaste",    OPTV_BOOLEAN,   {0}, FALSE},
> >      { OPTION_SPICE_IPV4_ONLY,
> > @@ -1197,8 +1201,8 @@ static void
> >  qxl_init_scrn (ScrnInfoPtr pScrn)
> >  {
> >      pScrn->driverVersion    = 0;
> > -    pScrn->driverName       = QXL_DRIVER_NAME;
> > -    pScrn->name             = QXL_DRIVER_NAME;
> > +    pScrn->driverName       = driver_name;
> > +    pScrn->name             = driver_name;
> >      pScrn->PreInit          = qxl_pre_init;
> >      pScrn->ScreenInit       = qxl_screen_init;
> >      pScrn->SwitchMode       = qxl_switch_mode;
> > @@ -1222,7 +1226,7 @@ qxl_probe (struct _DriverRec *drv, int flags)
> >      pScrn = xf86AllocateScreen (drv, flags);
> >      qxl_init_scrn (pScrn);
> >      
> > -    xf86MatchDevice (QXL_DRIVER_NAME, &device);
> > +    xf86MatchDevice (driver_name, &device);
> >      entityIndex = xf86ClaimNoSlot (drv, 0, device[0], TRUE);
> >      pEnt = xf86GetEntityInfo (entityIndex);
> >      pEnt->driver = drv;
> > @@ -1314,7 +1318,7 @@ qxl_pci_probe (DriverPtr drv, int entity,
> struct pci_device *dev, intptr_t match
> >  
> >  static DriverRec qxl_driver = {
> >      0,
> > -    QXL_DRIVER_NAME,
> > +    driver_name,
> >      qxl_identify,
> >      qxl_probe,
> >      qxl_available_options,
> > @@ -1358,7 +1362,7 @@ qxl_setup (pointer module, pointer opts, int
> *errmaj, int *errmin)
> >  
> >  static XF86ModuleVersionInfo qxl_module_info =
> >  {
> > -    QXL_DRIVER_NAME,
> > +    driver_name,
> >      MODULEVENDORSTRING,
> >      MODINFOSTRING1,
> >      MODINFOSTRING2,
> > diff --git a/src/spiceqxl_inputs.c b/src/spiceqxl_inputs.c
> > index 3c22d00..2b8a15e 100644
> > --- a/src/spiceqxl_inputs.c
> > +++ b/src/spiceqxl_inputs.c
> > @@ -46,9 +46,10 @@ void XSpicePointerUnInit(InputDriverPtr drv,
> InputInfoPtr pInfo, int flags);
> >  static
> >  void XSpiceKeyboardUnInit(InputDriverPtr drv, InputInfoPtr pInfo,
> int flags);
> >  
> > +static char xspice_pointer_name[] = "xspice pointer";
> >  static InputDriverRec XSPICE_POINTER = {
> >      1,
> > -    "xspice pointer",
> > +    xspice_pointer_name,
> >      NULL,
> >      XSpicePointerPreInit,
> >      XSpicePointerUnInit,
> > @@ -56,9 +57,10 @@ static InputDriverRec XSPICE_POINTER = {
> >      NULL /* defaults */
> >  };
> >  
> > +static char xspice_keyboard_name[] = "xspice keyboard";
> >  static InputDriverRec XSPICE_KEYBOARD = {
> >      1,
> > -    "xspice keyboard",
> > +    xspice_keyboard_name,
> >      NULL,
> >      XSpiceKeyboardPreInit,
> >      XSpiceKeyboardUnInit,
> > @@ -149,15 +151,20 @@ static void
> xspice_keyboard_control(DeviceIntPtr device, KeybdCtrl *ctrl)
> >      }
> >  }
> >  
> > +static char xspice_keyboard_rules[] = "evdev";
> > +static char xspice_keyboard_model[] = "pc105";
> > +static char xspice_keyboard_layout[] = "us";
> > +static char xspice_keyboard_variant[] = "";
> > +static char xspice_keyboard_options[] = "";
> >  static int xspice_keyboard_proc(DeviceIntPtr pDevice, int onoff)
> >  {
> >      DevicePtr pDev = (DevicePtr)pDevice;
> >      XkbRMLVOSet rmlvo = {
> > -        .rules = "evdev",
> > -        .model = "pc105",
> > -        .layout = "us",
> > -        .variant = "",
> > -        .options = "",
> > +        .rules = xspice_keyboard_rules,
> > +        .model = xspice_keyboard_model,
> > +        .layout = xspice_keyboard_layout,
> > +        .variant = xspice_keyboard_variant,
> > +        .options = xspice_keyboard_options,
> >      };
> >  
> >      switch (onoff) {
> > @@ -350,6 +357,7 @@ static const SpiceTabletInterface
> tablet_interface = {
> >      .buttons            = tablet_buttons,
> >  };
> >  
> > +static char unknown_type_string[] = "UNKNOWN";
> >  static int
> >  XSpiceKeyboardPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int
> flags)
> >  {
> > @@ -360,7 +368,7 @@ XSpiceKeyboardPreInit(InputDriverPtr drv,
> InputInfoPtr pInfo, int flags)
> >      kbd->pInfo = pInfo;
> >  
> >      pInfo->private = kbd;
> > -    pInfo->type_name = "UNKNOWN";
> > +    pInfo->type_name = unknown_type_string;
> >      pInfo->device_control = xspice_keyboard_proc;
> >      pInfo->read_input = NULL;
> >      pInfo->switch_mode = NULL;
> > @@ -381,7 +389,7 @@ XSpicePointerPreInit(InputDriverPtr drv,
> InputInfoPtr pInfo, int flags)
> >      spice_pointer->pInfo = pInfo;
> >  
> >      pInfo->private = NULL;
> > -    pInfo->type_name = "UNKNOWN";
> > +    pInfo->type_name = unknown_type_string;
> >      pInfo->device_control = xspice_pointer_proc;
> >      pInfo->read_input = NULL;
> >      pInfo->switch_mode = NULL;
> > -- 
> > 1.7.10.4
> > 
> > 
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel




More information about the Spice-devel mailing list