Wireshark mailing list archives

Re: packet-ncp2222.c missing some info_string_t references


From: Alexis La Goutte <alexis.lagoutte () gmail com>
Date: Tue, 22 Sep 2015 20:13:54 +0200

Hi Jim (and Michael)

It is already detect by Petri Dish but need to check log...

packet-ncp2222.c:7885:28: warning: unused variable 'info_str_0xc_req'
[-Wunused-const-variable]
packet-ncp2222.c:7903:28: warning: unused variable
'info_str_0x1109_req' [-Wunused-const-variable]
packet-ncp2222.c:7921:28: warning: unused variable
'info_str_0x1509_req' [-Wunused-const-variable]
...

Wunused-const-variable is no enable by default on Ubuntu buildbot..
(or may be using a old release of Clang)

Regards,

On Tue, Sep 22, 2015 at 11:29 AM, Jim Young <jyoung () gsu edu> wrote:


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.
___________________________________________________________________________
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

___________________________________________________________________________
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: