meson: Fix MSVC build with GST_DISABLE_GST_DEBUG

MSVC does not understand Wno-unused

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5585>
This commit is contained in:
Seungha Yang 2023-11-02 00:03:28 +09:00 committed by GStreamer Marge Bot
parent e7479a8c94
commit 5e147ed3b8
7 changed files with 153 additions and 72 deletions

View file

@ -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 = [

View file

@ -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 <gst/gstconfig.h>
#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 = [

View file

@ -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

View file

@ -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 <gst/gstconfig.h>
#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 <netinet/tcp.h>')

View file

@ -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

View file

@ -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

View file

@ -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 = [