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