RFR: 8204967: Resolve disabled warnings for libunpack

Srinivas Dama srinivas.dama at oracle.com
Fri Jun 15 04:45:52 UTC 2018


Hi Magnus/Jim,

Thank you for the comments.
Here is the latest webrev with suggested changes:
webrev: http://cr.openjdk.java.net/~sdama/8204967/webrev.01/
Bug: https://bugs.openjdk.java.net/browse/JDK-8204967

Jim,
gnu c supports -Wimplicit-fallthrough=3.
clang takes -Wimplicit-fallthrough without any parameters and ignores it without any effect.
clang++ works with -Wimplicit-fallthrough along with -std=c++11(it is cpp specific option)

Note: My earlier fix http://cr.openjdk.java.net/~sdama/8204967/webrev.00/ broke linux
build because some switch case statements which are having implicit-fallthroughs will be enabled
only in debug build(src/jdk.pack/share/native/common-unpack/unpack.cpp)
Earlier,I missed to fix those so debug build failed in linux.

Regards,
Srinivas

----- Original Message -----
From: magnus.ihse.bursie at oracle.com
To: srinivas.dama at oracle.com, core-libs-dev at openjdk.java.net
Sent: Thursday, 14 June, 2018 3:23:23 PM GMT +05:30 Chennai, Kolkata, Mumbai, New Delhi
Subject: Re: RFR: 8204967: Resolve disabled warnings for libunpack

On 2018-06-13 18:57, Srinivas Dama wrote:
> Hi,
>
> Please review http://cr.openjdk.java.net/~sdama/8204967/webrev.00/
> for https://bugs.openjdk.java.net/browse/JDK-8204967

Hi Srinivas,

In src/jdk.pack/share/native/common-unpack/zip.cpp, you just read and 
discard the return value from fread to hide the warning. But the purpose 
of the warning is to point out that this kind of code is incorrect. The 
proper fix would be to check the return code from fread to make sure 
that the read did not fail. Otherwise you're just making it impossible 
for the compiler to point out the badly written code, and if you're not 
going to fix this properly, it's better to keep the warning (that way we 
know the code is fishy).

/Magnus

>
> Regards,
> Srinivas



More information about the core-libs-dev mailing list