buglwIP - A Lightweight TCP/IP stack - Bugs: bug #47012, Builds may fail due to unused...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #47012: Builds may fail due to unused static variable memp_names in stats.c

Submitted by:  David Fernandez <david0fc>
Submitted on:  Fri 29 Jan 2016 04:39:09 PM UTC  
 
Category: pbufsSeverity: 3 - Normal
Item Group: Compiler WarningStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: ClosedPlanned Release: None
lwIP version: git head

Tue 09 Feb 2016 11:44:51 AM UTC, comment #2:

No feedback. Assuming problem is fixed.

Dirk Ziegelmeier <dziegel>
Project Member
Sat 30 Jan 2016 12:06:09 AM UTC, comment #1:

Hi David,
Can you test if attached patch works for you?
Thanks.

(file #36202)

Axel Lin <axellin>
Fri 29 Jan 2016 04:39:09 PM UTC, original submission:

The code changes for revision (sorry, I'm using hg plugin for git, so the hash is: 978321cd2f6c699b390c56b41b209b33b72dd4ec, and the unique hg changeset is: 978321cd2f6c):

2016-01-14 15:18:57 +0800


stats: Move memp_names table out of stats_init/stats_display_memp functions

This makes the code simpler with better readability.
Also make memp_names static because it's only referenced by stats.c.

Signed-off-by: Axel Lin <axel.lin@ingics.com>


Introduced this change:


@@ -49,15 +49,18 @@

struct stats_ lwip_stats;

+#if MEMP_STATS
+static const char * memp_names[] = {
+#define LWIP_MEMPOOL(name,num,size,desc) desc,
+#include "lwip/priv/memp_std.h"
+};
+#endif /* MEMP_STATS */
+


That defines memp_names on MEMP_STATS != 0, but the usages of this are under either LWIP_DEBUG in stats_init, or under LWIP_STATS_DISPLAY in stats_display_memp.

So, with the default values for all the macros here, it causes a warning:


lwip/src/core/stats.c:53:21: error: 'memp_names' defined but not used [-Werror=unused-variable]
static const char * memp_names[] = {
^
cc1: all warnings being treated as errors


In some build systems, the warnings are forbidden, and there are policies to avoid unneeded variables, and blah, blah, blah...

So, if any maintainer could sort this out when possible, that would be great.

I might be happy to submit a patch to the developers list myself, if you prefer that.

David Fernandez <david0fc>

 

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by dziegel (Posted a comment)
  • -unavailable- added by axellin (Updated the item)
  • -unavailable- added by david0fc (Submitted the item)
  • -unavailable- added by david0fc (Your change caused a compiler warning.)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 09 Feb 2016 11:44:51 AM UTCdziegelStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Sat 30 Jan 2016 12:06:09 AM UTCaxellinAttached File-=>Added 0001-stats-Add-proper-if-guard-to-prevent-unused-variable.patch, #36202
    Fri 29 Jan 2016 04:39:09 PM UTCdavid0fcCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1