[PATCH 1/2] xf86Config: Fix warning: declaration of 'Pointer' shadows a global

Mark Kettenis mark.kettenis at xs4all.nl
Mon Mar 3 02:23:35 PST 2014


> From: Hans de Goede <hdegoede at redhat.com>
> Date: Mon,  3 Mar 2014 09:53:12 +0100
> 
> This fixes the following compiler warning:
> 
> xf86Config.c: In function 'checkCoreInputDevices':
> xf86Config.c:1136:18: warning: declaration of 'Pointer' shadows a global declaration [-Wshadow]
>      InputInfoPtr Pointer, Keyboard;
>                   ^
> In file included from xf86Xinput.h:57:0,
>                  from xf86Config.c:66:
> /opt/xorg/include/X11/extensions/XIproto.h:88:24: warning: shadowed declaration is here [-Wshadow]
>  typedef unsigned char *Pointer;

Your compiler is on drugs.  Pointer is a typedef, which is a
completely different namespace from variable names.

> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> ---
>  hw/xfree86/common/xf86Config.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
> index 542d5ab..b38331b 100644
> --- a/hw/xfree86/common/xf86Config.c
> +++ b/hw/xfree86/common/xf86Config.c
> @@ -1133,7 +1133,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
>      const char *pointerMsg = NULL, *keyboardMsg = NULL;
>      InputInfoPtr *devs,         /* iterator */
>       indp;
> -    InputInfoPtr Pointer, Keyboard;
> +    InputInfoPtr pointer, Keyboard;
>      XF86ConfInputPtr confInput;
>      XF86ConfInputRec defPtr, defKbd;
>      MessageType from = X_DEFAULT;
> @@ -1239,26 +1239,26 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
>  
>      /* Add the core pointer device to the layout, and set it to Core. */
>      if (foundPointer && confInput) {
> -        Pointer = xf86AllocateInput();
> -        if (Pointer)
> -            foundPointer = configInput(Pointer, confInput, from);
> +        pointer = xf86AllocateInput();
> +        if (pointer)
> +            foundPointer = configInput(pointer, confInput, from);
>          if (foundPointer) {
> -            Pointer->options = xf86AddNewOption(Pointer->options,
> +            pointer->options = xf86AddNewOption(pointer->options,
>                                                  "CorePointer", "on");
> -            Pointer->options = xf86AddNewOption(Pointer->options,
> +            pointer->options = xf86AddNewOption(pointer->options,
>                                                  "driver",
>                                                  confInput->inp_driver);
> -            Pointer->options =
> -                xf86AddNewOption(Pointer->options, "identifier",
> +            pointer->options =
> +                xf86AddNewOption(pointer->options, "identifier",
>                                   confInput->inp_identifier);
> -            servlayoutp->inputs = addDevice(servlayoutp->inputs, Pointer);
> +            servlayoutp->inputs = addDevice(servlayoutp->inputs, pointer);
>          }
>      }
>  
>      if (!foundPointer && xf86Info.forceInputDevices) {
>          /* This shouldn't happen. */
>          xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n");
> -        xf86DeleteInput(Pointer, 0);
> +        xf86DeleteInput(pointer, 0);
>          return FALSE;
>      }
>  
> -- 
> 1.9.0
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list