Wireshark mailing list archives

packet-ncp2222.c missing some info_string_t references


From: Jim Young <jyoung () gsu edu>
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.

Attachment: clang-Wunused-const-variable.txt
Description: clang-Wunused-const-variable.txt

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: