Wireshark-dev: [Wireshark-dev] packet-ncp2222.c missing some info_string_t references
From: Jim Young <jyoung@xxxxxxx>
Date: Tue, 22 Sep 2015 09:29:11 +0000
Hello Michael, Absolutely amazing how much effort you must have put into your "Journey of a thousand miles". But it looks like we have a regression with regards to commit 38b6f306: Refactor NCP Python data so that INFO column can be generated on the fly. Not all of info_string_t objects defined in packet-ncp2222.c are referenced. On my OS X system, Apple's clang compiler is failing to compile packet-ncp2222.c because of the clang compiler option -Wunused-const-variable. I'm seeing messages similar to the following (see attached for more context): > error: unused variable 'info_str_0xc_req' Currently there are 207 info_string_t objects created by ./tools/ncp2222.py in packet-ncp2222.c, but 43 of these no longer have any references. If I revert the three files modified by commit 38b6f306 I see references to all 207 info_string_t objects. Here's a quick-and-dirty bash "one-liner" that I used to extract the orphaned info_str objects. for i in $(grep 'static const info_string_t' packet-ncp2222.c | awk '{ print $4 }') do echo -n "$i :" grep $i packet-ncp2222.c | wc -l done | egrep ' 1$' This "one-liner" makes multiple passes over the file packet-ncp2222.c. First it simply extracts all the info_string_t objects. In the main loop, after echoing the current info_string_t item, it greps for any lines having a specific info_string_t object name and pipes that output to wc -l to get a count of matching lines. The output of the loop is then piped to egrep to select just the items where a single matching line was found (which implies a definition but no usage). I haven't (yet) been able to understand enough about how ./tools/ncp2222.py python script goes about its magic when generating packet-ncp2222.c to determine why 43 of the 207 info_string_t definitions no longer have references. But I'm guessing you might have a much better clue than me. Best regards, Jim Y.
[ 7%] Building C object epan/CMakeFiles/epan.dir/packet-ncp2222.c.o /projects/wireshark/epan/packet-ncp2222.c:7882:28: error: unused variable 'info_str_0xc_req' [-Werror,-Wunused-const-variable] static const info_string_t info_str_0xc_req = { ^ /projects/wireshark/epan/packet-ncp2222.c:7900:28: error: unused variable 'info_str_0x1109_req' [-Werror,-Wunused-const-variable] static const info_string_t info_str_0x1109_req = { ^ /projects/wireshark/epan/packet-ncp2222.c:7918:28: error: unused variable 'info_str_0x1509_req' [-Werror,-Wunused-const-variable] static const info_string_t info_str_0x1509_req = { ^ /projects/wireshark/epan/packet-ncp2222.c:7966:28: error: unused variable 'info_str_0x1606_req' [-Werror,-Wunused-const-variable] static const info_string_t info_str_0x1606_req = { ^ /projects/wireshark/epan/packet-ncp2222.c:8008:28: error: unused variable 'info_str_0x1611_req' [-Werror,-Wunused-const-variable] static const info_string_t info_str_0x1611_req = { ^ /projects/wireshark/epan/packet-ncp2222.c:8020:28: error: unused variable 'info_str_0x1613_req' [-Werror,-Wunused-const-variable] static const info_string_t info_str_0x1613_req = { ^ /projects/wireshark/epan/packet-ncp2222.c:8026:28: error: unused variable 'info_str_0x1614_req' [-Werror,-Wunused-const-variable] static const info_string_t info_str_0x1614_req = { ^ /projects/wireshark/epan/packet-ncp2222.c:8032:28: error: unused variable 'info_str_0x1615_req' [-Werror,-Wunused-const-variable] static const info_string_t info_str_0x1615_req = { ^ /projects/wireshark/epan/packet-ncp2222.c:8038:28: error: unused variable 'info_str_0x1616_req' [-Werror,-Wunused-const-variable] static const info_string_t info_str_0x1616_req = { ^ /projects/wireshark/epan/packet-ncp2222.c:8044:28: error: unused variable 'info_str_0x1617_req' [-Werror,-Wunused-const-variable] static const info_string_t info_str_0x1617_req = { ^ /projects/wireshark/epan/packet-ncp2222.c:8086:28: error: unused variable 'info_str_0x162a_req' [-Werror,-Wunused-const-variable] static const info_string_t info_str_0x162a_req = { ^ /projects/wireshark/epan/packet-ncp2222.c:8098:28: error: unused variable 'info_str_0x162c_req' [-Werror,-Wunused-const-variable] static const info_string_t info_str_0x162c_req = { ^ /projects/wireshark/epan/packet-ncp2222.c:8110:28: error: unused variable 'info_str_0x162f_req' [-Werror,-Wunused-const-variable] static const info_string_t info_str_0x162f_req = { ^ /projects/wireshark/epan/packet-ncp2222.c:8128:28: error: unused variable 'info_str_0x1633_req' [-Werror,-Wunused-const-variable] static const info_string_t info_str_0x1633_req = { ^ /projects/wireshark/epan/packet-ncp2222.c:8152:28: error: unused variable 'info_str_0x1703_req' [-Werror,-Wunused-const-variable] static const info_string_t info_str_0x1703_req = { ^ /projects/wireshark/epan/packet-ncp2222.c:8164:28: error: unused variable 'info_str_0x170d_req' [-Werror,-Wunused-const-variable] static const info_string_t info_str_0x170d_req = { ^ /projects/wireshark/epan/packet-ncp2222.c:8182:28: error: unused variable 'info_str_0x1713_req' [-Werror,-Wunused-const-variable] static const info_string_t info_str_0x1713_req = { ^ /projects/wireshark/epan/packet-ncp2222.c:8236:28: error: unused variable 'info_str_0x1735_req' [-Werror,-Wunused-const-variable] static const info_string_t info_str_0x1735_req = { ^ /projects/wireshark/epan/packet-ncp2222.c:8308:28: error: unused variable 'info_str_0x1742_req' [-Werror,-Wunused-const-variable] static const info_string_t info_str_0x1742_req = { ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. make[2]: *** [epan/CMakeFiles/epan.dir/packet-ncp2222.c.o] Error 1 make[1]: *** [epan/CMakeFiles/epan.dir/all] Error 2 make: *** [all] Error 2
- Follow-Ups:
- Re: [Wireshark-dev] packet-ncp2222.c missing some info_string_t references
- From: Alexis La Goutte
- Re: [Wireshark-dev] packet-ncp2222.c missing some info_string_t references
- Prev by Date: Re: [Wireshark-dev] The journey of a thousand miles...
- Next by Date: Re: [Wireshark-dev] The journey of a thousand miles...
- Previous by thread: Re: [Wireshark-dev] proto_tree_add_text - what's next (was: The journey of a thousand miles...)
- Next by thread: Re: [Wireshark-dev] packet-ncp2222.c missing some info_string_t references
- Index(es):