xref: /aosp_15_r20/external/angle/build/config/dcheck_always_on.gni (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard Worker# Copyright 2016 The Chromium Authors
2*8975f5c5SAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license that can be
3*8975f5c5SAndroid Build Coastguard Worker# found in the LICENSE file.
4*8975f5c5SAndroid Build Coastguard Worker
5*8975f5c5SAndroid Build Coastguard Worker# TODO(crbug.com/40191347): Until the bug is resolved we need to include
6*8975f5c5SAndroid Build Coastguard Worker# gclient_args for the definition of build_with_chromium and build_overrides
7*8975f5c5SAndroid Build Coastguard Worker# for client overrides of that flag. The latter should go away.
8*8975f5c5SAndroid Build Coastguard Workerimport("//build/config/gclient_args.gni")
9*8975f5c5SAndroid Build Coastguard Workerimport("//build_overrides/build.gni")
10*8975f5c5SAndroid Build Coastguard Workerdeclare_args() {
11*8975f5c5SAndroid Build Coastguard Worker  # Enables DCHECKs to be built-in, but to default to being non-fatal/log-only.
12*8975f5c5SAndroid Build Coastguard Worker  # DCHECKS can then be set as fatal/non-fatal via the "DcheckIsFatal" feature.
13*8975f5c5SAndroid Build Coastguard Worker  # See https://bit.ly/dcheck-albatross for details on how this is used.
14*8975f5c5SAndroid Build Coastguard Worker  dcheck_is_configurable = false
15*8975f5c5SAndroid Build Coastguard Worker}
16*8975f5c5SAndroid Build Coastguard Worker
17*8975f5c5SAndroid Build Coastguard Workerdeclare_args() {
18*8975f5c5SAndroid Build Coastguard Worker  # Set to false to disable DCHECK in Release builds. This is enabled by default
19*8975f5c5SAndroid Build Coastguard Worker  # for non-official builds on the below platforms.
20*8975f5c5SAndroid Build Coastguard Worker  # This default only affects Chromium as indicated by build_with_chromium.
21*8975f5c5SAndroid Build Coastguard Worker  # Other clients typically set this to false. If another client wants to use
22*8975f5c5SAndroid Build Coastguard Worker  # the same default value as Chromium, we'd need to add a separate gclient
23*8975f5c5SAndroid Build Coastguard Worker  # variable to replace build_with_chromium here.
24*8975f5c5SAndroid Build Coastguard Worker  dcheck_always_on =
25*8975f5c5SAndroid Build Coastguard Worker      (build_with_chromium && !is_official_build) || dcheck_is_configurable
26*8975f5c5SAndroid Build Coastguard Worker}
27*8975f5c5SAndroid Build Coastguard Worker
28*8975f5c5SAndroid Build Coastguard Workerdeclare_args() {
29*8975f5c5SAndroid Build Coastguard Worker  # Set to false to disable EXPENSIVE_DCHECK()s or to true to enable them in
30*8975f5c5SAndroid Build Coastguard Worker  # official builds. These are generally used for really useful DCHECKs that are
31*8975f5c5SAndroid Build Coastguard Worker  # too expensive to be enabled in user-facing official+DCHECK builds.
32*8975f5c5SAndroid Build Coastguard Worker  enable_expensive_dchecks =
33*8975f5c5SAndroid Build Coastguard Worker      is_debug || (dcheck_always_on && !is_official_build)
34*8975f5c5SAndroid Build Coastguard Worker}
35*8975f5c5SAndroid Build Coastguard Worker
36*8975f5c5SAndroid Build Coastguard Workerassert(!dcheck_is_configurable || (dcheck_always_on || is_debug),
37*8975f5c5SAndroid Build Coastguard Worker       "dcheck_is_configurable only makes sense with DCHECKs enabled")
38*8975f5c5SAndroid Build Coastguard Workerassert(!enable_expensive_dchecks || (dcheck_always_on || is_debug),
39*8975f5c5SAndroid Build Coastguard Worker       "enable_expensive_dchecks only makes sense with DCHECKs enabled")
40