Skip to content

Fix build when G_DISABLE_CAST_CHECKS is defined to empty string

Michael Catanzaro requested to merge mcatanzaro/cast-checks-oopsie into main

The usual use of G_DISABLE_CAST_CHECKS is to define it without giving it a value. The value was never looked at until f946e45a, where I decided it would be cool to ignore it if defined to 0. But this broke the original usage, so we need to revert that.

I thought it would be a good idea to look at the value in order to give applications an off switch for the new behavior, so you could continue to build optimized builds with cast checks enabled. We could still try to find a way to do that in the future if desired, e.g. by introducing a new G_ENABLE_CAST_CHECKS definition. But this doesn't seem especially important. G_DISABLE_CAST_CHECKS is not documented anyway, so how we handle cast checks is entirely up to GLib.

Merge request reports