From: Eric Biggers Date: Sat, 6 Feb 2016 15:47:12 +0000 (-0600) Subject: compiler.h: start honoring _format_attribute on UNIX X-Git-Tag: v1.9.1~48 X-Git-Url: https://wimlib.net/git/?a=commitdiff_plain;ds=inline;h=5e3d0c732c29487e19c36110cdc4fb8d5ffe46ad;p=wimlib compiler.h: start honoring _format_attribute on UNIX --- diff --git a/include/wimlib/compiler.h b/include/wimlib/compiler.h index c469010b..43ccc7d4 100644 --- a/include/wimlib/compiler.h +++ b/include/wimlib/compiler.h @@ -84,8 +84,15 @@ * returns will not alias any pointer previously in use by the program. */ #define _malloc_attribute __attribute__((malloc)) -/* TODO: _format_attribute is currently ignored. */ -#define _format_attribute(type, format_str, format_start) +/* Hint that the annotated function takes a printf()-like format string and + * arguments. This is currently disabled on Windows because MinGW does not + * support this attribute on functions taking wide-character strings. */ +#ifdef __WIN32__ +# define _format_attribute(type, format_str, format_start) +#else +# define _format_attribute(type, format_str, format_start) \ + __attribute__((format(type, format_str, format_start))) +#endif /* Hint that the annotated function is intentionally not used. This might be * the case if the function contains only static assertions. */ diff --git a/include/wimlib/reparse.h b/include/wimlib/reparse.h index 4c531692..dce19a22 100644 --- a/include/wimlib/reparse.h +++ b/include/wimlib/reparse.h @@ -45,7 +45,7 @@ struct reparse_buffer_disk { }; }; -#define REPARSE_DATA_OFFSET (offsetof(struct reparse_buffer_disk, rpdata)) +#define REPARSE_DATA_OFFSET ((unsigned)offsetof(struct reparse_buffer_disk, rpdata)) #define REPARSE_DATA_MAX_SIZE (REPARSE_POINT_MAX_SIZE - REPARSE_DATA_OFFSET)