diff --git a/subprojects/gst-editing-services/meson.build b/subprojects/gst-editing-services/meson.build index 3ab0963593..a33b95f90f 100644 --- a/subprojects/gst-editing-services/meson.build +++ b/subprojects/gst-editing-services/meson.build @@ -57,8 +57,6 @@ if cc.get_id() == 'msvc' # Enable some warnings on MSVC to match GCC/Clang behaviour '/w14062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled - '/w14101', # 'identifier' : unreferenced local variable - '/w14189', # 'identifier' : local variable is initialized but not referenced ] add_project_arguments(msvc_args, language: 'c') endif @@ -233,8 +231,26 @@ else gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep) endif -if gst_debug_disabled and cc.has_argument('-Wno-unused') - add_project_arguments('-Wno-unused', language: 'c') +if gst_debug_disabled + message('GStreamer debug system is disabled') + if cc.get_argument_syntax() == 'msvc' + msvc_args = cc.get_supported_arguments([ + '/wd4101', # 'identifier' : unreferenced local variable + '/wd4189', # 'identifier' : local variable is initialized but not referenced + ]) + add_project_arguments(msvc_args, language: 'c') + elif cc.has_argument('-Wno-unused') + add_project_arguments(['-Wno-unused'], language: 'c') + endif +else + if cc.get_argument_syntax() == 'msvc' and gst_version_is_dev + msvc_args = cc.get_supported_arguments([ + '/we4101', # 'identifier' : unreferenced local variable + '/we4189', # 'identifier' : local variable is initialized but not referenced + ]) + add_project_arguments(msvc_args, language: 'c') + endif + message('GStreamer debug system is enabled') endif warning_flags = [ diff --git a/subprojects/gst-libav/meson.build b/subprojects/gst-libav/meson.build index b7a8386038..b4de073c66 100644 --- a/subprojects/gst-libav/meson.build +++ b/subprojects/gst-libav/meson.build @@ -133,8 +133,6 @@ if cc.get_id() == 'msvc' '/we4053', # one void operand for '?:' '/we4062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled '/we4098', # 'function' : void function returning a value - '/we4101', # 'identifier' : unreferenced local variable - '/we4189', # 'identifier' : local variable is initialized but not referenced ]) endif add_project_arguments(msvc_args, language: ['c', 'cpp']) @@ -161,28 +159,36 @@ if cc.has_argument('-fno-strict-aliasing') add_project_arguments('-fno-strict-aliasing', language: 'c') endif +# Disable compiler warnings for unused variables and args if gst debug system is disabled if gst_dep.type_name() == 'internal' - gst_proj = subproject('gstreamer') - - if not gst_proj.get_variable('gst_debug') - message('GStreamer debug system is disabled') - add_project_arguments('-Wno-unused', language: 'c') - else - message('GStreamer debug system is enabled') - endif + gst_proj = subproject('gstreamer') + gst_debug_disabled = not gst_proj.get_variable('gst_debug') else - # We can't check that in the case of subprojects as we won't - # be able to build against an internal dependency (which is not built yet) - if not cc.compiles(''' -#include -#ifdef GST_DISABLE_GST_DEBUG -#error "debugging disabled, make compiler fail" -#endif''' , dependencies: gst_dep) - message('GStreamer debug system is disabled') - add_project_arguments('-Wno-unused', language: 'c') - else - message('GStreamer debug system is enabled') - endif + # We can't check that in the case of subprojects as we won't + # be able to build against an internal dependency (which is not built yet) + gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep) +endif + +if gst_debug_disabled + message('GStreamer debug system is disabled') + if cc.get_argument_syntax() == 'msvc' + msvc_args = cc.get_supported_arguments([ + '/wd4101', # 'identifier' : unreferenced local variable + '/wd4189', # 'identifier' : local variable is initialized but not referenced + ]) + add_project_arguments(msvc_args, language: 'c') + elif cc.has_argument('-Wno-unused') + add_project_arguments(['-Wno-unused'], language: 'c') + endif +else + if cc.get_argument_syntax() == 'msvc' and gst_version_is_dev + msvc_args = cc.get_supported_arguments([ + '/we4101', # 'identifier' : unreferenced local variable + '/we4189', # 'identifier' : local variable is initialized but not referenced + ]) + add_project_arguments(msvc_args, language: 'c') + endif + message('GStreamer debug system is enabled') endif warning_flags = [ diff --git a/subprojects/gst-plugins-bad/meson.build b/subprojects/gst-plugins-bad/meson.build index 9abaea0d64..96aaba8fb1 100644 --- a/subprojects/gst-plugins-bad/meson.build +++ b/subprojects/gst-plugins-bad/meson.build @@ -83,8 +83,6 @@ if cc.get_id() == 'msvc' '/we4053', # one void operand for '?:' '/we4062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled '/we4098', # 'function' : void function returning a value - '/we4101', # 'identifier' : unreferenced local variable - '/we4189', # 'identifier' : local variable is initialized but not referenced ]) endif add_project_arguments(msvc_args, language: ['c', 'cpp']) @@ -489,13 +487,28 @@ endif if gst_debug_disabled message('GStreamer debug system is disabled') - if cc.has_argument('-Wno-unused') - add_project_arguments('-Wno-unused', language: 'c') - endif - if cxx.has_argument ('-Wno-unused') - add_project_arguments('-Wno-unused', language: 'cpp') + if cc.get_argument_syntax() == 'msvc' + msvc_args = cc.get_supported_arguments([ + '/wd4101', # 'identifier' : unreferenced local variable + '/wd4189', # 'identifier' : local variable is initialized but not referenced + ]) + add_project_arguments(msvc_args, language: ['c', 'cpp']) + else + if cc.has_argument('-Wno-unused') + add_project_arguments('-Wno-unused', language: 'c') + endif + if cxx.has_argument ('-Wno-unused') + add_project_arguments('-Wno-unused', language: 'cpp') + endif endif else + if cc.get_argument_syntax() == 'msvc' and gst_version_is_dev + msvc_args = cc.get_supported_arguments([ + '/we4101', # 'identifier' : unreferenced local variable + '/we4189', # 'identifier' : local variable is initialized but not referenced + ]) + add_project_arguments(msvc_args, language: ['c', 'cpp']) + endif message('GStreamer debug system is enabled') endif diff --git a/subprojects/gst-plugins-base/meson.build b/subprojects/gst-plugins-base/meson.build index 454d76f60f..271e2b1a79 100644 --- a/subprojects/gst-plugins-base/meson.build +++ b/subprojects/gst-plugins-base/meson.build @@ -79,8 +79,6 @@ if cc.get_id() == 'msvc' '/we4053', # one void operand for '?:' '/we4062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled '/we4098', # 'function' : void function returning a value - '/we4101', # 'identifier' : unreferenced local variable - '/we4189', # 'identifier' : local variable is initialized but not referenced ]) endif add_project_arguments(msvc_args, language: ['c', 'cpp']) @@ -410,28 +408,36 @@ int32x4_t testfunc(int16_t *a, int16_t *b) { endif endif +# Disable compiler warnings for unused variables and args if gst debug system is disabled if gst_dep.type_name() == 'internal' - gst_proj = subproject('gstreamer') - - if not gst_proj.get_variable('gst_debug') - message('GStreamer debug system is disabled') - add_project_arguments('-Wno-unused', language: 'c') - else - message('GStreamer debug system is enabled') - endif + gst_proj = subproject('gstreamer') + gst_debug_disabled = not gst_proj.get_variable('gst_debug') else - # We can't check that in the case of subprojects as we won't - # be able to build against an internal dependency (which is not built yet) - if not cc.compiles(''' -#include -#ifdef GST_DISABLE_GST_DEBUG -#error "debugging disabled, make compiler fail" -#endif''' , dependencies: gst_dep) - message('GStreamer debug system is disabled') - add_project_arguments('-Wno-unused', language: 'c') - else - message('GStreamer debug system is enabled') - endif + # We can't check that in the case of subprojects as we won't + # be able to build against an internal dependency (which is not built yet) + gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep) +endif + +if gst_debug_disabled + message('GStreamer debug system is disabled') + if cc.get_argument_syntax() == 'msvc' + msvc_args = cc.get_supported_arguments([ + '/wd4101', # 'identifier' : unreferenced local variable + '/wd4189', # 'identifier' : local variable is initialized but not referenced + ]) + add_project_arguments(msvc_args, language: 'c') + elif cc.has_argument('-Wno-unused') + add_project_arguments(['-Wno-unused'], language: 'c') + endif +else + if cc.get_argument_syntax() == 'msvc' and gst_version_is_dev + msvc_args = cc.get_supported_arguments([ + '/we4101', # 'identifier' : unreferenced local variable + '/we4189', # 'identifier' : local variable is initialized but not referenced + ]) + add_project_arguments(msvc_args, language: 'c') + endif + message('GStreamer debug system is enabled') endif if cc.has_member('struct tcp_info', '__tcpi_reordering', prefix: '#include ') diff --git a/subprojects/gst-plugins-good/meson.build b/subprojects/gst-plugins-good/meson.build index b8bc0f5176..a469d378e5 100644 --- a/subprojects/gst-plugins-good/meson.build +++ b/subprojects/gst-plugins-good/meson.build @@ -68,8 +68,6 @@ if cc.get_id() == 'msvc' '/we4053', # one void operand for '?:' '/we4062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled '/we4098', # 'function' : void function returning a value - '/we4101', # 'identifier' : unreferenced local variable - '/we4189', # 'identifier' : local variable is initialized but not referenced ]) endif if have_cxx @@ -457,13 +455,28 @@ endif if gst_debug_disabled message('GStreamer debug system is disabled') - if cc.has_argument('-Wno-unused') - add_project_arguments('-Wno-unused', language: 'c') - endif - if have_cxx and cxx.has_argument ('-Wno-unused') - add_project_arguments('-Wno-unused', language: 'cpp') + if cc.get_argument_syntax() == 'msvc' + msvc_args = cc.get_supported_arguments([ + '/wd4101', # 'identifier' : unreferenced local variable + '/wd4189', # 'identifier' : local variable is initialized but not referenced + ]) + add_project_arguments(msvc_args, language: ['c', 'cpp']) + else + if cc.has_argument('-Wno-unused') + add_project_arguments('-Wno-unused', language: 'c') + endif + if have_cxx and cxx.has_argument ('-Wno-unused') + add_project_arguments('-Wno-unused', language: 'cpp') + endif endif else + if cc.get_argument_syntax() == 'msvc' and gst_version_is_dev + msvc_args = cc.get_supported_arguments([ + '/we4101', # 'identifier' : unreferenced local variable + '/we4189', # 'identifier' : local variable is initialized but not referenced + ]) + add_project_arguments(msvc_args, language: ['c', 'cpp']) + endif message('GStreamer debug system is enabled') endif diff --git a/subprojects/gst-plugins-ugly/meson.build b/subprojects/gst-plugins-ugly/meson.build index 215a1fbd64..691f01671a 100644 --- a/subprojects/gst-plugins-ugly/meson.build +++ b/subprojects/gst-plugins-ugly/meson.build @@ -66,8 +66,6 @@ if cc.get_id() == 'msvc' '/we4053', # one void operand for '?:' '/we4062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled '/we4098', # 'function' : void function returning a value - '/we4101', # 'identifier' : unreferenced local variable - '/we4189', # 'identifier' : local variable is initialized but not referenced ]) endif if have_cxx @@ -220,13 +218,28 @@ endif if gst_debug_disabled message('GStreamer debug system is disabled') - if cc.has_argument('-Wno-unused') - add_project_arguments('-Wno-unused', language: 'c') - endif - if have_cxx and cxx.has_argument ('-Wno-unused') - add_project_arguments('-Wno-unused', language: 'cpp') + if cc.get_argument_syntax() == 'msvc' + msvc_args = cc.get_supported_arguments([ + '/wd4101', # 'identifier' : unreferenced local variable + '/wd4189', # 'identifier' : local variable is initialized but not referenced + ]) + add_project_arguments(msvc_args, language: ['c', 'cpp']) + else + if cc.has_argument('-Wno-unused') + add_project_arguments('-Wno-unused', language: 'c') + endif + if have_cxx and cxx.has_argument ('-Wno-unused') + add_project_arguments('-Wno-unused', language: 'cpp') + endif endif else + if cc.get_argument_syntax() == 'msvc' and gst_version_is_dev + msvc_args = cc.get_supported_arguments([ + '/we4101', # 'identifier' : unreferenced local variable + '/we4189', # 'identifier' : local variable is initialized but not referenced + ]) + add_project_arguments(msvc_args, language: ['c', 'cpp']) + endif message('GStreamer debug system is enabled') endif diff --git a/subprojects/gstreamer/meson.build b/subprojects/gstreamer/meson.build index 41f5e5af0b..e22cbc4dd2 100644 --- a/subprojects/gstreamer/meson.build +++ b/subprojects/gstreamer/meson.build @@ -76,8 +76,6 @@ if cc.get_id() == 'msvc' '/we4053', # one void operand for '?:' '/we4062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled '/we4098', # 'function' : void function returning a value - '/we4101', # 'identifier' : unreferenced local variable - '/we4189', # 'identifier' : local variable is initialized but not referenced ]) endif add_project_arguments(msvc_args, language: 'c') @@ -488,7 +486,23 @@ endif gst_debug = get_option('gst_debug') if not gst_debug - add_project_arguments(['-Wno-unused'], language: 'c') + if cc.get_argument_syntax() == 'msvc' + msvc_args = cc.get_supported_arguments([ + '/wd4101', # 'identifier' : unreferenced local variable + '/wd4189', # 'identifier' : local variable is initialized but not referenced + ]) + add_project_arguments(msvc_args, language: 'c') + elif cc.has_argument('-Wno-unused') + add_project_arguments(['-Wno-unused'], language: 'c') + endif +else + if cc.get_argument_syntax() == 'msvc' and gst_version_is_dev + msvc_args = cc.get_supported_arguments([ + '/we4101', # 'identifier' : unreferenced local variable + '/we4189', # 'identifier' : local variable is initialized but not referenced + ]) + add_project_arguments(msvc_args, language: 'c') + endif endif warning_flags = [