Commit 7a776a79 authored by Steve Lhomme's avatar Steve Lhomme Committed by Hugo Beauzée-Luyssen
Browse files

configure: force -fno-strict-aliasing for C++ modules using COM objects

This avoids potential compiler optimizations when casting to void** when using
IID_PPV_ARGS or WRL.

If the option is not supported we fail the configure as many important C++
modules may not work as expected due to pointer aliasing. In practice this
should never happen as GCC for mingw-w64 and Clang support this correctly.
parent 5140d986
......@@ -388,6 +388,16 @@ AC_ARG_ENABLE([winstore_app],
vlc_winstore_app=0
AS_IF([test "${SYS}" = "mingw32"],[
LIBCOM="-lole32 -loleaut32"
AC_LANG_PUSH(C++)
AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], [
LIBCOMCXXFLAGS="-fno-strict-aliasing"
],[
# fno-strict-aliasing is necessary for WRL and IID_PPV_ARGS to work safely
# MSVC doesn't have this option but doesn't do pointer aliasing, so it
# should work too
AC_MSG_ERROR([-fno-strict-aliasing is necessary for Windows C++ modules])
])
AC_LANG_POP(C++)
AS_IF([test "${enable_winstore_app}" = "yes"], [
vlc_winstore_app=1
LIBCOM="-loleaut32"
......@@ -400,6 +410,7 @@ AS_IF([test "${SYS}" = "mingw32"],[
AC_DEFINE([VLC_WINSTORE_APP], [1], [Define to 1 if building for Windows Store.])
],[])
AC_SUBST([LIBCOM])
AC_SUBST([LIBCOMCXXFLAGS])
])
vlc_build_pdb=0
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment