[glib/mcatanzaro/plain-build-cast-checks] Disable cast checks in plain builds
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/mcatanzaro/plain-build-cast-checks] Disable cast checks in plain builds
- Date: Tue, 13 Sep 2022 20:20:05 +0000 (UTC)
commit fdb3dbb16bf48a54fa51cc35f2def62494af9b6b
Author: Michael Catanzaro <mcatanzaro redhat com>
Date: Tue Sep 13 15:15:24 2022 -0500
Disable cast checks in plain builds
This is a follow-up to !2851. I notice that we are following Meson's
optimization option a little too religiously here. Problem is, this
option only indicates whether Meson itself adds optimization flags: it
does not indicate whether the build should be optimized because it will
be set to 0 for plain builds, but plain builds are production builds and
are expected to be optimized.
The fix is easy: if we are not a debug build, then we're a production
build. Always define the flags for one way or the other.
This improves adherence to
https://blogs.gnome.org/mcatanzaro/2022/07/15/best-practices-for-build-options/
Rule 6.
meson.build | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/meson.build b/meson.build
index f44fa2d4e7..81ed0efc26 100644
--- a/meson.build
+++ b/meson.build
@@ -298,11 +298,10 @@ endif
# optimization is 0 or g; otherwise, we have a production build.
glib_debug_cflags = []
glib_debug = get_option('glib_debug')
-optimized_build = get_option('optimization') not in [ '0', 'g' ]
-if glib_debug.enabled() or (glib_debug.auto() and get_option('debug') and not optimized_build)
+if glib_debug.enabled() or (glib_debug.auto() and get_option('debug') and get_option('optimization') in [
'0', 'g' ])
glib_debug_cflags += ['-DG_ENABLE_DEBUG']
message('Enabling various debug infrastructure')
-elif optimized_build
+else
glib_debug_cflags += ['-DG_DISABLE_CAST_CHECKS']
message('Disabling cast checks')
endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]