meson: Do hard build error for some MSVC warnings

Handle various MSVC warnings as errors for development version.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1006>
This commit is contained in:
Seungha Yang 2021-10-01 20:27:28 +09:00 committed by GStreamer Marge Bot
parent 2d969f8ad4
commit e1f0687b09
16 changed files with 140 additions and 33 deletions

View file

@ -115,12 +115,27 @@ if cc.get_id() == 'msvc'
'/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
# 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 gst_version_is_dev
# Enable some warnings on MSVC to match GCC/Clang behaviour
msvc_args += cc.get_supported_arguments([
'/we4002', # too many actual parameters for macro 'identifier'
'/we4003', # not enough actual parameters for macro 'identifier'
'/we4013', # 'function' undefined; assuming extern returning int
'/we4020', # 'function' : too many actual parameters
'/we4027', # function declared without formal parameter list
'/we4029', # declared formal parameter list different from definition
'/we4033', # 'function' must return a value
'/we4045', # 'array' : array bounds overflow
'/we4047', # 'operator' : 'identifier1' differs in levels of indirection from 'identifier2'
'/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'])
endif

View file

@ -67,6 +67,9 @@ static gboolean gst_vulkan_window_win32_open (GstVulkanWindow * window,
static void gst_vulkan_window_win32_close (GstVulkanWindow * window);
static void release_parent_win_id (GstVulkanWindowWin32 * window_win32);
static void gst_vulkan_window_win32_show (GstVulkanWindowWin32 * window);
static gboolean
gst_vulkan_window_win32_create_window (GstVulkanWindowWin32 * window_win32,
GError ** error);
static void
gst_vulkan_window_win32_class_init (GstVulkanWindowWin32Class * klass)

View file

@ -95,6 +95,8 @@
#ifdef G_OS_WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
/* dup, read, close */
#include <io.h>
#else
#include <sys/socket.h>
#include <netdb.h>

View file

@ -64,12 +64,27 @@ if cc.get_id() == 'msvc'
'/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
# 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 gst_version_is_dev
# Enable some warnings on MSVC to match GCC/Clang behaviour
msvc_args += cc.get_supported_arguments([
'/we4002', # too many actual parameters for macro 'identifier'
'/we4003', # not enough actual parameters for macro 'identifier'
'/we4013', # 'function' undefined; assuming extern returning int
'/we4020', # 'function' : too many actual parameters
'/we4027', # function declared without formal parameter list
'/we4029', # declared formal parameter list different from definition
'/we4033', # 'function' must return a value
'/we4045', # 'array' : array bounds overflow
'/we4047', # 'operator' : 'identifier1' differs in levels of indirection from 'identifier2'
'/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'])
# Disable SAFESEH with MSVC for plugins and libs that use external deps that
# are built with MinGW

View file

@ -30,6 +30,8 @@
#ifdef _MSC_VER
/* ssize_t is not available, so match return value of read()/write() on MSVC */
#define ssize_t int
/* read, write */
#include <io.h>
#endif
#include <errno.h>
#include <string.h>

View file

@ -1479,7 +1479,9 @@ gst_mf_video_encoder_enum_internal (GstMFTransform * transform, GUID & subtype,
gboolean have_I420 = FALSE;
gboolean have_NV12 = FALSE;
gboolean have_P010 = FALSE;
#if GST_MF_HAVE_D3D11
gboolean d3d11_aware = FALSE;
#endif
gchar *device_name = nullptr;
IMFActivate *activate;
IMFTransform *encoder;

View file

@ -23,6 +23,7 @@
#include <gst/gst.h>
#include <gst/video/video.h>
#include <stdlib.h>
#include "nvcodec.h"
@ -53,6 +54,7 @@ restore_terminal (void)
static void
print_keyboard_help (void)
{
/* *INDENT-OFF* */
static struct
{
const gchar *key_desc;
@ -68,6 +70,8 @@ print_keyboard_help (void)
"<", "Decrease encoding bitrate by 100 kbit/sec"}, {
"k", "show keyboard shortcuts"}
};
/* *INDENT-ON* */
guint i, chars_to_pad, desc_len, max_desc_len = 0;
g_print ("\n\n%s\n\n", "Keyboard controls:");

View file

@ -318,8 +318,6 @@ public:
bool
GetWindowSize (guint * width, guint * height)
{
bool ret = true;
if (!isValid_)
return false;

View file

@ -62,12 +62,27 @@ if cc.get_id() == 'msvc'
'/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
# 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 gst_version_is_dev
# Enable some warnings on MSVC to match GCC/Clang behaviour
msvc_args += cc.get_supported_arguments([
'/we4002', # too many actual parameters for macro 'identifier'
'/we4003', # not enough actual parameters for macro 'identifier'
'/we4013', # 'function' undefined; assuming extern returning int
'/we4020', # 'function' : too many actual parameters
'/we4027', # function declared without formal parameter list
'/we4029', # declared formal parameter list different from definition
'/we4033', # 'function' must return a value
'/we4045', # 'array' : array bounds overflow
'/we4047', # 'operator' : 'identifier1' differs in levels of indirection from 'identifier2'
'/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'])
# Disable SAFESEH with MSVC for plugins and libs that use external deps that
# are built with MinGW

View file

@ -30,6 +30,7 @@
#include <glib-object.h>
#include <glib/gprintf.h>
#include <gst/gst.h>
#include <stdlib.h>
/* There are several supported scenarios
0) Play rate to 1x -> Apply 'instant-rate-change' to 2x -> Apply 'instant-rate-change' to 0.25x (repeat as fast as possible for 2 sec) -> let play for 2s

View file

@ -47,12 +47,27 @@ if cc.get_id() == 'msvc'
'/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
# 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 gst_version_is_dev
# Enable some warnings on MSVC to match GCC/Clang behaviour
msvc_args += cc.get_supported_arguments([
'/we4002', # too many actual parameters for macro 'identifier'
'/we4003', # not enough actual parameters for macro 'identifier'
'/we4013', # 'function' undefined; assuming extern returning int
'/we4020', # 'function' : too many actual parameters
'/we4027', # function declared without formal parameter list
'/we4029', # declared formal parameter list different from definition
'/we4033', # 'function' must return a value
'/we4045', # 'array' : array bounds overflow
'/we4047', # 'operator' : 'identifier1' differs in levels of indirection from 'identifier2'
'/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
add_project_arguments(msvc_args, language: ['c', 'cpp'])
else

View file

@ -48,12 +48,27 @@ if cc.get_id() == 'msvc'
'/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
# 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 gst_version_is_dev
# Enable some warnings on MSVC to match GCC/Clang behaviour
msvc_args += cc.get_supported_arguments([
'/we4002', # too many actual parameters for macro 'identifier'
'/we4003', # not enough actual parameters for macro 'identifier'
'/we4013', # 'function' undefined; assuming extern returning int
'/we4020', # 'function' : too many actual parameters
'/we4027', # function declared without formal parameter list
'/we4029', # declared formal parameter list different from definition
'/we4033', # 'function' must return a value
'/we4045', # 'array' : array bounds overflow
'/we4047', # 'operator' : 'identifier1' differs in levels of indirection from 'identifier2'
'/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
add_project_arguments(msvc_args, language: ['c', 'cpp'])
else

View file

@ -47,12 +47,27 @@ if cc.get_id() == 'msvc'
'/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
# 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 gst_version_is_dev
# Enable some warnings on MSVC to match GCC/Clang behaviour
msvc_args += cc.get_supported_arguments([
'/we4002', # too many actual parameters for macro 'identifier'
'/we4003', # not enough actual parameters for macro 'identifier'
'/we4013', # 'function' undefined; assuming extern returning int
'/we4020', # 'function' : too many actual parameters
'/we4027', # function declared without formal parameter list
'/we4029', # declared formal parameter list different from definition
'/we4033', # 'function' must return a value
'/we4045', # 'array' : array bounds overflow
'/we4047', # 'operator' : 'identifier1' differs in levels of indirection from 'identifier2'
'/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')
elif cc.has_link_argument('-Wl,-Bsymbolic-functions')
# FIXME: Add an option for this if people ask for it

View file

@ -182,7 +182,7 @@ foo_transform_func (GstBuffer * transbuf, GstMeta * meta,
g_quark_to_string (type), buffer, transbuf, meta);
if (GST_META_TRANSFORM_IS_COPY (type)) {
G_GNUC_UNUSED GstMetaFoo *unused = GST_META_FOO_ADD (transbuf);
GST_META_FOO_ADD (transbuf);
} else {
/* return FALSE, if transform type is not supported */
return FALSE;

View file

@ -28,6 +28,7 @@
#ifdef G_OS_WIN32
#include <winsock2.h>
#include <fcntl.h>
#include <io.h>
#else
#include <unistd.h>
#include <sys/socket.h>

View file

@ -41,6 +41,10 @@
# include <sys/wait.h>
#endif
#ifdef G_OS_WIN32
/* _isatty() */
#include <io.h>
#endif
/* "R" : support color
* "X" : do not clear the screen when leaving the pager