[vlc-commits] [Git][videolan/vlc][master] 2 commits: meson: simplify choice of compiler flag to use

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Jan 18 14:06:41 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
455b4ffb by Steve Lhomme at 2023-01-18T12:16:33+00:00
meson: simplify choice of compiler flag to use

- - - - -
5b398308 by Steve Lhomme at 2023-01-18T12:16:33+00:00
meson: add common compiler options similar to configure.ac

Co-authored-by: Marvin Scholz <epirat07 at gmail.com>

- - - - -


2 changed files:

- meson.build
- meson_options.txt


Changes:

=====================================
meson.build
=====================================
@@ -403,11 +403,49 @@ windows_version_test = '''
 
 endif
 
-if cc.has_argument('-Werror-implicit-function-declaration')
-    add_project_arguments('-Werror-implicit-function-declaration', language: ['c', 'cpp'])
-elif cc.has_argument('-we4013')
-    add_project_arguments('-we4013', language: ['c', 'cpp'])
-endif
+add_project_arguments(cc.get_supported_arguments([
+    '-Wno-deprecated-copy', # Some Qt version are generating tons of warning that cannot be
+                            # avoided so mute them
+]), language: ['c', 'cpp', 'objc'])
+
+add_project_arguments(cc.get_supported_arguments([
+    '-Wextra',
+    '-Wsign-compare',
+    '-Wundef',
+    '-Wpointer-arith',
+    '-Wvolatile-register-var',
+    '-Wformat',
+    '-Wformat-security',
+    '-Wduplicated-branches',
+    '-Wduplicated-cond',
+]), language: ['c', 'cpp'])
+
+add_project_arguments(cc.get_supported_arguments([
+    '-Wbad-function-cast',
+    '-Wwrite-strings',
+    '-Wmissing-prototypes',
+    '-Werror-implicit-function-declaration',
+    '-Winit-self',
+    '-Wlogical-op',
+    '-Wshadow=local',
+    '-Wmultistatement-macros',
+    '-pipe'
+]), language: ['c'])
+
+if get_option('branch_protection') \
+    .require(host_machine.cpu_family() == 'aarch64', error_message: 'Branch protection is only available for AArch64') \
+    .require(cc.has_argument('-mbranch-protection=standard'), error_message: 'Compiler does not support `-mbranch-protection`') \
+    .allowed()
+    add_project_arguments('-mbranch-protection=standard', language: ['c', 'cpp'])
+endif
+
+if cc.get_id() not in ['clang-cl']
+    add_project_arguments(cc.get_supported_arguments([
+        '-Wall', # too verbose with clang-cl
+    ]), language: ['c', 'cpp'])
+endif
+
+add_project_arguments(cc.first_supported_argument(['-Werror-implicit-function-declaration', '-we4013']), language: ['c'])
 
 #
 # Check if other libs are needed


=====================================
meson_options.txt
=====================================
@@ -40,6 +40,11 @@ option('run_as_root',
     value : false,
     description : 'Allow running VLC as root')
 
+option('branch_protection',
+    type : 'feature',
+    value : 'auto',
+    description : 'AArch64 branch protection')
+
 option('winstore_app',
     type : 'boolean',
     value : 'false',
@@ -52,7 +57,6 @@ option('winstore_app',
 # TODO: Missing avx option
 # TODO: Missing neon option
 # TODO: Missing sve option
-# TODO: Missing branch_protection option
 # TODO: Missing altivec option
 # TODO: Missing update-check option
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/145c250bb3440800c783940fce09514348b9e07f...5b398308b63141554430e1a90a2eccdfb1189ab9

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/145c250bb3440800c783940fce09514348b9e07f...5b398308b63141554430e1a90a2eccdfb1189ab9
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