[PATCH libXi 2/2] Fix const compiler warnings

Dan Nicholson dbn.lists at gmail.com
Sat Dec 8 09:18:49 PST 2012


On Thu, Dec 6, 2012 at 9:38 PM, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> XExtInt.c:80:38: warning: initialization discards 'const' qualifier from
> pointer target type [enabled by default]
> XExtInt.c:150:5: warning: initialization discards 'const' qualifier from
> pointer target type [enabled by default]
> XExtInt.c:151:5: warning: initialization discards 'const' qualifier from
> pointer target type [enabled by default]
> XExtInt.c:152:5: warning: initialization discards 'const' qualifier from
> pointer target type [enabled by default]
> XExtInt.c:153:5: warning: initialization discards 'const' qualifier from
> pointer target type [enabled by default]
> XExtInt.c:154:5: warning: initialization discards 'const' qualifier from
> pointer target type [enabled by default]
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  src/XExtInt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/XExtInt.c b/src/XExtInt.c
> index fd1ae6c..1c668c7 100644
> --- a/src/XExtInt.c
> +++ b/src/XExtInt.c
> @@ -77,7 +77,7 @@ int copy_classes(XIDeviceInfo *to, xXIAnyInfo* from, int *nclasses);
>  int size_classes(xXIAnyInfo* from, int nclasses);
>
>  static XExtensionInfo *xinput_info;
> -static /* const */ char *xinput_extension_name = INAME;
> +static const char *xinput_extension_name = INAME;
>
>  static int XInputClose(
>      Display *          /* dpy */,
> @@ -143,7 +143,7 @@ static /* const */ XExtensionHooks xinput_extension_hooks = {
>      XInputError,       /* error_string */
>  };
>
> -static char *XInputErrorList[] = {
> +static const char *XInputErrorList[] = {
>      "BadDevice, invalid or uninitialized input device",        /* BadDevice */
>      "BadEvent, invalid event type",    /* BadEvent */
>      "BadMode, invalid mode parameter", /* BadMode  */

I didn't actually look through the code to see all the usage of these
two variables, but I imagine you would have got more compiler warnings
if it wasn't OK to make these const.

Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>


More information about the xorg-devel mailing list