From: Aleksey Kliger (λgeek) Date: Tue, 4 Oct 2016 14:05:33 +0000 (-0400) Subject: Merge pull request #3686 from lambdageek/dev-format-printf X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=633af27d6800a6a5c050c9e4c50a0d8b67c97c20;hp=-c;p=mono.git Merge pull request #3686 from lambdageek/dev-format-printf Add MONO_ATTR_FORMAT_PRINTF macro --- 633af27d6800a6a5c050c9e4c50a0d8b67c97c20 diff --combined mono/metadata/marshal.c index 162702a3d7c,fd20aea402f..f5cfadbb8fa --- a/mono/metadata/marshal.c +++ b/mono/metadata/marshal.c @@@ -52,10 -52,6 +52,10 @@@ #include #include +#if defined(HOST_WIN32) +#include +#endif + /* #define DEBUG_RUNTIME_CODE */ #define OPDEF(a,b,c,d,e,f,g,h,i,j) \ @@@ -10535,7 -10531,7 +10535,7 @@@ mono_marshal_alloc (gulong size, MonoEr #else res = g_try_malloc ((gulong)size); if (!res) - mono_error_set_out_of_memory (error, "Could not allocate %i bytes", size); + mono_error_set_out_of_memory (error, "Could not allocate %lu bytes", size); #endif return res; } diff --combined mono/metadata/metadata-internals.h index 5d3604d181b,9d2e569dfd7..a68897538ae --- a/mono/metadata/metadata-internals.h +++ b/mono/metadata/metadata-internals.h @@@ -499,6 -499,7 +499,6 @@@ struct _MonoDynamicImage GHashTable *method_aux_hash; GHashTable *vararg_aux_hash; MonoGHashTable *generic_def_objects; - MonoGHashTable *methodspec; /* * Maps final token values to the object they describe. */ @@@ -642,7 -643,7 +642,7 @@@ char mono_image_strdup_vprintf (MonoImage *image, const char *format, va_list args); char* - mono_image_strdup_printf (MonoImage *image, const char *format, ...); + mono_image_strdup_printf (MonoImage *image, const char *format, ...) MONO_ATTR_FORMAT_PRINTF(2,3);; GList* g_list_prepend_image (MonoImage *image, GList *list, gpointer data); diff --combined mono/metadata/object.c index 0603774589e,057e858b882..3ab92326b1b --- a/mono/metadata/object.c +++ b/mono/metadata/object.c @@@ -5457,7 -5457,7 +5457,7 @@@ mono_class_get_allocation_ftn (MonoVTab *pass_size_in_words = FALSE; - if (mono_class_has_finalizer (vtable->klass) || mono_class_is_marshalbyref (vtable->klass) || (mono_profiler_get_events () & MONO_PROFILE_ALLOCATIONS)) + if (mono_class_has_finalizer (vtable->klass) || mono_class_is_marshalbyref (vtable->klass)) return ves_icall_object_new_specific; if (vtable->gc_descr != MONO_GC_DESCRIPTOR_NULL) { @@@ -5822,7 -5822,7 +5822,7 @@@ mono_array_new_full_checked (MonoDomai o = (MonoObject *)mono_gc_alloc_vector (vtable, byte_len, len); if (G_UNLIKELY (!o)) { - mono_error_set_out_of_memory (error, "Could not allocate %i bytes", byte_len); + mono_error_set_out_of_memory (error, "Could not allocate %zd bytes", (gsize) byte_len); return NULL; } @@@ -5936,7 -5936,7 +5936,7 @@@ mono_array_new_specific_checked (MonoVT o = (MonoObject *)mono_gc_alloc_vector (vtable, byte_len, n); if (G_UNLIKELY (!o)) { - mono_error_set_out_of_memory (error, "Could not allocate %i bytes", byte_len); + mono_error_set_out_of_memory (error, "Could not allocate %zd bytes", (gsize) byte_len); return NULL; } @@@ -6094,7 -6094,7 +6094,7 @@@ mono_string_new_size_checked (MonoDomai s = (MonoString *)mono_gc_alloc_string (vtable, size, len); if (G_UNLIKELY (!s)) { - mono_error_set_out_of_memory (error, "Could not allocate %i bytes", size); + mono_error_set_out_of_memory (error, "Could not allocate %zd bytes", size); return NULL; } diff --combined mono/utils/mono-compiler.h index 5c942e06fa2,1f4f8899045..8a044e50d31 --- a/mono/utils/mono-compiler.h +++ b/mono/utils/mono-compiler.h @@@ -13,6 -13,12 +13,12 @@@ #define MONO_ATTR_USED #endif + #ifdef __GNUC__ + #define MONO_ATTR_FORMAT_PRINTF(fmt_pos,arg_pos) __attribute__((format(printf,fmt_pos,arg_pos))) + #else + #define MONO_ATTR_FORMAT_PRINTF(fmt_pos,arg_pos) + #endif + #ifdef HAVE_KW_THREAD #define MONO_HAVE_FAST_TLS @@@ -275,6 -281,12 +281,6 @@@ typedef SSIZE_T ssize_t #define MONO_LLVM_INTERNAL #endif -#if HAVE_DEPRECATED -#define MONO_DEPRECATED __attribute__ ((deprecated)) -#else -#define MONO_DEPRECATED -#endif - #ifdef __GNUC__ #define MONO_ALWAYS_INLINE __attribute__((always_inline)) #elif defined(_MSC_VER)