RFR 8027059: (sctp) fatal warnings overly restrictive with gcc 4.8.1
Chris Hegarty
chris.hegarty at oracle.com
Wed Oct 23 08:47:47 UTC 2013
On 22/10/2013 22:05, Magnus Ihse Bursie wrote:
> On 2013-10-22 20:44, Chris Hegarty wrote:
>> The SCTP native code complies with -Werror. gcc 4.8.1 reports unused
>> parameters as warnings, and this causes the build to fail. gcc 4.8.1
>> is the defaul on Ubuntu 13.10.
>
> An alternative solution is to keep the warning but fix the code.
Thanks Magnus, of course this kind of change is always going to be
subjective.
> The traditional solution is to cast the unused variable/parameter to
> void, typically accompanied with a comment describing why we keep it
> even though it is unused, e.g. something like
> (void) klass; // this is a formal JNI parameter which we don't use
This certainly has merit. I personally don't like it, but maintainers of
other areas may.
> However, it can very well be argued if this is indeed better than just
> disabling the warning. After all, it's a question of how to balance
> different kinds of code quality. If we have a lot of places were formal
> parameters like this, it might lead to worse code quality by littering
> it with void casts.
Right, I agree with this.
> I just wanted to point out an alternative, I'm not protesting against
> your solution.
Thanks Magnus.
Since SCTP is the only native library code currently compiling with
Werror, I'm quite happy to suppress this single warning, though it would
be nice to be able to suppress it at a per function level.
-Chris.
>
> /Magnus
>
>>
>> These parameters are required as the functions are JNI functions. The
>> simplest solution is to ignore/suppress these unused param warnings.
>>
>> See discussion on:
>> http://mail.openjdk.java.net/pipermail/build-dev/2013-July/009513.html
>>
>> diff --git a/makefiles/lib/NioLibraries.gmk
>> b/makefiles/lib/NioLibraries.gmk
>> --- a/makefiles/lib/NioLibraries.gmk
>> +++ b/makefiles/lib/NioLibraries.gmk
>> @@ -150,7 +150,7 @@
>>
>> ifneq ($(OPENJDK_TARGET_OS), macosx)
>>
>> - SCTP_WERROR := -Werror
>> + SCTP_WERROR := -Werror -Wno-error=unused-parameter
>> ifeq ($(OPENJDK_TARGET_CPU_ARCH), ppc)
>> SCTP_WERROR :=
>> endif
>>
>> With this change it may be possible to remove the special casing of
>> ppc? I would need to check, but this could be handled separately.
>>
>> -Chris.
>
More information about the build-dev
mailing list