]> wimlib.net Git - wimlib/blobdiff - include/wimlib/compiler.h
compiler.h: start honoring _format_attribute on UNIX
[wimlib] / include / wimlib / compiler.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.  */