Skip to content

Commit

Permalink
msvc/icl: Use __declspec(deprecated)
Browse files Browse the repository at this point in the history
Prior to this on msvc/icl there was no handling of deprecated functions
and the deprecated warning was disabled.

After enabling there are a number of warnings relating to the CRT and
the use of the non-secure versions of several functions.  Defining
_CRT_SECURE_NO_WARNINGS silences these warnings.

Signed-off-by: Martin Storsjö <[email protected]>
  • Loading branch information
TheRyuu authored and mstorsjo committed Sep 20, 2013
1 parent 5532ee6 commit 09f2581
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
5 changes: 3 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -2417,7 +2417,7 @@ msvc_flags(){
-Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
-wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
-wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
-wd4996 -wd4273 ;;
-wd4273 ;;
esac
done
}
Expand Down Expand Up @@ -2641,7 +2641,7 @@ probe_cc(){
_ld_lib='lib%.a'
_ld_path='-libpath:'
_flags='-nologo'
_cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
_cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
if [ $pfx = hostcc ]; then
append _cflags -Dsnprintf=_snprintf
fi
Expand Down Expand Up @@ -4019,6 +4019,7 @@ elif enabled_any msvc icl; then
enabled x86_32 && disable aligned_stack
enabled_all x86_32 debug && add_cflags -Oy-
enabled debug && add_ldflags -debug
enable pragma_deprecated
if enabled icl; then
# basically -fstrict-aliasing that does not work (correctly) on icl 13.x
check_cpp_condition "windows.h" "__ICL < 1300" && add_cflags -Qansi-alias
Expand Down
2 changes: 2 additions & 0 deletions libavutil/attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@

#if AV_GCC_VERSION_AT_LEAST(3,1)
# define attribute_deprecated __attribute__((deprecated))
#elif defined(_MSC_VER)
# define attribute_deprecated __declspec(deprecated)
#else
# define attribute_deprecated
#endif
Expand Down
12 changes: 10 additions & 2 deletions libavutil/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,16 @@
#endif

#if HAVE_PRAGMA_DEPRECATED
# define FF_DISABLE_DEPRECATION_WARNINGS _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
# define FF_ENABLE_DEPRECATION_WARNINGS _Pragma("GCC diagnostic warning \"-Wdeprecated-declarations\"")
# if defined(__ICL)
# 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
Expand Down

0 comments on commit 09f2581

Please sign in to comment.