<p>Joshua Colp <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14377">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
  Kevin Harwell: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_voicemail: Add workaround for a gcc 10 issue with -Wrestrict<br><br>The gcc 10 -Wrestrict option was causing "overlap" errors when<br>snprintf was copying one char[256] structure member to another<br>char[256] member in the same structure.<br><br>Using ast_alloca instead of declaring the structure inline<br>solves the issue.<br><br>Here's a link to the "enhancement":<br>https://gcc.gnu.org/legacy-ml/gcc-patches/2019-10/msg00570.html<br><br>We may follow up with a gcc bug report.<br><br>Change-Id: Ie0099adcb0a9727bd9aa99e024dd912a67eaf534<br>---<br>M apps/app_voicemail.c<br>1 file changed, 8 insertions(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c</span><br><span>index 7dbebdd..0b14934 100644</span><br><span>--- a/apps/app_voicemail.c</span><br><span>+++ b/apps/app_voicemail.c</span><br><span>@@ -14534,6 +14534,12 @@</span><br><span>       return res ? AST_TEST_FAIL : AST_TEST_PASS;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+struct test_files {</span><br><span style="color: hsl(120, 100%, 40%);">+     char dir[256];</span><br><span style="color: hsl(120, 100%, 40%);">+        char file[256];</span><br><span style="color: hsl(120, 100%, 40%);">+       char txtfile[256];</span><br><span style="color: hsl(120, 100%, 40%);">+};</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> AST_TEST_DEFINE(test_voicemail_msgcount)</span><br><span> {</span><br><span>    int i, j, res = AST_TEST_PASS, syserr;</span><br><span>@@ -14543,11 +14549,8 @@</span><br><span> #ifdef IMAP_STORAGE</span><br><span>     struct ast_channel *chan = NULL;</span><br><span> #endif</span><br><span style="color: hsl(0, 100%, 40%);">-      struct {</span><br><span style="color: hsl(0, 100%, 40%);">-                char dir[256];</span><br><span style="color: hsl(0, 100%, 40%);">-          char file[256];</span><br><span style="color: hsl(0, 100%, 40%);">-         char txtfile[256];</span><br><span style="color: hsl(0, 100%, 40%);">-      } tmp[3];</span><br><span style="color: hsl(120, 100%, 40%);">+     /* Using ast_alloca instead of just declaring tmp as an array is a workaround for a GCC 10 issue with -Wrestrict */</span><br><span style="color: hsl(120, 100%, 40%);">+   struct test_files *tmp = ast_alloca(sizeof(struct test_files) * 3);</span><br><span>  char syscmd[256];</span><br><span>    const char origweasels[] = "tt-weasels";</span><br><span>   const char testcontext[] = "test";</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14377">change 14377</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/14377"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ie0099adcb0a9727bd9aa99e024dd912a67eaf534 </div>
<div style="display:none"> Gerrit-Change-Number: 14377 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>