Skip to content

Commit bbcce86

Browse files
committed
Fix or disable some useless warnings
1 parent e0ffe85 commit bbcce86

File tree

4 files changed

+39
-5
lines changed

4 files changed

+39
-5
lines changed

CMakeLists.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ function(streamfx_add_library TARGET_NAME TARGET_TYPE)
530530
"4505"
531531
"4514"
532532
"5245"
533+
"5264"
533534
# Don't warn about unreferenced variables or parameters which are assigned/initialized.
534535
"4189"
535536
# Don't warn about not-explicitly-handled enumeration identifiers
@@ -556,6 +557,10 @@ function(streamfx_add_library TARGET_NAME TARGET_TYPE)
556557
"5045"
557558
# Ignore inserted padding.
558559
"4324"
560+
# Ignore non-standard nameless struct/union.
561+
"4201"
562+
# Intended behavior: Replace undefined macros with 0
563+
"4668"
559564
)
560565
foreach(WARN ${DISABLED_WARNINGS})
561566
target_compile_options(${TARGET_NAME} PRIVATE "/wd${WARN}")
@@ -705,6 +710,35 @@ function(streamfx_add_library TARGET_NAME TARGET_TYPE)
705710
target_compile_options(${TARGET_NAME} PRIVATE "-Wall")
706711
target_compile_options(${TARGET_NAME} PRIVATE "-Wextra")
707712

713+
# - Disable useless warnings
714+
set(DISABLED_WARNINGS
715+
# Don't warn about unused variables, parameters, labels, functions, or typedefs.
716+
"unused-function"
717+
"unused-label"
718+
"unused-local-typedefs"
719+
"unused-parameter"
720+
"unused-result"
721+
"unused-const-variable"
722+
"unused-variable"
723+
"unused-value"
724+
# Don't warn about unreferenced variables or parameters which are assigned/initialized.
725+
"unused-but-set-parameter"
726+
"unused-but-set-variable"
727+
# Don't warn about not-explicitly-handled enumeration identifiers
728+
"switch"
729+
# Ignore automatic padding warnings.
730+
"padded"
731+
# Ignore implicit '= delete;'.
732+
# Ignore extra arguments for printf
733+
"format-extra-args"
734+
# Ignore undefined, unused or unreferenced pre-processor macros
735+
"unused-macros"
736+
)
737+
foreach(WARN ${DISABLED_WARNINGS})
738+
target_compile_options(${TARGET_NAME} PRIVATE "-Wno-${WARN}")
739+
endforeach()
740+
741+
708742
# - Require enabled instruction sets.
709743
if(${PREFIX}TARGET_NATIVE)
710744
target_compile_options(${TARGET_NAME} PRIVATE

components/ffmpeg/source/encoders/ffmpeg/nvenc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,8 +589,8 @@ void nvenc::update(ffmpeg_factory* factory, ffmpeg_instance* instance, obs_data_
589589
if (!context->internal) {
590590
if (streamfx::ffmpeg::tools::avoption_exists(context->priv_data, "multipass")) {
591591
// Multi-Pass
592-
if (const char* v = obs_data_get_string(settings, ST_KEY_RATECONTROL_MULTIPASS); (v != nullptr) && (v[0] != '\0')) {
593-
av_opt_set(context->priv_data, "multipass", v, AV_OPT_SEARCH_CHILDREN);
592+
if (const char* v2 = obs_data_get_string(settings, ST_KEY_RATECONTROL_MULTIPASS); (v2 != nullptr) && (v2[0] != '\0')) {
593+
av_opt_set(context->priv_data, "multipass", v2, AV_OPT_SEARCH_CHILDREN);
594594
av_opt_set_int(context->priv_data, "2pass", 0, AV_OPT_SEARCH_CHILDREN);
595595
}
596596
} else {

components/ffmpeg/source/encoders/ffmpeg/prores_aw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void prores_aw::update(ffmpeg_factory* factory, ffmpeg_instance* instance, obs_d
7171
void prores_aw::log(ffmpeg_factory* factory, ffmpeg_instance* instance, obs_data_t* settings)
7272
{
7373
DLOG_INFO("[%s] Apple ProRes:", factory->get_avcodec()->name);
74-
::streamfx::ffmpeg::tools::print_av_option_string(instance->get_avcodeccontext(), "profile", " Profile", [&factory, &instance](int64_t v) {
74+
::streamfx::ffmpeg::tools::print_av_option_string(instance->get_avcodeccontext(), "profile", " Profile", [&factory](int64_t v) {
7575
int val = static_cast<int>(v);
7676
for (auto ptr = factory->get_avcodec()->profiles; (ptr->profile != FF_PROFILE_UNKNOWN) && (ptr != nullptr); ptr++) {
7777
if (ptr->profile == val) {

source/obs/gs/gs-mipmapper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ std::string opengl_translate_error(GLenum error)
5555
{
5656
#define TRANSLATE_CASE(X) \
5757
case X: \
58-
return #X;
58+
return #X; break;
5959

6060
switch (error) {
6161
TRANSLATE_CASE(GL_NO_ERROR);
@@ -76,7 +76,7 @@ std::string opengl_translate_framebuffer_status(GLenum error)
7676
{
7777
#define TRANSLATE_CASE(X) \
7878
case X: \
79-
return #X;
79+
return #X; break;
8080

8181
switch (error) {
8282
TRANSLATE_CASE(GL_FRAMEBUFFER_COMPLETE);

0 commit comments

Comments
 (0)