Fix or disable some useless warnings

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2023-10-05 09:02:51 +02:00 committed by Xaymar
parent e0ffe85a30
commit bbcce86c47
4 changed files with 39 additions and 5 deletions

View File

@ -530,6 +530,7 @@ function(streamfx_add_library TARGET_NAME TARGET_TYPE)
"4505"
"4514"
"5245"
"5264"
# Don't warn about unreferenced variables or parameters which are assigned/initialized.
"4189"
# Don't warn about not-explicitly-handled enumeration identifiers
@ -556,6 +557,10 @@ function(streamfx_add_library TARGET_NAME TARGET_TYPE)
"5045"
# Ignore inserted padding.
"4324"
# Ignore non-standard nameless struct/union.
"4201"
# Intended behavior: Replace undefined macros with 0
"4668"
)
foreach(WARN ${DISABLED_WARNINGS})
target_compile_options(${TARGET_NAME} PRIVATE "/wd${WARN}")
@ -705,6 +710,35 @@ function(streamfx_add_library TARGET_NAME TARGET_TYPE)
target_compile_options(${TARGET_NAME} PRIVATE "-Wall")
target_compile_options(${TARGET_NAME} PRIVATE "-Wextra")
# - Disable useless warnings
set(DISABLED_WARNINGS
# Don't warn about unused variables, parameters, labels, functions, or typedefs.
"unused-function"
"unused-label"
"unused-local-typedefs"
"unused-parameter"
"unused-result"
"unused-const-variable"
"unused-variable"
"unused-value"
# Don't warn about unreferenced variables or parameters which are assigned/initialized.
"unused-but-set-parameter"
"unused-but-set-variable"
# Don't warn about not-explicitly-handled enumeration identifiers
"switch"
# Ignore automatic padding warnings.
"padded"
# Ignore implicit '= delete;'.
# Ignore extra arguments for printf
"format-extra-args"
# Ignore undefined, unused or unreferenced pre-processor macros
"unused-macros"
)
foreach(WARN ${DISABLED_WARNINGS})
target_compile_options(${TARGET_NAME} PRIVATE "-Wno-${WARN}")
endforeach()
# - Require enabled instruction sets.
if(${PREFIX}TARGET_NATIVE)
target_compile_options(${TARGET_NAME} PRIVATE

View File

@ -589,8 +589,8 @@ void nvenc::update(ffmpeg_factory* factory, ffmpeg_instance* instance, obs_data_
if (!context->internal) {
if (streamfx::ffmpeg::tools::avoption_exists(context->priv_data, "multipass")) {
// Multi-Pass
if (const char* v = obs_data_get_string(settings, ST_KEY_RATECONTROL_MULTIPASS); (v != nullptr) && (v[0] != '\0')) {
av_opt_set(context->priv_data, "multipass", v, AV_OPT_SEARCH_CHILDREN);
if (const char* v2 = obs_data_get_string(settings, ST_KEY_RATECONTROL_MULTIPASS); (v2 != nullptr) && (v2[0] != '\0')) {
av_opt_set(context->priv_data, "multipass", v2, AV_OPT_SEARCH_CHILDREN);
av_opt_set_int(context->priv_data, "2pass", 0, AV_OPT_SEARCH_CHILDREN);
}
} else {

View File

@ -71,7 +71,7 @@ void prores_aw::update(ffmpeg_factory* factory, ffmpeg_instance* instance, obs_d
void prores_aw::log(ffmpeg_factory* factory, ffmpeg_instance* instance, obs_data_t* settings)
{
DLOG_INFO("[%s] Apple ProRes:", factory->get_avcodec()->name);
::streamfx::ffmpeg::tools::print_av_option_string(instance->get_avcodeccontext(), "profile", " Profile", [&factory, &instance](int64_t v) {
::streamfx::ffmpeg::tools::print_av_option_string(instance->get_avcodeccontext(), "profile", " Profile", [&factory](int64_t v) {
int val = static_cast<int>(v);
for (auto ptr = factory->get_avcodec()->profiles; (ptr->profile != FF_PROFILE_UNKNOWN) && (ptr != nullptr); ptr++) {
if (ptr->profile == val) {

View File

@ -55,7 +55,7 @@ std::string opengl_translate_error(GLenum error)
{
#define TRANSLATE_CASE(X) \
case X: \
return #X;
return #X; break;
switch (error) {
TRANSLATE_CASE(GL_NO_ERROR);
@ -76,7 +76,7 @@ std::string opengl_translate_framebuffer_status(GLenum error)
{
#define TRANSLATE_CASE(X) \
case X: \
return #X;
return #X; break;
switch (error) {
TRANSLATE_CASE(GL_FRAMEBUFFER_COMPLETE);