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

Submitter:  David Fernandez <david0fc>
Submitted:  Fri 29 Jan 2016 04:39:09 PM UTC
   
 
Category:  pbufs Severity:  3 - Normal
Item Group:  Compiler Warning Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned 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>
Group administrator
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>
Group Member
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>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-02-09 dziegel StatusNone Fixed
        Open/ClosedOpen Closed
    2016-01-30 axellin Attached File- Added 0001-stats-Add-proper-if-guard-to-prevent-unused-variable.patch, #36202
    2016-01-29 david0fc Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code