On 23.08.2015 05:11, James Almer wrote:
>> ffmpeg | branch: master | Andreas Cadhalpun <Andreas.Cadhalpun at 
>> googlemail.com> | Sat Aug  8 10:41:33 2015 +0200| 
>> [095347ffe4c73143dbeb7b05cde8891fd1289389] | committer: Andreas Cadhalpun
>>
>> disable deprecation warnings in deprecated code
>>
>> Reviewed-by: wm4 <nfxjfg at googlemail.com>
>> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
>>
>>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=095347ffe4c73143dbeb7b05cde8891fd1289389
>> ---
>>
>>  libavcodec/mpeg12dec.c     |    5 ++++-
>>  libavcodec/options_table.h |    3 +++
>>  libavcodec/pthread_frame.c |    9 ++++++++-
>>  libavcodec/resample.c      |    2 ++
>>  libavfilter/audio.c        |    2 ++
>>  libavfilter/avcodec.c      |    2 ++
>>  libavutil/frame.c          |    2 ++
> 
> The changes to libavcodec/options_table.h, which is included by 
> doc/print_options.c, seems to have broken
> linking doc/print_options.exe (host application) on msvc.

That's caused by some strange hack in libavutil/internal.h:
#if HAVE_LIBC_MSVCRT
#include <crtversion.h>
#if defined(_VC_CRT_MAJOR_VERSION) && _VC_CRT_MAJOR_VERSION < 14
#pragma comment(linker, "/include:" EXTERN_PREFIX "avpriv_strtod")
#pragma comment(linker, "/include:" EXTERN_PREFIX "avpriv_snprintf")
#endif

So instead of including that, one can copy the definition of the
FF_{DIS,EN}ABLE_DEPRECATION_WARNINGS macros, see attached patch.

Alternatively one could just revert the changes to libavcodec/options_table.h
and ignore the warnings in that file.

Best regards,
Andreas
>From c082552af369981de34faa7c86b90c2e2792f083 Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
Date: Sun, 23 Aug 2015 10:35:57 +0200
Subject: [PATCH] options_table: fix compatibility with MSVC

Instead of including libavutil/internal.h duplicate the definitions
of FF_{DIS,EN}ABLE_DEPRECATION_WARNINGS.

Signed-off-by: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
---
 libavcodec/options_table.h | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index d4711ed..85193d0 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -26,11 +26,27 @@
 #include <limits.h>
 #include <stdint.h>
 
-#include "libavutil/internal.h"
 #include "libavutil/opt.h"
 #include "avcodec.h"
 #include "version.h"
 
+// Including libavutil/internal.h breaks compilation with MSVC due to linking avpriv_strtod/avpriv_snprintf.
+#if HAVE_PRAGMA_DEPRECATED
+#    if defined(__ICL) || defined (__INTEL_COMPILER)
+#        define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) __pragma(warning(disable:1478))
+#        define FF_ENABLE_DEPRECATION_WARNINGS  __pragma(warning(pop))
+#    elif defined(_MSC_VER)
+#        define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) __pragma(warning(disable:4996))
+#        define FF_ENABLE_DEPRECATION_WARNINGS  __pragma(warning(pop))
+#    else
+#        define FF_DISABLE_DEPRECATION_WARNINGS _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
+#        define FF_ENABLE_DEPRECATION_WARNINGS  _Pragma("GCC diagnostic warning \"-Wdeprecated-declarations\"")
+#    endif
+#else
+#    define FF_DISABLE_DEPRECATION_WARNINGS
+#    define FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
 #define OFFSET(x) offsetof(AVCodecContext,x)
 #define DEFAULT 0 //should be NAN but it does not work as it is not a constant in glibc as required by ANSI/ISO C
 //these names are too long to be readable
-- 
2.5.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to