diff --git a/ext/mysql2_ext.c b/ext/mysql2_ext.c index 3c95092..ef97a00 100644 --- a/ext/mysql2_ext.c +++ b/ext/mysql2_ext.c @@ -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())); diff --git a/ext/mysql2_ext.h b/ext/mysql2_ext.h index f117181..e576a31 100644 --- a/ext/mysql2_ext.h +++ b/ext/mysql2_ext.h @@ -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;