commit a43cabcc703cad4d9b7b805e806b92dc7aebdd79
Author: Jim Meyering <meyering(a)redhat.com>
Date: Wed Mar 23 18:21:54 2011 +0100
maint: enable more compiler warnings
* configure.ac: Enable a few more warnings.
* qparser.y: Add missing initializers.
* rest.c (prov_fmt): Add a cast to avoid a compiler warning.
* template.c (tmpl_prov_entry): Likewise.
configure.ac | 4 +---
qparser.y | 13 +++++++------
rest.c | 2 +-
template.c | 2 +-
4 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 4513e4b..4f65407 100644
--- a/configure.ac
+++ b/configure.ac
@@ -134,9 +134,7 @@ if test "$gl_gcc_warnings" = yes; then
for w in $ws; do
gl_WARN_ADD([$w])
done
- gl_WARN_ADD([-Wno-unused])
- gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
- gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
+ gl_WARN_ADD([-Wno-unused-function])
gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
# In spite of excluding -Wlogical-op above, it is enabled, as of
diff --git a/qparser.y b/qparser.y
index 1622f4a..b6efb83 100644
--- a/qparser.y
+++ b/qparser.y
@@ -259,11 +259,12 @@ paren_expr:
static const struct { char *name; char *value; } hacked_obj_fields[] = {
/* Fake object fields for generic unit testing. */
- { (char*) "a", (char*) "2" }, { (char*) "b", (char*)
"7" },
+ { (char*) "a", (char*) "2" },
+ { (char*) "b", (char*) "7" },
{ (char*) "c", (char*) "11" },
/* This one's here to test links (e.g. $template.owner.name). */
{ (char*) "template", (char*) "templates/the_tmpl" },
- { NULL }
+ { NULL, NULL }
};
/* Fake out the eval code for unit testing. */
@@ -280,7 +281,7 @@ unit_oget_func (void * notused, const char *text)
return NULL;
}
-static const getter_t unit_oget = { unit_oget_func };
+static const getter_t unit_oget = { unit_oget_func, NULL };
/*
* Same as above, but the site-field stuff is so similar to the object-field
@@ -291,14 +292,14 @@ unit_sget_func (void * notused, const char *text)
{
return "never";
}
-static const getter_t unit_sget = { unit_sget_func };
+static const getter_t unit_sget = { unit_sget_func, NULL };
/* Fake links from an object/key tuple to an object/key string. */
static const struct { char *obj; char *key; char *value; } hacked_links[] = {
{ (char*) "templates/the_tmpl", (char*) "owner",
(char*) "users/the_user" },
{ (char*) "users/the_user", (char*) "name", (char*) "Jeff
Darcy" },
- { NULL }
+ { NULL, NULL, NULL }
};
static char *
@@ -611,7 +612,7 @@ int
main (int argc, char **argv)
{
int fail = 0;
- unsigned int i;
+ int i;
GC_INIT ();
for (i = 1; i < argc; ++i)
{
diff --git a/rest.c b/rest.c
index 5932cf9..3dfea2b 100644
--- a/rest.c
+++ b/rest.c
@@ -1647,7 +1647,7 @@ prov_fmt (provider_t *prov, void *ms_v)
if (len < 0)
return 0; // tell iterator we've failed
- if (len < n_remaining) {
+ if ((size_t) len < n_remaining) {
ms->buf_n_used += len;
return 1;
}
diff --git a/template.c b/template.c
index 57e52ab..5eb51ed 100644
--- a/template.c
+++ b/template.c
@@ -286,7 +286,7 @@ tmpl_prov_entry (char *buf, size_t buf_len,
fmt += ctx->format->z_offset;
int size = snprintf(buf, buf_len, fmt,
name, type, host, port, user, pass);
- if (0 < size && size < buf_len)
+ if (0 < size && (size_t) size < buf_len)
ctx->index++;
return size;