Gentoo Archives: gentoo-dev

From: Mike Gilbert <floppym@g.o>
To: gentoo-dev@l.g.o
Cc: kde@g.o, Mike Gilbert <floppym@g.o>
Subject: [gentoo-dev] [PATCH] cmake.eclass: do not append -DNDEBUG to CPPFLAGS
Date: Mon, 30 Mar 2020 01:03:30
Message-Id: 20200330010306.21355-1-floppym@gentoo.org
1 The NDEBUG macro turns the assert() function into a noop. This gives a
2 small performance boost, but may allow subtle programming errors to go
3 unnoticed.
4
5 This code was added back in 2008, when we started passing
6 -DCMAKE_BUILD_TYPE=None instead of Release or Debug. It probably tries
7 to mimic a default behavior of Release type builds.
8
9 Other common build systems do not do this by default. For example,
10 autoconf's AC_HEADER_ASSERT macro only sets NDEBUG if --disable-assert
11 is passed to configure (it defaults to enabled).
12
13 It is better to let users add this to CPPFLAGS themselves if they really
14 want to save those few CPU cycles.
15
16 Signed-off-by: Mike Gilbert <floppym@g.o>
17 ---
18 eclass/cmake.eclass | 9 ---------
19 1 file changed, 9 deletions(-)
20
21 diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
22 index 160f40b1cf8e..3da3b9aeb555 100644
23 --- a/eclass/cmake.eclass
24 +++ b/eclass/cmake.eclass
25 @@ -371,15 +371,6 @@ cmake_src_configure() {
26 # Fix xdg collision with sandbox
27 xdg_environment_reset
28
29 - # @SEE CMAKE_BUILD_TYPE
30 - if [[ ${CMAKE_BUILD_TYPE} = Gentoo ]]; then
31 - # Handle release builds
32 - if ! in_iuse debug || ! use debug; then
33 - local CPPFLAGS=${CPPFLAGS}
34 - append-cppflags -DNDEBUG
35 - fi
36 - fi
37 -
38 # Prepare Gentoo override rules (set valid compiler, append CPPFLAGS etc.)
39 local build_rules=${BUILD_DIR}/gentoo_rules.cmake
40
41 --
42 2.26.0.rc2

Replies