libpcap icon indicating copy to clipboard operation
libpcap copied to clipboard

Remove redundant assigning of p1 to prev

Open AZero13 opened this issue 2 years ago • 6 comments

This assignment is redundant, as the assignment to prev from p1 happens after the if statement anyway.

This was found by clang-tidy emitting the following warning: "Value stored to 'prev' is never read", as prev is reassigned to the same expression once outside the if-statement.

AZero13 avatar May 16 '23 16:05 AZero13

This fixes compiler warnings [...]

A copy of the warning message should be added in the body of the commit message with the compiler name and version.

fxlb avatar May 16 '23 20:05 fxlb

@fxlb Done!

AZero13 avatar May 17 '23 14:05 AZero13

I wonder why make -s CFLAGS=-Werror didn't produce this warning using Clang 16.0.1. Did you use custom CFLAGS or anything else to get this warning?

infrastation avatar May 17 '23 21:05 infrastation

A forced build? Because doc/README.sita states:

NOTE: this is not currently supported; the configure script doesn't
support --with-sita, and CMake doesn't support enabling SITA ACN
support.  The code currently does not compile; it should really be
implemented as an additional remote capture mechanism, using a URL,
rather than as a separate version of libpcap that supports only the ACN
product, but the infrastructure for that isn't yet available.

Not sure there is a need to take care of this source file at this time.

fxlb avatar May 18 '23 10:05 fxlb

Oh, the warning is in that file, not in the one I thought.

infrastation avatar May 18 '23 20:05 infrastation

@fxlb @infrastation Any updates on this? I get "Value stored to 'p1' is never read" from clang-tidy.

AZero13 avatar May 30 '23 15:05 AZero13

Trying to compile pcap-sita.c yields 15 warnings and 2 errors. The redundant assignment is the least of its problems. Let's not waste time on this file until someone is ready to fix and test it or it is clear it has no purpose and can be retired.

infrastation avatar Feb 26 '24 12:02 infrastation