configure: enable -Wsuggest-attribute=format
[babeltrace.git] / include / babeltrace2 / babeltrace.h
index 3f919cf30a6ea65f29caf4b5de8fa6ac30d485e1..c94576a7810f825a2cfec808eba94a4f5dc1b191 100644 (file)
 # define __BT_UPCAST_CONST(_type, _p)  ((const _type *) (_p))
 #endif
 
+/*
+ * Internal: attribute suitable to tag functions as having printf()-like
+ * arguments.
+ *
+ * We always define `__USE_MINGW_ANSI_STDIO` when building with MinGW, so use
+ * `gnu_printf` directly rather than `__MINGW_PRINTF_FORMAT` (which would require
+ * including `stdio.h`).
+ */
+#ifdef __MINGW32__
+# define __BT_PRINTF_FORMAT gnu_printf
+#else
+# define __BT_PRINTF_FORMAT printf
+#endif
+
+#define __BT_ATTR_FORMAT_PRINTF(_string_index, _first_to_check) \
+               __attribute__((format(__BT_PRINTF_FORMAT, _string_index, _first_to_check)))
+
 #include <babeltrace2/error-reporting.h>
 #include <babeltrace2/graph/component-class-dev.h>
 #include <babeltrace2/graph/component-class.h>
This page took 0.022566 seconds and 4 git commands to generate.