]> wimlib.net Git - wimlib/blobdiff - include/wimlib/compiler.h
wimboot.c: correctly handle next_data_source_id field
[wimlib] / include / wimlib / compiler.h
index 533930396e0134e657c80486bf8954f8f87baeb9..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.  */
+#define _unused_attribute      __attribute__((unused))
 
 /* Endianness definitions.  Either CPU_IS_BIG_ENDIAN or CPU_IS_LITTLE_ENDIAN is
  * set to 1.  The other is set to 0.  Note that newer gcc supports
 #endif
 #define CPU_IS_LITTLE_ENDIAN (!CPU_IS_BIG_ENDIAN)
 
-#if defined(__x86_64__) || defined(__i386__)
-#  define UNALIGNED_ACCESS_SPEED 3
-#elif defined(__ARM_FEATURE_UNALIGNED) && (__ARM_FEATURE_UNALIGNED == 1)
-#  define UNALIGNED_ACCESS_SPEED 2
+/* UNALIGNED_ACCESS_IS_FAST should be defined to 1 if unaligned memory accesses
+ * can be performed efficiently on the target platform.  */
+#if defined(__x86_64__) || defined(__i386__) || defined(__ARM_FEATURE_UNALIGNED)
+#  define UNALIGNED_ACCESS_IS_FAST 1
 #else
-#  define UNALIGNED_ACCESS_SPEED 0
+#  define UNALIGNED_ACCESS_IS_FAST 0
 #endif
 
 /* Get the type of the specified expression.  */