[vlc-commits] [Git][videolan/vlc][master] 5 commits: meson: force -fno-strict-aliasing for C++ modules

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Jan 24 14:51:17 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
8b90010a by Johannes Kauffmann at 2023-01-24T14:02:56+00:00
meson: force -fno-strict-aliasing for C++ modules

Following 7a776a79ff85e1a2196e6176d6cdb73fd8e1cd15.

Mirroring configure.ac, this check is only done for MinGW, because it
doesn't make sense on MSVC.

- - - - -
e28d9709 by Johannes Kauffmann at 2023-01-24T14:02:56+00:00
meson: qt: add libcom_cppflags

Following cfafaa8768fab02a07e825cb91648ec9adcb7df1.

- - - - -
e3db1867 by Johannes Kauffmann at 2023-01-24T14:02:56+00:00
meson: freetype: add libcom_cppflags

Following 3ee0d28d1cd501b4f20be7f2ef093a4bb5b2e879.

- - - - -
55884a93 by Johannes Kauffmann at 2023-01-24T14:02:56+00:00
meson: screen: add libcom_cppflags

Following de95c529270ae9892be2d634ed6c2fb3a54e2e2d.

- - - - -
571692a9 by Johannes Kauffmann at 2023-01-24T14:02:56+00:00
meson: add libcom_cppflags to C++ modules using LIBCOM

Following acad6ed0e18ecfcae70fcfb4ff990eb230f9ae88.

bdagraph.cpp actually uses IID_PPV_ARGS now.

- - - - -


5 changed files:

- meson.build
- modules/access/meson.build
- modules/access/screen/meson.build
- modules/gui/qt/meson.build
- modules/text_renderer/meson.build


Changes:

=====================================
meson.build
=====================================
@@ -280,6 +280,7 @@ have_mingw = false
 have_win_desktop = false
 have_win_store = false
 mingw_libs = []
+libcom_cppflags = []
 
 if host_system == 'windows'
 
@@ -362,6 +363,14 @@ windows_version_test = '''
         # TODO: enable when meson 0.63 is required
         # add_project_dependencies(mingw_libs, language: ['c', 'cpp'])
 
+        # 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
+        libcom_cppflags += '-fno-strict-aliasing'
+        if not cpp.has_argument(libcom_cppflags)
+            error('-fno-strict-aliasing is necessary for Windows C++ modules')
+        endif
+
         # Check for fnative-struct or mms-bitfields support for MinGW
         if cc.has_argument('-mms-bitfields')
             add_project_arguments('-mms-bitfields',


=====================================
modules/access/meson.build
=====================================
@@ -331,7 +331,8 @@ if host_system == 'windows'
             dtv_common_sources,
             files('dtv/bdagraph.cpp')
         ],
-        'dependencies' : [strmiids_lib]
+        'dependencies' : [strmiids_lib],
+        'cpp_args' : libcom_cppflags
     }
 endif
 


=====================================
modules/access/screen/meson.build
=====================================
@@ -16,12 +16,14 @@ if get_option('screen').allowed()
     )
 
     screen_deps = []
+    screen_cppargs = []
     screen_link_with = []
 
     if host_system == 'windows'
       screen_files += files('win32.c', 'dxgi.cpp')
       gdi32_dep = cc.find_library('gdi32')
       screen_deps += [gdi32_dep]
+      screen_cppargs += libcom_cppflags
       screen_link_with += d3d11_common_lib
     else
       screen_files += files('mac.c')
@@ -33,6 +35,7 @@ if get_option('screen').allowed()
         'name' : 'screen',
         'sources' : screen_files,
         'dependencies' : screen_deps,
+        'cpp_args' : screen_cppargs,
         'link_with' : screen_link_with,
     }
   endif


=====================================
modules/gui/qt/meson.build
=====================================
@@ -8,6 +8,7 @@ qt_include_dir = include_directories('.')
 
 qt_extra_deps = []
 qt_extra_flags = []
+qt_cppargs = []
 
 qt5_dep = dependency('qt5',
     version: '>=5.11.0',
@@ -576,13 +577,17 @@ if qt5_dep.found()
         qt_extra_flags += '-DQT_QML_DEBUG'
     endif
 
+    if host_system == 'windows'
+        qt_cppargs += libcom_cppflags
+    endif
+
     vlc_modules += {
         'name' : 'qt',
         'sources' : [qt5pre_files, qt_sources, some_sources],
         'dependencies' : [qt5_dep, qt_extra_deps],
         'include_directories' : qt_include_dir,
         'c_args' : qt_extra_flags,
-        'cpp_args' : qt_extra_flags
+        'cpp_args' : [qt_extra_flags, qt_cppargs]
     }
 
     #Qt GTK theme module


=====================================
modules/text_renderer/meson.build
=====================================
@@ -16,8 +16,10 @@ freetype_srcs = files(
     'freetype/ftcache.c',
     'freetype/lru.c',
 )
+freetype_cppargs = []
 if host_system == 'windows'
     freetype_srcs += files('freetype/fonts/dwrite.cpp')
+    freetype_cppargs += libcom_cppflags
     # TODO: Don't add this file for UWP builds
     freetype_srcs += files('freetype/fonts/win32.c')
 elif host_system == 'darwin'
@@ -32,6 +34,7 @@ if freetype_dep.found()
         'name' : 'freetype',
         'sources' : freetype_srcs,
         'dependencies' : freetype_deps,
+        'cpp_args' : freetype_cppargs
     }
 endif
 
@@ -64,7 +67,8 @@ if host_system == 'windows'
     if have_sapi
         vlc_modules += {
             'name' : 'sapi',
-            'sources' : files('sapi.cpp')
+            'sources' : files('sapi.cpp'),
+            'cpp_args' : libcom_cppflags
         }
     endif
 endif



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7bd62e08624be8e0291e3e5819cdf3fc2c53c53b...571692a9e8a180288bf473aff7841af9b05c13e6

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7bd62e08624be8e0291e3e5819cdf3fc2c53c53b...571692a9e8a180288bf473aff7841af9b05c13e6
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list