]> wimlib.net Git - wimlib/commitdiff
compiler.h: start honoring _format_attribute on UNIX
authorEric Biggers <ebiggers3@gmail.com>
Sat, 6 Feb 2016 15:47:12 +0000 (09:47 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 9 Feb 2016 01:44:33 +0000 (19:44 -0600)
include/wimlib/compiler.h
include/wimlib/reparse.h

index c469010bdfa86e178274a7a1d5b64ced21e7d068..43ccc7d49f0fd35d7a6c3fe631bfd0c251a2f6c6 100644 (file)
  * 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.  */
index 4c5316928ee5c93fda12dd42b87a3169f3912492..dce19a22130087ec1cc9475a88b060aab513dbdb 100644 (file)
@@ -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)