patch to get rid of the warning:
On Thu, May 25, 2023 at 12:16 PM Andy Tai <a...@atai.org> wrote: > > Hi, I found from GNU Guix's build check that when building with gcc 11, > > building hubbub would fail when building tests with errors like > > COMPILE: test/tokeniser2.c > COMPILE: test/tokeniser3.c > COMPILE: test/tree.c > COMPILE: test/tree2.c > COMPILE: test/tree-buf.c > test/tokeniser2.c: In function ‘token_handler’: > test/tokeniser2.c:444:46: error: ‘t.data.character.ptr’ may be used > uninitialized [-Werror=maybe-uninitialized] > 444 | t.data.character.ptr += len; > | ^~ > test/tokeniser2.c:441:38: note: ‘t’ declared here > 441 | hubbub_token t; > | ^ > test/tokeniser2.c:445:46: error: ‘t.data.character.len’ may be used > uninitialized [-Werror=maybe-uninitialized] > 445 | t.data.character.len -= len; > | ^~ > > ... > > I briefly took a look of the test source code in question and the > hubbub_token structs seem not explicitly initialized. Is this a real > warning from gcc of possibly uninitialized variable which can cause > the build to fail if allow warnings are treated as errors by gcc > during build (a common practice)? Thanks if maintainer can take a > look. > > relevant bug entry and complete bug logs: > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63526 -- Andy Tai, a...@atai.org, Skype: licheng.tai, Line: andy_tai, WeChat: andytai1010 Year 2023 民國112年 自動的精神力是信仰與覺悟 自動的行為力是勞動與技能
From 69d81a8a4d4c223aad67cde0fdf64d64351b9802 Mon Sep 17 00:00:00 2001 From: Andy Tai <a...@atai.org> Date: Sat, 27 May 2023 00:01:34 -0700 Subject: [PATCH] prevent -Werror=maybe-uninitialized build failure with gcc 11 when building tests tokeniser2 and tokeniser3 --- test/tokeniser2.c | 2 +- test/tokeniser3.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/tokeniser2.c b/test/tokeniser2.c index c8ab9c0..4caae38 100644 --- a/test/tokeniser2.c +++ b/test/tokeniser2.c @@ -438,7 +438,7 @@ hubbub_error token_handler(const hubbub_token *token, void *pw) /* Expected token only contained part of the data * Calculate how much is left, then try again with * the next expected token */ - hubbub_token t; + hubbub_token t = { 0 }; t.type = HUBBUB_TOKEN_CHARACTER; t.data.character.ptr += len; diff --git a/test/tokeniser3.c b/test/tokeniser3.c index e33d018..b3be901 100644 --- a/test/tokeniser3.c +++ b/test/tokeniser3.c @@ -447,7 +447,7 @@ hubbub_error token_handler(const hubbub_token *token, void *pw) /* Expected token only contained part of the data * Calculate how much is left, then try again with * the next expected token */ - hubbub_token t; + hubbub_token t = { 0 }; t.type = HUBBUB_TOKEN_CHARACTER; t.data.character.ptr += len; -- 2.40.1
_______________________________________________ netsurf-dev mailing list -- netsurf-dev@netsurf-browser.org To unsubscribe send an email to netsurf-dev-le...@netsurf-browser.org