diff options
author | Wayne Meissner <wmeissner@gmail.com> | 2012-08-29 20:16:29 +1000 |
---|---|---|
committer | Wayne Meissner <wmeissner@gmail.com> | 2012-08-29 20:16:29 +1000 |
commit | db3d4ec9dab5773208ec48e0eb7914ffa4a26a9f (patch) | |
tree | 618a45d9bb42dae5b884b266d813b3c2ade56a67 | |
parent | 3ba0138167e5f69666ae2dd29e18feebbb9557c8 (diff) | |
download | ffi-db3d4ec9dab5773208ec48e0eb7914ffa4a26a9f.tar.gz |
Merge a lot of warning fixes from master
-rw-r--r-- | ext/ffi_c/MappedType.c | 1 | ||||
-rw-r--r-- | ext/ffi_c/MemoryPointer.c | 7 | ||||
-rw-r--r-- | ext/ffi_c/MethodHandle.c | 3 | ||||
-rw-r--r-- | ext/ffi_c/StructLayout.c | 2 | ||||
-rw-r--r-- | ext/ffi_c/Variadic.c | 3 | ||||
-rw-r--r-- | ext/ffi_c/extconf.rb | 13 | ||||
-rw-r--r-- | ext/ffi_c/rbffi_endian.h | 11 |
7 files changed, 22 insertions, 18 deletions
diff --git a/ext/ffi_c/MappedType.c b/ext/ffi_c/MappedType.c index 7a77842..cb091d8 100644 --- a/ext/ffi_c/MappedType.c +++ b/ext/ffi_c/MappedType.c @@ -60,7 +60,6 @@ static VALUE mapped_initialize(VALUE self, VALUE rbConverter) { MappedType* m = NULL; - Type* t = NULL; if (!rb_respond_to(rbConverter, id_native_type)) { rb_raise(rb_eNoMethodError, "native_type method not implemented"); diff --git a/ext/ffi_c/MemoryPointer.c b/ext/ffi_c/MemoryPointer.c index 85679fa..eb8f989 100644 --- a/ext/ffi_c/MemoryPointer.c +++ b/ext/ffi_c/MemoryPointer.c @@ -38,7 +38,6 @@ typedef int bool; static VALUE memptr_allocate(VALUE klass); -static void memptr_mark(Pointer* ptr); static void memptr_release(Pointer* ptr); static VALUE memptr_malloc(VALUE self, long size, long count, bool clear); static VALUE memptr_free(VALUE self); @@ -137,12 +136,6 @@ memptr_release(Pointer* ptr) xfree(ptr); } -static void -memptr_mark(Pointer* ptr) -{ - rb_gc_mark(ptr->rbParent); -} - static VALUE memptr_s_from_string(VALUE klass, VALUE to_str) { diff --git a/ext/ffi_c/MethodHandle.c b/ext/ffi_c/MethodHandle.c index 7f33891..2bf67a9 100644 --- a/ext/ffi_c/MethodHandle.c +++ b/ext/ffi_c/MethodHandle.c @@ -330,7 +330,10 @@ trampoline_size(void) void rbffi_MethodHandle_Init(VALUE module) { +#ifndef CUSTOM_TRAMPOLINE ffi_status ffiStatus; +#endif + defaultClosurePool = rbffi_ClosurePool_New((int) trampoline_size(), prep_trampoline, NULL); #if defined(CUSTOM_TRAMPOLINE) diff --git a/ext/ffi_c/StructLayout.c b/ext/ffi_c/StructLayout.c index 9bed49d..7a431a7 100644 --- a/ext/ffi_c/StructLayout.c +++ b/ext/ffi_c/StructLayout.c @@ -432,7 +432,7 @@ struct_layout_union_bang(VALUE self) return Qnil; } - count = (int) layout->size / t->size; + count = (int) layout->size / (int) t->size; xfree(layout->ffiTypes); layout->ffiTypes = xcalloc(count + 1, sizeof(ffi_type *)); layout->base.ffiType->elements = layout->ffiTypes; diff --git a/ext/ffi_c/Variadic.c b/ext/ffi_c/Variadic.c index ec5caf4..c6c96eb 100644 --- a/ext/ffi_c/Variadic.c +++ b/ext/ffi_c/Variadic.c @@ -94,8 +94,7 @@ variadic_initialize(VALUE self, VALUE rbFunction, VALUE rbParameterTypes, VALUE VALUE retval = Qnil; VALUE convention = Qnil; VALUE fixed = Qnil; - VALUE rbConventionStr; - int i; + int i; Check_Type(options, T_HASH); convention = rb_hash_aref(options, ID2SYM(rb_intern("convention"))); diff --git a/ext/ffi_c/extconf.rb b/ext/ffi_c/extconf.rb index 5b76074..6bf8978 100644 --- a/ext/ffi_c/extconf.rb +++ b/ext/ffi_c/extconf.rb @@ -4,7 +4,12 @@ if !defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby" require 'mkmf' require 'rbconfig' dir_config("ffi_c") - + + # recent versions of ruby add restrictive ansi and warning flags on a whim - kill them all + $warnflags = '' + $CFLAGS.gsub!(/-ansi/, '') + $CFLAGS.gsub!(/-std=[^\s]+/, '') + if ENV['RUBY_CC_VERSION'].nil? && (pkg_config("libffi") || have_header("ffi.h") || find_header("ffi.h", "/usr/local/include", "/usr/include/ffi")) @@ -30,11 +35,7 @@ if !defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby" $CFLAGS << " -mwin32 " if RbConfig::CONFIG['host_os'] =~ /cygwin/ $LOCAL_LIBS << " ./libffi/.libs/libffi_convenience.lib" if RbConfig::CONFIG['host_os'] =~ /mswin/ - #$CFLAGS << " -Werror -Wunused -Wformat -Wimplicit -Wreturn-type " - if (ENV['CC'] || RbConfig::MAKEFILE_CONFIG['CC']) =~ /gcc/ -# $CFLAGS << " -Wno-declaration-after-statement " - end - + create_makefile("ffi_c") unless libffi_ok File.open("Makefile", "a") do |mf| diff --git a/ext/ffi_c/rbffi_endian.h b/ext/ffi_c/rbffi_endian.h index c1bc744..c108020 100644 --- a/ext/ffi_c/rbffi_endian.h +++ b/ext/ffi_c/rbffi_endian.h @@ -8,7 +8,16 @@ #include <sys/types.h> #if defined(__linux__) || defined(__CYGWIN__) || defined(__GNU__) || defined(__GLIBC__) -# include <endian.h> +# include <endian.h> +# if !defined(LITTLE_ENDIAN) && defined(__LITTLE_ENDIAN) +# define LITTLE_ENDIAN __LITTLE_ENDIAN +# endif +# if !defined(BIG_ENDIAN) && defined(__BIG_ENDIAN) +# define BIG_ENDIAN __BIG_ENDIAN +# endif +# if !defined(BYTE_ORDER) && defined(__BYTE_ORDER) +# define BYTE_ORDER __BYTE_ORDER +# endif #endif #ifdef __sun |