[cleanup] quiet down warnings

This can help us notice real bugs in our code sooner.

Some of the unused variable warnings are pedantic from our usage
of -Wextra, but GCC >= 3 provides us with a handy attribute we
can use to mark variables unused.  -Wextra is also a default
flag for 1.9.2dev, so we might as well get used to it.
This commit is contained in:
Eric Wong 2010-05-05 15:30:34 -07:00
parent 59a823b6d5
commit 081eea9a9c
2 changed files with 11 additions and 5 deletions

View File

@ -146,7 +146,7 @@ static VALUE rb_mysql_client_new(int argc, VALUE * argv, VALUE klass) {
}
// set default connection timeout behavior
if (connect_timeout != 0 && mysql_options(args.mysql, MYSQL_OPT_CONNECT_TIMEOUT, &connect_timeout) != 0) {
if (connect_timeout != 0 && mysql_options(args.mysql, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout) != 0) {
// TODO: warning - unable to set connection timeout
rb_warn("%s\n", mysql_error(args.mysql));
}
@ -171,7 +171,7 @@ static VALUE rb_mysql_client_new(int argc, VALUE * argv, VALUE klass) {
return obj;
}
static VALUE rb_mysql_client_init(int argc, VALUE * argv, VALUE self) {
static VALUE rb_mysql_client_init(RB_MYSQL_UNUSED int argc, RB_MYSQL_UNUSED VALUE * argv, VALUE self) {
return self;
}
@ -205,7 +205,6 @@ static VALUE nogvl_send_query(void *ptr)
static VALUE rb_mysql_client_query(int argc, VALUE * argv, VALUE self) {
struct nogvl_send_query_args args;
MYSQL_RES * result;
fd_set fdset;
int fd, retval;
int async = 0;
@ -275,7 +274,7 @@ static VALUE rb_mysql_client_escape(VALUE self, VALUE str) {
}
}
static VALUE rb_mysql_client_info(VALUE self) {
static VALUE rb_mysql_client_info(RB_MYSQL_UNUSED VALUE self) {
VALUE version = rb_hash_new();
rb_hash_aset(version, sym_id, LONG2FIX(mysql_get_client_version()));
rb_hash_aset(version, sym_version, rb_str_new2(mysql_get_client_info()));

View File

@ -17,6 +17,12 @@
int utf8Encoding, binaryEncoding;
#endif
#if defined(__GNUC__) && (__GNUC__ >= 3)
#define RB_MYSQL_UNUSED __attribute__ ((unused))
#else
#define RB_MYSQL_UNUSED
#endif
static VALUE cBigDecimal, cDate, cDateTime;
ID intern_new, intern_local;
@ -96,7 +102,8 @@ typedef VALUE rb_blocking_function_t(void *);
static VALUE
rb_thread_blocking_region(
rb_blocking_function_t *func, void *data1,
rb_unblock_function_t *ubf, void *data2)
RB_MYSQL_UNUSED rb_unblock_function_t *ubf,
RB_MYSQL_UNUSED void *data2)
{
VALUE rv;