[Asterisk-code-review] various: Fix GCC 11 compilation issues. (asterisk[master])

George Joseph asteriskteam at digium.com
Wed Oct 20 06:50:30 CDT 2021


Attention is currently required from: Michael Bradeen, Kevin Harwell.
George Joseph has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/16571 )

Change subject: various: Fix GCC 11 compilation issues.
......................................................................


Patch Set 6: Code-Review-1

(3 comments)

Commit Message:

https://gerrit.asterisk.org/c/asterisk/+/16571/comment/baae4ae9_ae9024a7 
PS5, Line 12: test_linkedlist: 'bogus' variable was manually allocated from a macro, and the
            : test fails if this happens but the compiler couldn't 'see' this and returns a
            : warning. 'stackbogus' variable used instead for the warned test instead.
            : chan_ooh323: Fixed various indentation issues that triggered misleading indentation
            : warnings.
            : 
> Long lines.  Keep them under 72. […]
Done


File addons/ooh323c/src/ooh323.c:

https://gerrit.asterisk.org/c/asterisk/+/16571/comment/0f4e0157_ea66f811 
PS5, Line 1069:       }
              : 	   if (call->h225version >= 4) {
              : 		   ret =ooSendTCSandMSD(call);
              : 	   }
              : 	   if (ret != OO_OK) {
              : 		   return ret;
              :       }
> More mess (not your doing). […]
Done


File tests/test_linkedlists.c:

https://gerrit.asterisk.org/c/asterisk/+/16571/comment/536655a1_478fa60f 
PS6, Line 190: 	if (AST_LIST_REMOVE(&test_list, &stackbogus, list)) {
> This is an odd one indeed. Do you know why it complains about this one, but not for the same call above (the one just after the alloca call)?

After looking a little more at this I think the issue is that 'bogus' was never initialized with zeros.  When the first call to AST_LIST_REMOVE is done there have been no operations on the list and I think the compiler is keeping track of that so the fact that bogus is, well, bogus, in that first call is ignored.  As soon as you add an item to the list then try to traverse it (MATCH_OR_FAIL/list_expect) the compiler now cares and the next time you try to use bogus, it barfs.

Rather than adding stackbogus, I think the correct solution is to just initialize bogus right after the call to ast_alloca...
memset(bogus, 0, sizeof(*bogus));

Compile and test work fine after that.



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16571
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: If4fe42222c8444dc16828a42731ee53b4ce5cbbe
Gerrit-Change-Number: 16571
Gerrit-PatchSet: 6
Gerrit-Owner: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Sean Bright <sean at seanbright.com>
Gerrit-CC: Kevin Harwell <kharwell at digium.com>
Gerrit-Attention: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-Attention: Kevin Harwell <kharwell at digium.com>
Gerrit-Comment-Date: Wed, 20 Oct 2021 11:50:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: George Joseph <gjoseph at digium.com>
Comment-In-Reply-To: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20211020/8cdbdbdb/attachment.html>


More information about the asterisk-code-review mailing list