MinGW* requires this to recognize some C99 printf format length modifiers.
---

This is not exactly pretty.  I'm all ears wrt cleaner solutions.

 configure              | 6 +++++-
 libavutil/attributes.h | 4 +++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 87ab32a..c32c902 100755
--- a/configure
+++ b/configure
@@ -1580,7 +1580,7 @@ need_memalign="altivec neon sse"
 
 # system capabilities
 log2_deps="!libc_msvcrt"
-
+printf_format="__printf__"
 symver_if_any="symver_asm_label symver_gnu_asm"
 
 # subsystems
@@ -3452,6 +3452,9 @@ case $libc_type in
     bionic)
         add_compat strtod.o strtod=avpriv_strtod
         ;;
+    mingw*)
+        printf_format="__MINGW_PRINTF_FORMAT"
+        ;;
     msvcrt)
         add_compat strtod.o strtod=avpriv_strtod
         add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf   \
@@ -4434,6 +4437,7 @@ cat > $TMPH <<EOF
 EOF
 
 print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
+echo "#define AV_PRINTF_FORMAT $printf_format" >> $TMPH
 
 echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
 
diff --git a/libavutil/attributes.h b/libavutil/attributes.h
index d7f2bb5..f56f2c0 100644
--- a/libavutil/attributes.h
+++ b/libavutil/attributes.h
@@ -26,6 +26,8 @@
 #ifndef AVUTIL_ATTRIBUTES_H
 #define AVUTIL_ATTRIBUTES_H
 
+#include "libavutil/avconfig.h"
+
 #ifdef __GNUC__
 #    define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && 
__GNUC_MINOR__ >= y)
 #else
@@ -111,7 +113,7 @@
 
 #ifdef __GNUC__
 #    define av_builtin_constant_p __builtin_constant_p
-#    define av_printf_format(fmtpos, attrpos) 
__attribute__((__format__(__printf__, fmtpos, attrpos)))
+#    define av_printf_format(fmtpos, attrpos) 
__attribute__((__format__(AV_PRINTF_FORMAT, fmtpos, attrpos)))
 #else
 #    define av_builtin_constant_p(x) 0
 #    define av_printf_format(fmtpos, attrpos)
-- 
1.8.3.2

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to