Wireshark-dev: Re: [Wireshark-dev] New GCC, new option required?
From: Guy Harris <[email protected]>
Date: Wed, 13 Jul 2011 16:38:59 -0700
On Jul 13, 2011, at 7:23 AM, Bill Meier wrote:

> On 7/13/2011 8:05 AM, Jaap Keuter wrote:
>> Hi list,
>> 
>> I think we need a new GCC option added to configure.in:
>> 
>> AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-unused-but-set-variable)
>> 
>> This option came into existence with GCC 4.6 and is causing havoc all over.
>> I've been going through a lot of dissectors, many of which have either:
>> * unused set variables
>> * variables set for a legitimate purpose, but not used (yet)
>> * bugs
>> 
> 
> I've fixes for a number of the (non-generated) dissectors and will commit them today.

Haven't you (and maybe others) been fixing the same issues already, as a result of Coverity warnings about the same thing?

And how many of those are

static void
dissect_whatever(...)
{

		...

	proto_tree_add_item(tree, hf_foo, tvb, offset, len_foo, encoding);
	offset += len_foo;
	proto_tree_add_item(tree, hf_bar, tvb, offset, len_bar, encoding);
	offset += len_bar;
}

and how many of those ultimately represent dissectors that should be converted to use ptvcursors, in which case the "offset +=" stuff will disappear into the ptvcursor code and not get whined about by dataflow analyzers?