Skip to content

Commit

Permalink
[WebRTC] Fix -Wunused-but-set-variable warnings in the libwebrtc project
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=250622
<rdar://104261631>

Reviewed by Youenn Fablet.

* Source/ThirdParty/libwebrtc/Configurations/Base.xcconfig:
(WK_FIXME_WARNING_CFLAGS):
- Remove -Wno-unused-but-set-variable.
* Source/ThirdParty/libwebrtc/Source/webrtc/common_video/h265/h265_pps_parser.cc:
- Add empty statements for bits_tmp and golomb_ignored
  variables.
* Source/ThirdParty/libwebrtc/Source/webrtc/common_video/h265/h265_sps_parser.cc:
- Add empty statement for golomb_ignored variable.
* Source/ThirdParty/libwebrtc/WebKit/libwebrtc-fix-Wunused-but-set-variable.diff: Add.

Canonical link: https://commits.webkit.org/258956@main
  • Loading branch information
David Kilzer authored and jacek-manko-red committed Jul 30, 2024
1 parent b11c854 commit 523b2e6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ absl::optional<H265PpsParser::PpsState> H265PpsParser::ParseInternal(
// redundant_pic_cnt_present_flag: u(1)
pps.redundant_pic_cnt_present_flag = bit_buffer->ReadBits(1);

// Ignore -Wunused-but-set-variable warnings.
(void)bits_tmp;
(void)golomb_ignored;

return pps;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ absl::optional<H265SpsParser::SpsState> H265SpsParser::ParseSpsUpToVui(Bitstream
}
// sps_seq_parameter_set_id: ue(v)
golomb_ignored = buffer->ReadExponentialGolomb();
(void)golomb_ignored; // Ignore -Wunused-but-set-variable warning.
// chrome_format_idc: ue(v)
chroma_format_idc = buffer->ReadExponentialGolomb();
if (chroma_format_idc == 3) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/common_video/h265/h265_pps_parser.cc b/Source/ThirdParty/libwebrtc/Source/webrtc/common_video/h265/h265_pps_parser.cc
index 6f13f3b807bb..1df2667d2eae 100644
--- a/Source/ThirdParty/libwebrtc/Source/webrtc/common_video/h265/h265_pps_parser.cc
+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/common_video/h265/h265_pps_parser.cc
@@ -172,6 +172,10 @@ absl::optional<H265PpsParser::PpsState> H265PpsParser::ParseInternal(
// redundant_pic_cnt_present_flag: u(1)
pps.redundant_pic_cnt_present_flag = bit_buffer->ReadBits(1);

+ // Ignore -Wunused-but-set-variable warnings.
+ (void)bits_tmp;
+ (void)golomb_ignored;
+
return pps;
}

diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/common_video/h265/h265_sps_parser.cc b/Source/ThirdParty/libwebrtc/Source/webrtc/common_video/h265/h265_sps_parser.cc
index f4628ad63eeb..0d157624f533 100644
--- a/Source/ThirdParty/libwebrtc/Source/webrtc/common_video/h265/h265_sps_parser.cc
+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/common_video/h265/h265_sps_parser.cc
@@ -128,6 +128,7 @@ absl::optional<H265SpsParser::SpsState> H265SpsParser::ParseSpsUpToVui(Bitstream
}
// sps_seq_parameter_set_id: ue(v)
golomb_ignored = buffer->ReadExponentialGolomb();
+ (void)golomb_ignored; // Ignore -Wunused-but-set-variable warning.
// chrome_format_idc: ue(v)
chroma_format_idc = buffer->ReadExponentialGolomb();
if (chroma_format_idc == 3) {

0 comments on commit 523b2e6

Please sign in to comment.