Commit 632d9f0336a3fb0721fbecc34b67e15d0ddbc69b

Daniel Stone 2012-04-03T14:26:04

Eliminate remaining gcc warnings 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>

diff --git a/src/context.c b/src/context.c
index fbb93e4..cbad424 100644
--- a/src/context.c
+++ b/src/context.c
@@ -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];
 }
 
 /**
diff --git a/src/keysym.c b/src/keysym.c
index 7126d28..add0b83 100644
--- a/src/keysym.c
+++ b/src/keysym.c
@@ -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);
diff --git a/src/malloc.c b/src/malloc.c
index 80ebc69..ba16703 100644
--- a/src/malloc.c
+++ b/src/malloc.c
@@ -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)))
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index 9605324..a2c4a15 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -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);