<HTML>
<HEAD>
<TITLE>Re: [PATCH 2/2] Make old code pass gcc -Wall -Wextra.</TITLE>
</HEAD>
<BODY>
<FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'>Some of these are good, but the unused parameter warnings seem like a nuisance and somewhat wrongheaded (As long as an implementation satifies the contract of an API it doesn’t matter whether it used all or any of the parameters.). I think a cleanup against “–Wextra –Wunused-variable’ might be more reasonable. (And those would be reason default CFLAGS to add to configure.ac)<BR>
<BR>
<BR>
On 11/8/07 1:12 AM, "Tomash Brechko" <tomash.brechko@gmail.com> wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT SIZE="2"><FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:10.0px'>---<BR>
trunk/server/memcached.c | 26 ++++++++++++++++++--------<BR>
trunk/server/slabs.c | 2 +-<BR>
2 files changed, 19 insertions(+), 9 deletions(-)<BR>
<BR>
diff --git a/trunk/server/memcached.c b/trunk/server/memcached.c<BR>
index 0693935..c71cf07 100644<BR>
--- a/trunk/server/memcached.c<BR>
+++ b/trunk/server/memcached.c<BR>
@@ -662,7 +662,7 @@ static int build_udp_headers(conn *c) {<BR>
<BR>
<BR>
static void out_string(conn *c, const char *str) {<BR>
- size_t len;<BR>
+ int len;<BR>
<BR>
assert(c != NULL);<BR>
<BR>
@@ -1170,7 +1170,7 @@ void process_get_command(enum command_code code,<BR>
if (code == CMD_GETS)<BR>
{<BR>
in_memory_ptr = (uint32_t)item_get(key, nkey);<BR>
- sprintf(suffix," %d %d %lu\r\n", atoi(ITEM_suffix(it) + 1), it->nbytes - 2, in_memory_ptr);<BR>
+ sprintf(suffix," %d %d %u\r\n", atoi(ITEM_suffix(it) + 1), it->nbytes - 2, in_memory_ptr);<BR>
if (add_iov(c, "VALUE ", 6) != 0 ||<BR>
add_iov(c, ITEM_key(it), it->nkey) != 0 ||<BR>
add_iov(c, suffix, strlen(suffix)) != 0 ||<BR>
@@ -1244,9 +1244,9 @@ void process_update_command(enum command_code code,<BR>
size_t nkey;<BR>
int flags;<BR>
time_t exptime;<BR>
- int vlen, old_vlen;<BR>
- uint32_t req_memory_ptr, in_memory_ptr;<BR>
- item *it, *old_it;<BR>
+ int vlen;<BR>
+ uint32_t req_memory_ptr = 0, in_memory_ptr;<BR>
+ item *it;<BR>
<BR>
assert(c != NULL);<BR>
<BR>
@@ -1613,7 +1613,7 @@ void process_manage_command(enum command_code code,<BR>
}<BR>
<BR>
if (res) {<BR>
- if ((bucket < 0) || (bucket >= MAX_BUCKETS)) {<BR>
+ if (bucket >= MAX_BUCKETS) {<BR>
if (code != CMD_BG) {<BR>
out_string(c, "CLIENT_ERROR bucket number out of range");<BR>
return;<BR>
@@ -1973,7 +1973,7 @@ static int transmit(conn *c) {<BR>
<BR>
/* We've written some of the data. Remove the completed<BR>
iovec entries from the list of pending writes. */<BR>
- while (m->msg_iovlen > 0 && res >= m->msg_iov->iov_len) {<BR>
+ while (m->msg_iovlen > 0 && (size_t)res >= m->msg_iov->iov_len) {<BR>
res -= m->msg_iov->iov_len;<BR>
m->msg_iovlen--;<BR>
m->msg_iov++;<BR>
@@ -2444,6 +2444,10 @@ static void set_current_time(void) {<BR>
}<BR>
<BR>
static void clock_handler(const int fd, const short which, void *arg) {<BR>
+ SUPPRESS_UNUSED_WARNING(fd);<BR>
+ SUPPRESS_UNUSED_WARNING(which);<BR>
+ SUPPRESS_UNUSED_WARNING(arg);<BR>
+<BR>
struct timeval t = {.tv_sec = 1, .tv_usec = 0};<BR>
static bool initialized = false;<BR>
<BR>
@@ -2464,6 +2468,10 @@ static void clock_handler(const int fd, const short which, void *arg) {<BR>
static struct event deleteevent;<BR>
<BR>
static void delete_handler(const int fd, const short which, void *arg) {<BR>
+ SUPPRESS_UNUSED_WARNING(fd);<BR>
+ SUPPRESS_UNUSED_WARNING(which);<BR>
+ SUPPRESS_UNUSED_WARNING(arg);<BR>
+<BR>
struct timeval t = {.tv_sec = 5, .tv_usec = 0};<BR>
static bool initialized = false;<BR>
<BR>
@@ -2627,6 +2635,8 @@ static void remove_pidfile(const char *pid_file) {<BR>
<BR>
<BR>
static void sig_handler(const int sig) {<BR>
+ SUPPRESS_UNUSED_WARNING(sig);<BR>
+<BR>
printf("SIGINT handled.\n");<BR>
exit(EXIT_SUCCESS);<BR>
}<BR>
@@ -2783,7 +2793,7 @@ int main (int argc, char **argv) {<BR>
fprintf(stderr, "failed to getrlimit number of files\n");<BR>
exit(EXIT_FAILURE);<BR>
} else {<BR>
- int maxfiles = settings.maxconns;<BR>
+ size_t maxfiles = settings.maxconns;<BR>
if (rlim.rlim_cur < maxfiles)<BR>
rlim.rlim_cur = maxfiles + 3;<BR>
if (rlim.rlim_max < rlim.rlim_cur)<BR>
diff --git a/trunk/server/slabs.c b/trunk/server/slabs.c<BR>
index 1805129..14f0dca 100644<BR>
--- a/trunk/server/slabs.c<BR>
+++ b/trunk/server/slabs.c<BR>
@@ -204,7 +204,7 @@ void *do_slabs_alloc(const size_t size) {<BR>
slabclass_t *p;<BR>
<BR>
unsigned int id = slabs_clsid(size);<BR>
- if (id < POWER_SMALLEST || id > power_largest)<BR>
+ if (id < POWER_SMALLEST || id > (unsigned int)power_largest)<BR>
return NULL;<BR>
<BR>
p = &slabclass[id];<BR>
</SPAN></FONT></FONT></BLOCKQUOTE><FONT SIZE="2"><FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:10.0px'><BR>
</SPAN></FONT></FONT>
</BODY>
</HTML>