diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2020-11-04 16:13:04 +0300 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2020-11-04 16:13:04 +0300 |
commit | 35eabc3f9576ac483ab041bf0f2ca485d3443a5b (patch) | |
tree | db030ee589223e788805e74a0538e83fcb6502fb /meson.build | |
parent | 99723bc1c1812ccecf811cb5997e32b3f8d7cdca (diff) |
meson: Enable some MSVC warnings for parity with GCC/Clang
This makes it easier to do development with MSVC by making it warn
on common issues that GCC/Clang error out for in our CI configuration.
Continuation from https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/223
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/809>
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/meson.build b/meson.build index 527167acd..583082e7e 100644 --- a/meson.build +++ b/meson.build @@ -31,17 +31,27 @@ cc = meson.get_compiler('c') host_system = host_machine.system() if cc.get_id() == 'msvc' - # Ignore several spurious warnings for things gstreamer does very commonly - # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it - # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once - # NOTE: Only add warnings here if you are sure they're spurious - add_project_arguments( + msvc_args = [ + # Ignore several spurious warnings for things gstreamer does very commonly + # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it + # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once + # NOTE: Only add warnings here if you are sure they're spurious '/wd4018', # implicit signed/unsigned conversion '/wd4146', # unary minus on unsigned (beware INT_MIN) '/wd4244', # lossy type conversion (e.g. double -> int) '/wd4305', # truncating type conversion (e.g. double -> float) cc.get_supported_arguments(['/utf-8']), # set the input encoding to utf-8 - language : 'c') + + # 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 + ] + if have_cxx + add_project_arguments(msvc_args, language: ['c', 'cpp']) + else + add_project_arguments(msvc_args, language: 'c') + endif # Disable SAFESEH with MSVC for plugins and libs that use external deps that # are built with MinGW noseh_link_args = ['/SAFESEH:NO'] |