[SLOF] [PATCH slof 08/13] libnet: Compile with -Wextra
Thomas Huth
thuth at redhat.com
Fri Jan 29 17:42:14 AEDT 2021
On 29/01/2021 02.59, Alexey Kardashevskiy wrote:
>
>
> On 29/01/2021 02:19, Thomas Huth wrote:
>> On 27/01/2021 09.57, Alexey Kardashevskiy wrote:
>>> -Wextra enables a bunch of rather useful checks which this fixes.
[...]
>>> diff --git a/slof/ppc64.c b/slof/ppc64.c
>>> index 83a8e82cfb42..ca6cafffc35d 100644
>>> --- a/slof/ppc64.c
>>> +++ b/slof/ppc64.c
>>> @@ -144,6 +144,12 @@ int socket(int domain, int type, int proto, char
>>> *mac_addr)
>>> int prop_len;
>>> int fd;
>>> + if (!(domain == AF_INET || domain == AF_INET6))
>>
>> Better:
>>
>> if (domain != AF_INET && domain != AF_INET6))
>
> No it is not :)
>
>>
>>> + return -1;
>>> +
>>> + if (type != SOCK_DGRAM || proto != 0)
>>> + return -1;
>>
>> I think these changes are not necessary anymore since you're compiling
>> with -Wno-unused-parameter ... so either drop these or put them into a
>> separate patch?
>
>
> Well, it is also self documenting what we do implement in slof. And a little
> bit less work when I remove -Wno-unused-parameter later. I'll make it a
> separate patch. Thanks,
I'd rather vote for keeping -Wno-unused-parameter. Otherwise you're always
forced to write silly code or use __attribute__((unused)) when a function
has to match a certain parameter list, e.g. because it is used as a function
pointer later, and that's rather annoying.
Thomas
More information about the SLOF
mailing list