RFR: 8254072: AArch64: Get rid of --disable-warnings-as-errors on Windows+ARM64 build [v2]
Bernhard Urban-Forster
burban at openjdk.java.net
Thu Oct 15 18:42:10 UTC 2020
On Thu, 15 Oct 2020 09:57:14 GMT, Andrew Haley <aph at openjdk.org> wrote:
> Fine, but please assert JavaThread::stack_shadow_zone_size() == (int)JavaThread::stack_shadow_zone_size().
Done.
> Adding casts to shut up compilers is a very risky business, because often (if not in this case) the programmer doesn't
> understand the code well, and sprinkles casts everywhere. But casts disable compile-time type checking, and this leads
> to risks for future maintainability.
Full ACK and I appreciate your comments on this!
> I wonder if we should fix it in a better way, and use something like
> this in the future for all compiler warnings:
>
> ```
> template <typename T1, typename T2>
> T1 checked_cast(T2 thing) {
> T1 result = static_cast<T1>(thing);
> guarantee(static_cast<T2>(result) == thing, "must be");
> return result;
> }
> ```
>
> I know this is additional work, but I promise we'll never need to have this conversation again.
This sounds like a great idea to me. I assume it doesn't fit into the scope of this PR, therefore I've created
[JDK-8254856](https://bugs.openjdk.java.net/browse/JDK-8254856) to track it.
-------------
PR: https://git.openjdk.java.net/jdk/pull/530
More information about the build-dev
mailing list