Skip to content

use -fno-strict-aliasing for code using COM pointers

Steve Lhomme requested to merge robUx4/vlc:com-ptr-aliasing into master

Following the discussion in !869 (merged) it might not be safe to cast to void** to get pointer values and thus using IID_PPV_ARGS or WRL. Using -fno-strict-aliasing should allow us to use this helpful Windows/compiler API's.

This might be backported to 3.0 where COM and WRL are used.

v2:

  • C++ modules only
  • renamed to LIBCOMFLAGS

v3:

  • added freetype/dwrite which uses WRL and COM without LIBCOM (DWriteCreateFactory)
  • split the general commit using LIBCOMFLAGS so they can be backported to 3.0 independently

v4:

  • test -fno-strict-aliasing with the C++ compiler, not the C compiler

v5:

  • fix missing AM_CXXFLAGS for dwrite

v8:

  • have -fno-strict-aliasing on Windows or fail configure 💥
  • renamed the flag to LIBCOMCXXFLAGS to show it should be used in C++ code, the fancy C++ helpers are not available there, the code will have to be clean from pointer aliasing with COM objects.
Edited by Steve Lhomme

Merge request reports

Loading