Eliminate remaining gcc warnings
authorDaniel Stone <daniel@fooishbar.org>
Tue, 3 Apr 2012 13:26:04 +0000 (14:26 +0100)
committerDaniel Stone <daniel@fooishbar.org>
Mon, 9 Apr 2012 12:47:23 +0000 (13:47 +0100)
Various one-liners (mostly removing unused variables) to make the code
safe for the full set of warnings used by the xorg macros.

On Debian-based systems, flex generates incorrect code resulting in two
warnings about yy_getcolumn and yy_setcolumn having no previous
declaration despite being non-static.  Fedora carries a patch to fix
this, and a bug has been filed on Debian's flex to add the patch:
http://bugs.debian.org/667027

Aside from this, it's now safe for --enable-strict-compilation.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
src/context.c
src/keysym.c
src/malloc.c
src/xkbcomp/symbols.c

index fbb93e4..cbad424 100644 (file)
@@ -147,12 +147,12 @@ xkb_context_num_include_paths(struct xkb_context *context)
  * invalid index is passed.
  */
 const char *
-xkb_context_include_path_get(struct xkb_context *context, unsigned int index)
+xkb_context_include_path_get(struct xkb_context *context, unsigned int idx)
 {
-    if (index >= xkb_context_num_include_paths(context))
+    if (idx >= xkb_context_num_include_paths(context))
         return NULL;
 
-    return context->include_paths[index];
+    return context->include_paths[idx];
 }
 
 /**
index 7126d28..add0b83 100644 (file)
@@ -157,7 +157,7 @@ xkb_string_to_keysym(const char *s)
      * As a last ditch effort, try without. */
     if (strncmp(s, "XF86_", 5) == 0) {
         xkb_keysym_t ret;
-        char *tmp = strdup(s);
+        tmp = strdup(s);
         if (!tmp)
             return XKB_KEYSYM_NO_SYMBOL;
         memmove(&tmp[4], &tmp[5], strlen(s) - 5 + 1);
index 80ebc69..ba16703 100644 (file)
@@ -32,7 +32,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 int
 XkbcAllocClientMap(struct xkb_desc * xkb, unsigned which, unsigned nTotalTypes)
 {
-    int i;
     struct xkb_client_map * map;
 
     if (!xkb || ((nTotalTypes > 0) && (nTotalTypes < XkbNumRequiredTypes)))
index 9605324..a2c4a15 100644 (file)
@@ -322,8 +322,6 @@ static Bool
 ResizeKeyGroup(KeyInfo * key, unsigned int group, unsigned int numLevels,
                unsigned sizeSyms, Bool forceActions)
 {
-    Bool tooSmall;
-    unsigned newWidth;
     int i;
 
     if (key->syms[group] == NULL || key->sizeSyms[group] < sizeSyms)
@@ -378,12 +376,12 @@ static Bool
 MergeKeyGroups(SymbolsInfo * info,
                KeyInfo * into, KeyInfo * from, unsigned group)
 {
-    xkb_keysym_t *resultSyms;
+    xkb_keysym_t *resultSyms = NULL;
     union xkb_action *resultActs;
     unsigned int resultWidth;
     unsigned int resultSize = 0;
     int cur_idx = 0;
-    int i, j;
+    int i;
     Bool report, clobber;
 
     clobber = (from->defs.merge != MergeAugment);
@@ -1943,9 +1941,9 @@ CopySymbolsDef(struct xkb_desc * xkb, KeyInfo *key, int start_from)
     unsigned width, tmp, nGroups;
     struct xkb_key_type * type;
     Bool haveActions, autoType, useAlias;
-    xkb_keysym_t *outSyms;
+    xkb_atom_t types[XkbNumKbdGroups];
     union xkb_action *outActs;
-    unsigned types[XkbNumKbdGroups];
+
     unsigned int symIndex = 0;
 
     useAlias = (start_from == 0);