diff --git a/Make.config b/Make.config index 650413168b6a..40fa2f47bf94 100644 --- a/Make.config +++ b/Make.config @@ -190,7 +190,7 @@ IOS_CXX=$(XCODE_CXX) SIMULATOR_BIN_PATH=$(XCODE_DEVELOPER_ROOT)/Platforms/iPhoneSimulator.platform/Developer/usr/bin SIMULATOR_CC=$(IOS_CC) -CFLAGS= -Wall -fms-extensions -Wno-format-security -Wsign-compare -Wshorten-64-to-32 +CFLAGS= -Wall -fms-extensions -Wno-format-security -Wsign-compare -Wshorten-64-to-32 -Wsign-conversion ifdef ENABLE_BITCODE_ON_IOS BITCODE_CFLAGS=-fembed-bitcode-marker diff --git a/runtime/mono-runtime.h.t4 b/runtime/mono-runtime.h.t4 index fd93ed6f2544..f1b7fd9bf7e3 100644 --- a/runtime/mono-runtime.h.t4 +++ b/runtime/mono-runtime.h.t4 @@ -29,8 +29,8 @@ typedef const void * gconstpointer; typedef guint (*GHashFunc) (gconstpointer key); typedef gboolean (*GEqualFunc) (gconstpointer a, gconstpointer b); -#ifndef GPOINTER_TO_INT -#define GPOINTER_TO_INT(p) ((int) (long) (p)) +#ifndef GPOINTER_TO_UINT +#define GPOINTER_TO_UINT(p) ((uint32_t) (long) (p)) #endif #ifndef GINT_TO_POINTER diff --git a/runtime/monotouch-debug.m b/runtime/monotouch-debug.m index 9996d41dcc01..3eeff8bd7d59 100644 --- a/runtime/monotouch-debug.m +++ b/runtime/monotouch-debug.m @@ -9,6 +9,10 @@ // Copyright 2011-2013 Xamarin Inc. // +// TODO: temp ignore to minimize diff +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wsign-conversion" + #ifdef DEBUG //#define LOG_HTTP(...) do { NSLog (@ __VA_ARGS__); } while (0); @@ -1723,3 +1727,5 @@ int monotouch_debug_connect (NSMutableArray *ips, int debug_port, int output_por int xamarin_fix_ranlib_warning_about_no_symbols_v2; #endif /* DEBUG */ + +#pragma clang diagnostic pop diff --git a/runtime/monotouch-main.m b/runtime/monotouch-main.m index deb9e3ab04a2..b7bcdefe5885 100644 --- a/runtime/monotouch-main.m +++ b/runtime/monotouch-main.m @@ -28,6 +28,9 @@ #include "../tools/mtouch/monotouch-fixes.c" #endif +// TODO: temp ignore to minimize diff +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wsign-conversion" static unsigned char * xamarin_load_aot_data (MonoAssembly *assembly, int size, gpointer user_data, void **out_handle) { @@ -493,3 +496,5 @@ - (void) memoryWarning: (NSNotification *) sender return rv; } + +#pragma clang diagnostic pop \ No newline at end of file diff --git a/runtime/runtime.m b/runtime/runtime.m index 07f6fe5c0c85..27d42ecec45a 100644 --- a/runtime/runtime.m +++ b/runtime/runtime.m @@ -17,6 +17,10 @@ #include "runtime-internal.h" #include "xamarin/xamarin.h" +// TODO: temp ignore to minimize diff +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wsign-conversion" + #if defined (DEBUG) //extern BOOL NSZombieEnabled; #endif @@ -2892,3 +2896,5 @@ -(int) getHandle return handle; } @end + +#pragma clang diagnostic pop \ No newline at end of file diff --git a/runtime/shared.m b/runtime/shared.m index acb2f6c242b2..7c58b4a95256 100644 --- a/runtime/shared.m +++ b/runtime/shared.m @@ -245,7 +245,7 @@ -(id) initWithFunc: (init_cocoa_func *) func; // COOP: this method is executed by the ObjC runtime when a block must be freed. // COOP: it does not touch any managed memory (except to free a gchandle), so any mode goes. struct Block_literal *bl = (struct Block_literal *) a; - int handle = GPOINTER_TO_INT (bl->global_handle); + uint32_t handle = GPOINTER_TO_UINT (bl->global_handle); mono_gchandle_free (handle); bl->global_handle = GINT_TO_POINTER (-1); if (atomic_fetch_sub (&bl->descriptor->ref_count, 1) == 0) { @@ -263,7 +263,7 @@ -(id) initWithFunc: (init_cocoa_func *) func; struct Block_literal *target = (struct Block_literal *) dst; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" - target->global_handle = GINT_TO_POINTER (mono_gchandle_new (mono_gchandle_get_target (GPOINTER_TO_INT (source->local_handle)), FALSE)); + target->global_handle = GINT_TO_POINTER (mono_gchandle_new (mono_gchandle_get_target (GPOINTER_TO_UINT (source->local_handle)), FALSE)); #pragma clang diagnostic pop atomic_fetch_add (&source->descriptor->ref_count, 1); diff --git a/runtime/trampolines-invoke.m b/runtime/trampolines-invoke.m index 8f1870724a67..0fb0e2e488d0 100644 --- a/runtime/trampolines-invoke.m +++ b/runtime/trampolines-invoke.m @@ -12,6 +12,9 @@ #include "delegates.h" #include "product.h" +// TODO: temp ignore to minimize diff +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wsign-conversion" static guint32 xamarin_get_exception_for_method (int code, guint32 inner_exception_gchandle, const char *reason, SEL sel, id self) { @@ -675,3 +678,5 @@ xamarin_process_managed_exception (exception); } } + +#pragma clang diagnostic pop \ No newline at end of file diff --git a/runtime/trampolines-varargs.m b/runtime/trampolines-varargs.m index 70f2eb169978..f2d6e110179a 100644 --- a/runtime/trampolines-varargs.m +++ b/runtime/trampolines-varargs.m @@ -1,3 +1,7 @@ +// TODO: temp ignore to minimize diff +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wsign-conversion" + #if !defined (__i386__) && !defined (__x86_64__) && !(defined (__arm64__) && !defined(__ILP32__)) #define __VARARGS_TRAMPOLINES__ 1 #endif @@ -319,4 +323,6 @@ va_end (state.ap); } -#endif /* __VARARGS_TRAMPOLINES__ */ \ No newline at end of file +#endif /* __VARARGS_TRAMPOLINES__ */ + +#pragma clang diagnostic pop diff --git a/runtime/trampolines-x86_64.m b/runtime/trampolines-x86_64.m index 80f14d942fd2..f98a52c99c9f 100644 --- a/runtime/trampolines-x86_64.m +++ b/runtime/trampolines-x86_64.m @@ -1,4 +1,8 @@ +// TODO: temp ignore to minimize diff +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wsign-conversion" + #if defined(__x86_64__) #include @@ -493,4 +497,6 @@ dump_state (state); } -#endif /* __x86_64__ */ \ No newline at end of file +#endif /* __x86_64__ */ + +#pragma clang diagnostic pop \ No newline at end of file diff --git a/runtime/trampolines.m b/runtime/trampolines.m index a45907ab91e8..1d2541f45cb2 100644 --- a/runtime/trampolines.m +++ b/runtime/trampolines.m @@ -41,6 +41,9 @@ #include "runtime-internal.h" //#define DEBUG_REF_COUNTING +// TODO: temp ignore to minimize diff +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wsign-conversion" static pthread_mutex_t refcount_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER; size_t @@ -759,7 +762,7 @@ int gc_handle = 0; pthread_mutex_lock (&gchandle_hash_lock); if (gchandle_hash != NULL) - gc_handle = GPOINTER_TO_INT (CFDictionaryGetValue (gchandle_hash, self)); + gc_handle = GPOINTER_TO_UINT (CFDictionaryGetValue (gchandle_hash, self)); pthread_mutex_unlock (&gchandle_hash_lock); return gc_handle; } @@ -1392,7 +1395,7 @@ void * xamarin_smart_enum_to_nsstring (MonoObject *value, void *context /* token ref */, guint32 *exception_gchandle) { - guint32 context_ref = GPOINTER_TO_INT (context); + guint32 context_ref = GPOINTER_TO_UINT (context); if (context_ref == INVALID_TOKEN_REF) { // This requires the dynamic registrar to invoke the correct conversion function int handle = mono_gchandle_new (value, FALSE); @@ -1429,7 +1432,7 @@ void * xamarin_nsstring_to_smart_enum (id value, void *ptr, MonoClass *managedType, void *context, guint32 *exception_gchandle) { - guint32 context_ref = GPOINTER_TO_INT (context); + guint32 context_ref = GPOINTER_TO_UINT (context); int gc_handle = 0; MonoObject *obj; @@ -1438,7 +1441,7 @@ void *rv = xamarin_convert_nsstring_to_smart_enum (value, mono_type_get_object (mono_domain_get (), mono_class_get_type (managedType)), exception_gchandle); if (*exception_gchandle != 0) return ptr; - gc_handle = GPOINTER_TO_INT (rv); + gc_handle = GPOINTER_TO_UINT (rv); obj = mono_gchandle_get_target (gc_handle); } else { // The static registrar found the correct conversion function, and provided a token ref we can use @@ -1632,3 +1635,5 @@ return ptr; } + +#pragma clang diagnostic pop \ No newline at end of file diff --git a/runtime/xamarin-support.m b/runtime/xamarin-support.m index 7a6eb68814ec..21a3019707ed 100644 --- a/runtime/xamarin-support.m +++ b/runtime/xamarin-support.m @@ -39,7 +39,7 @@ xamarin_log (const unsigned short *unicodeMessage) { // COOP: no managed memory access: any mode. - int length = 0; + unsigned int length = 0; const unsigned short *ptr = unicodeMessage; while (*ptr++) length += sizeof (unsigned short); @@ -47,7 +47,7 @@ #if TARGET_OS_WATCH && defined (__arm__) // maybe make this configurable somehow? const char *utf8 = [msg UTF8String]; - int len = strlen (utf8); + size_t len = strlen (utf8); fwrite (utf8, 1, len, stdout); if (len == 0 || utf8 [len - 1] != '\n') fwrite ("\n", 1, 1, stdout); diff --git a/tools/mtouch/monotouch-fixes.c b/tools/mtouch/monotouch-fixes.c index db1790f0c8c6..1186e7860860 100644 --- a/tools/mtouch/monotouch-fixes.c +++ b/tools/mtouch/monotouch-fixes.c @@ -80,7 +80,7 @@ patch_sigaction () } // allocate executable memory - uint64_t pagesize = getpagesize (); + uint64_t pagesize = (uint64_t) getpagesize (); void *exec = mmap (NULL, pagesize, PROT_EXEC | PROT_WRITE | PROT_READ, MAP_ANON | MAP_PRIVATE, -1, 0); if (exec == NULL) { fprintf (stderr, "MonoTouch: Could not allocate memory for sigaction override: %s\n", strerror (errno));