1*d9f75844SAndroid Build Coastguard Worker# WebRTC coding style guide 2*d9f75844SAndroid Build Coastguard Worker 3*d9f75844SAndroid Build Coastguard Worker<?% config.freshness.owner = 'danilchap' %?> 4*d9f75844SAndroid Build Coastguard Worker<?% config.freshness.reviewed = '2022-01-17' %?> 5*d9f75844SAndroid Build Coastguard Worker 6*d9f75844SAndroid Build Coastguard Worker## General advice 7*d9f75844SAndroid Build Coastguard Worker 8*d9f75844SAndroid Build Coastguard WorkerSome older parts of the code violate the style guide in various ways. 9*d9f75844SAndroid Build Coastguard WorkerIf making large changes to such code, consider first cleaning it up in a 10*d9f75844SAndroid Build Coastguard Worker separate CL. 11*d9f75844SAndroid Build Coastguard Worker 12*d9f75844SAndroid Build Coastguard Worker## C++ 13*d9f75844SAndroid Build Coastguard Worker 14*d9f75844SAndroid Build Coastguard WorkerWebRTC follows the [Chromium C++ style guide][chr-style] and the 15*d9f75844SAndroid Build Coastguard Worker[Google C++ style guide][goog-style]. In cases where they conflict, the Chromium 16*d9f75844SAndroid Build Coastguard Workerstyle guide trumps the Google style guide, and the rules in this file trump them 17*d9f75844SAndroid Build Coastguard Workerboth. 18*d9f75844SAndroid Build Coastguard Worker 19*d9f75844SAndroid Build Coastguard Worker[chr-style]: https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++.md 20*d9f75844SAndroid Build Coastguard Worker[goog-style]: https://google.github.io/styleguide/cppguide.html 21*d9f75844SAndroid Build Coastguard Worker 22*d9f75844SAndroid Build Coastguard Worker### C++ version 23*d9f75844SAndroid Build Coastguard Worker 24*d9f75844SAndroid Build Coastguard WorkerWebRTC is written in C++17, but with some restrictions: 25*d9f75844SAndroid Build Coastguard Worker 26*d9f75844SAndroid Build Coastguard Worker* We only allow the subset of C++17 (language and library) that is not banned by 27*d9f75844SAndroid Build Coastguard Worker Chromium; see the [list of banned C++ features in Chromium][chr-style-cpp]. 28*d9f75844SAndroid Build Coastguard Worker* We only allow the subset of C++17 that is also valid C++20; otherwise, users 29*d9f75844SAndroid Build Coastguard Worker would not be able to compile WebRTC in C++20 mode. 30*d9f75844SAndroid Build Coastguard Worker 31*d9f75844SAndroid Build Coastguard Worker[chr-style-cpp]: https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++-features.md 32*d9f75844SAndroid Build Coastguard Worker 33*d9f75844SAndroid Build Coastguard Worker### Abseil 34*d9f75844SAndroid Build Coastguard Worker 35*d9f75844SAndroid Build Coastguard WorkerYou may use a subset of the utilities provided by the [Abseil][abseil] library 36*d9f75844SAndroid Build Coastguard Workerwhen writing WebRTC C++ code; see the 37*d9f75844SAndroid Build Coastguard Worker[instructions on how to use Abseil in WebRTC](abseil-in-webrtc.md). 38*d9f75844SAndroid Build Coastguard Worker 39*d9f75844SAndroid Build Coastguard Worker[abseil]: https://abseil.io/about/ 40*d9f75844SAndroid Build Coastguard Worker 41*d9f75844SAndroid Build Coastguard Worker### <a name="h-cc-pairs"></a>`.h` and `.cc` files come in pairs 42*d9f75844SAndroid Build Coastguard Worker 43*d9f75844SAndroid Build Coastguard Worker`.h` and `.cc` files should come in pairs, with the same name (except for the 44*d9f75844SAndroid Build Coastguard Workerfile type suffix), in the same directory, in the same build target. 45*d9f75844SAndroid Build Coastguard Worker 46*d9f75844SAndroid Build Coastguard Worker* If a declaration in `path/to/foo.h` has a definition in some `.cc` file, it 47*d9f75844SAndroid Build Coastguard Worker should be in `path/to/foo.cc`. 48*d9f75844SAndroid Build Coastguard Worker* If a definition in `path/to/foo.cc` file has a declaration in some `.h` file, 49*d9f75844SAndroid Build Coastguard Worker it should be in `path/to/foo.h`. 50*d9f75844SAndroid Build Coastguard Worker* Omit the `.cc` file if it would have been empty, but still list the `.h` file 51*d9f75844SAndroid Build Coastguard Worker in a build target. 52*d9f75844SAndroid Build Coastguard Worker* Omit the `.h` file if it would have been empty. (This can happen with unit 53*d9f75844SAndroid Build Coastguard Worker test `.cc` files, and with `.cc` files that define `main`.) 54*d9f75844SAndroid Build Coastguard Worker 55*d9f75844SAndroid Build Coastguard WorkerSee also the 56*d9f75844SAndroid Build Coastguard Worker[examples and exceptions on how to treat `.h` and `.cpp` files](style-guide/h-cc-pairs.md). 57*d9f75844SAndroid Build Coastguard Worker 58*d9f75844SAndroid Build Coastguard WorkerThis makes the source code easier to navigate and organize, and precludes some 59*d9f75844SAndroid Build Coastguard Workerquestionable build system practices such as having build targets that don't pull 60*d9f75844SAndroid Build Coastguard Workerin definitions for everything they declare. 61*d9f75844SAndroid Build Coastguard Worker 62*d9f75844SAndroid Build Coastguard Worker### `TODO` comments 63*d9f75844SAndroid Build Coastguard Worker 64*d9f75844SAndroid Build Coastguard WorkerFollow the [Google styleguide for `TODO` comments][goog-style-todo]. When 65*d9f75844SAndroid Build Coastguard Workerreferencing a WebRTC bug, prefer using the URL form (excluding the scheme part): 66*d9f75844SAndroid Build Coastguard Worker 67*d9f75844SAndroid Build Coastguard Worker```cpp 68*d9f75844SAndroid Build Coastguard Worker// TODO(bugs.webrtc.org/12345): Delete the hack when blocking bugs are resolved. 69*d9f75844SAndroid Build Coastguard Worker``` 70*d9f75844SAndroid Build Coastguard Worker 71*d9f75844SAndroid Build Coastguard WorkerThe short form used in commit messages, e.g. `webrtc:12345`, is discouraged. 72*d9f75844SAndroid Build Coastguard Worker 73*d9f75844SAndroid Build Coastguard Worker[goog-style-todo]: https://google.github.io/styleguide/cppguide.html#TODO_Comments 74*d9f75844SAndroid Build Coastguard Worker 75*d9f75844SAndroid Build Coastguard Worker### Deprecation 76*d9f75844SAndroid Build Coastguard Worker 77*d9f75844SAndroid Build Coastguard WorkerAnnotate the declarations of deprecated functions and classes with the 78*d9f75844SAndroid Build Coastguard Worker[`[[deprecated]]` attribute][DEPRECATED] to cause an error when they're used 79*d9f75844SAndroid Build Coastguard Workerinside WebRTC and a compiler warning when they're used by dependant projects. 80*d9f75844SAndroid Build Coastguard WorkerLike so: 81*d9f75844SAndroid Build Coastguard Worker 82*d9f75844SAndroid Build Coastguard Worker```cpp 83*d9f75844SAndroid Build Coastguard Worker[[deprecated("bugs.webrtc.org/12345")]] 84*d9f75844SAndroid Build Coastguard Workerstd::pony PonyPlz(const std::pony_spec& ps); 85*d9f75844SAndroid Build Coastguard Worker``` 86*d9f75844SAndroid Build Coastguard Worker 87*d9f75844SAndroid Build Coastguard WorkerNOTE 1: The annotation goes on the declaration in the `.h` file, not the 88*d9f75844SAndroid Build Coastguard Workerdefinition in the `.cc` file! 89*d9f75844SAndroid Build Coastguard Worker 90*d9f75844SAndroid Build Coastguard WorkerNOTE 2: In order to have unit tests that use the deprecated function without 91*d9f75844SAndroid Build Coastguard Workergetting errors, do something like this: 92*d9f75844SAndroid Build Coastguard Worker 93*d9f75844SAndroid Build Coastguard Worker```cpp 94*d9f75844SAndroid Build Coastguard Workerstd::pony DEPRECATED_PonyPlz(const std::pony_spec& ps); 95*d9f75844SAndroid Build Coastguard Worker[[deprecated("bugs.webrtc.org/12345")]] 96*d9f75844SAndroid Build Coastguard Workerinline std::pony PonyPlz(const std::pony_spec& ps) { 97*d9f75844SAndroid Build Coastguard Worker return DEPRECATED_PonyPlz(ps); 98*d9f75844SAndroid Build Coastguard Worker} 99*d9f75844SAndroid Build Coastguard Worker``` 100*d9f75844SAndroid Build Coastguard Worker 101*d9f75844SAndroid Build Coastguard WorkerIn other words, rename the existing function, and provide an inline wrapper 102*d9f75844SAndroid Build Coastguard Workerusing the original name that calls it. That way, callers who are willing to 103*d9f75844SAndroid Build Coastguard Workercall it using the `DEPRECATED_`-prefixed name don't get the warning. 104*d9f75844SAndroid Build Coastguard Worker 105*d9f75844SAndroid Build Coastguard WorkerNOTE 3: Occasionally, with long descriptions, `git cl format` will do the wrong 106*d9f75844SAndroid Build Coastguard Workerthing with the attribute. In that case, you can use the 107*d9f75844SAndroid Build Coastguard Worker[`ABSL_DEPRECATED` macro][ABSL_DEPRECATED], which is formatted in a more 108*d9f75844SAndroid Build Coastguard Workerreadable way. 109*d9f75844SAndroid Build Coastguard Worker 110*d9f75844SAndroid Build Coastguard Worker[DEPRECATED]: https://en.cppreference.com/w/cpp/language/attributes/deprecated 111*d9f75844SAndroid Build Coastguard Worker[ABSL_DEPRECATED]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/abseil-cpp/absl/base/attributes.h?q=ABSL_DEPRECATED 112*d9f75844SAndroid Build Coastguard Worker 113*d9f75844SAndroid Build Coastguard Worker### ArrayView 114*d9f75844SAndroid Build Coastguard Worker 115*d9f75844SAndroid Build Coastguard WorkerWhen passing an array of values to a function, use `rtc::ArrayView` 116*d9f75844SAndroid Build Coastguard Workerwhenever possible—that is, whenever you're not passing ownership of 117*d9f75844SAndroid Build Coastguard Workerthe array, and don't allow the callee to change the array size. 118*d9f75844SAndroid Build Coastguard Worker 119*d9f75844SAndroid Build Coastguard WorkerFor example, 120*d9f75844SAndroid Build Coastguard Worker 121*d9f75844SAndroid Build Coastguard Worker| instead of | use | 122*d9f75844SAndroid Build Coastguard Worker|-------------------------------------|----------------------| 123*d9f75844SAndroid Build Coastguard Worker| `const std::vector<T>&` | `ArrayView<const T>` | 124*d9f75844SAndroid Build Coastguard Worker| `const T* ptr, size_t num_elements` | `ArrayView<const T>` | 125*d9f75844SAndroid Build Coastguard Worker| `T* ptr, size_t num_elements` | `ArrayView<T>` | 126*d9f75844SAndroid Build Coastguard Worker 127*d9f75844SAndroid Build Coastguard WorkerSee the [source code for `rtc::ArrayView`](api/array_view.h) for more detailed 128*d9f75844SAndroid Build Coastguard Workerdocs. 129*d9f75844SAndroid Build Coastguard Worker 130*d9f75844SAndroid Build Coastguard Worker### sigslot 131*d9f75844SAndroid Build Coastguard Worker 132*d9f75844SAndroid Build Coastguard WorkerSIGSLOT IS DEPRECATED. 133*d9f75844SAndroid Build Coastguard Worker 134*d9f75844SAndroid Build Coastguard WorkerPrefer `webrtc::CallbackList`, and manage thread safety yourself. 135*d9f75844SAndroid Build Coastguard Worker 136*d9f75844SAndroid Build Coastguard Worker### Smart pointers 137*d9f75844SAndroid Build Coastguard Worker 138*d9f75844SAndroid Build Coastguard WorkerThe following smart pointer types are recommended: 139*d9f75844SAndroid Build Coastguard Worker 140*d9f75844SAndroid Build Coastguard Worker * `std::unique_ptr` for all singly-owned objects 141*d9f75844SAndroid Build Coastguard Worker * `rtc::scoped_refptr` for all objects with shared ownership 142*d9f75844SAndroid Build Coastguard Worker 143*d9f75844SAndroid Build Coastguard WorkerUse of `std::shared_ptr` is *not permitted*. It is banned in the Chromium style 144*d9f75844SAndroid Build Coastguard Workerguide (overriding the Google style guide). See the 145*d9f75844SAndroid Build Coastguard Worker[list of banned C++ library features in Chromium][chr-std-shared-ptr] for more 146*d9f75844SAndroid Build Coastguard Workerinformation. 147*d9f75844SAndroid Build Coastguard Worker 148*d9f75844SAndroid Build Coastguard WorkerIn most cases, one will want to explicitly control lifetimes, and therefore use 149*d9f75844SAndroid Build Coastguard Worker`std::unique_ptr`, but in some cases, for instance where references have to 150*d9f75844SAndroid Build Coastguard Workerexist both from the API users and internally, with no way to invalidate pointers 151*d9f75844SAndroid Build Coastguard Workerheld by the API user, `rtc::scoped_refptr` can be appropriate. 152*d9f75844SAndroid Build Coastguard Worker 153*d9f75844SAndroid Build Coastguard Worker[chr-std-shared-ptr]: https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++-features.md#shared-pointers-banned 154*d9f75844SAndroid Build Coastguard Worker 155*d9f75844SAndroid Build Coastguard Worker### `std::bind` 156*d9f75844SAndroid Build Coastguard Worker 157*d9f75844SAndroid Build Coastguard WorkerDon't use `std::bind`—there are pitfalls, and lambdas are almost as succinct and 158*d9f75844SAndroid Build Coastguard Workeralready familiar to modern C++ programmers. 159*d9f75844SAndroid Build Coastguard Worker 160*d9f75844SAndroid Build Coastguard Worker### `std::function` 161*d9f75844SAndroid Build Coastguard Worker 162*d9f75844SAndroid Build Coastguard Worker`std::function` is allowed, but remember that it's not the right tool for every 163*d9f75844SAndroid Build Coastguard Workeroccasion. Prefer to use interfaces when that makes sense, and consider 164*d9f75844SAndroid Build Coastguard Worker`rtc::FunctionView` for cases where the callee will not save the function 165*d9f75844SAndroid Build Coastguard Workerobject. 166*d9f75844SAndroid Build Coastguard Worker 167*d9f75844SAndroid Build Coastguard Worker### Forward declarations 168*d9f75844SAndroid Build Coastguard Worker 169*d9f75844SAndroid Build Coastguard WorkerWebRTC follows the 170*d9f75844SAndroid Build Coastguard Worker[Google C++ style guide on forward declarations][goog-forward-declarations]. 171*d9f75844SAndroid Build Coastguard WorkerIn summary: avoid using forward declarations where possible; just `#include` the 172*d9f75844SAndroid Build Coastguard Workerheaders you need. 173*d9f75844SAndroid Build Coastguard Worker 174*d9f75844SAndroid Build Coastguard Worker[goog-forward-declarations]: https://google.github.io/styleguide/cppguide.html#Forward_Declarations 175*d9f75844SAndroid Build Coastguard Worker 176*d9f75844SAndroid Build Coastguard Worker### RTTI and dynamic_cast 177*d9f75844SAndroid Build Coastguard Worker 178*d9f75844SAndroid Build Coastguard WorkerThe Google style guide [permits the use of dynamic_cast](https://google.github.io/styleguide/cppguide.html#Run-Time_Type_Information__RTTI_). 179*d9f75844SAndroid Build Coastguard Worker 180*d9f75844SAndroid Build Coastguard WorkerHowever, WebRTC does not permit it. WebRTC (and Chrome) is compiled with the 181*d9f75844SAndroid Build Coastguard Worker-fno-rtti flag, and the overhead of enabling RTTI it is on the order of 220 182*d9f75844SAndroid Build Coastguard WorkerKbytes (for Android Arm64). 183*d9f75844SAndroid Build Coastguard Worker 184*d9f75844SAndroid Build Coastguard WorkerUse static_cast and take your own steps to ensure type safety. 185*d9f75844SAndroid Build Coastguard Worker 186*d9f75844SAndroid Build Coastguard Worker## C 187*d9f75844SAndroid Build Coastguard Worker 188*d9f75844SAndroid Build Coastguard WorkerThere's a substantial chunk of legacy C code in WebRTC, and a lot of it is old 189*d9f75844SAndroid Build Coastguard Workerenough that it violates the parts of the C++ style guide that also applies to C 190*d9f75844SAndroid Build Coastguard Worker(naming etc.) for the simple reason that it pre-dates the use of the current C++ 191*d9f75844SAndroid Build Coastguard Workerstyle guide for this code base. If making large changes to C code, consider 192*d9f75844SAndroid Build Coastguard Workerconverting the whole thing to C++ first. 193*d9f75844SAndroid Build Coastguard Worker 194*d9f75844SAndroid Build Coastguard Worker## Java 195*d9f75844SAndroid Build Coastguard Worker 196*d9f75844SAndroid Build Coastguard WorkerWebRTC follows the [Google Java style guide][goog-java-style]. 197*d9f75844SAndroid Build Coastguard Worker 198*d9f75844SAndroid Build Coastguard Worker[goog-java-style]: https://google.github.io/styleguide/javaguide.html 199*d9f75844SAndroid Build Coastguard Worker 200*d9f75844SAndroid Build Coastguard Worker## Objective-C and Objective-C++ 201*d9f75844SAndroid Build Coastguard Worker 202*d9f75844SAndroid Build Coastguard WorkerWebRTC follows the 203*d9f75844SAndroid Build Coastguard Worker[Chromium Objective-C and Objective-C++ style guide][chr-objc-style]. 204*d9f75844SAndroid Build Coastguard Worker 205*d9f75844SAndroid Build Coastguard Worker[chr-objc-style]: https://chromium.googlesource.com/chromium/src/+/main/styleguide/objective-c/objective-c.md 206*d9f75844SAndroid Build Coastguard Worker 207*d9f75844SAndroid Build Coastguard Worker## Python 208*d9f75844SAndroid Build Coastguard Worker 209*d9f75844SAndroid Build Coastguard WorkerWebRTC follows [Chromium's Python style][chr-py-style]. 210*d9f75844SAndroid Build Coastguard Worker 211*d9f75844SAndroid Build Coastguard Worker[chr-py-style]: https://chromium.googlesource.com/chromium/src/+/main/styleguide/python/python.md 212*d9f75844SAndroid Build Coastguard Worker 213*d9f75844SAndroid Build Coastguard Worker## Build files 214*d9f75844SAndroid Build Coastguard Worker 215*d9f75844SAndroid Build Coastguard WorkerThe WebRTC build files are written in [GN][gn], and we follow the 216*d9f75844SAndroid Build Coastguard Worker[GN style guide][gn-style]. Additionally, there are some 217*d9f75844SAndroid Build Coastguard WorkerWebRTC-specific rules below; in case of conflict, they trump the Chromium style 218*d9f75844SAndroid Build Coastguard Workerguide. 219*d9f75844SAndroid Build Coastguard Worker 220*d9f75844SAndroid Build Coastguard Worker[gn]: https://gn.googlesource.com/gn/ 221*d9f75844SAndroid Build Coastguard Worker[gn-style]: https://gn.googlesource.com/gn/+/HEAD/docs/style_guide.md 222*d9f75844SAndroid Build Coastguard Worker 223*d9f75844SAndroid Build Coastguard Worker### <a name="webrtc-gn-templates"></a>WebRTC-specific GN templates 224*d9f75844SAndroid Build Coastguard Worker 225*d9f75844SAndroid Build Coastguard WorkerUse the following [GN templates][gn-templ] to ensure that all our 226*d9f75844SAndroid Build Coastguard Worker[GN targets][gn-target] are built with the same configuration: 227*d9f75844SAndroid Build Coastguard Worker 228*d9f75844SAndroid Build Coastguard Worker| instead of | use | 229*d9f75844SAndroid Build Coastguard Worker|------------------|----------------------| 230*d9f75844SAndroid Build Coastguard Worker| `executable` | `rtc_executable` | 231*d9f75844SAndroid Build Coastguard Worker| `shared_library` | `rtc_shared_library` | 232*d9f75844SAndroid Build Coastguard Worker| `source_set` | `rtc_source_set` | 233*d9f75844SAndroid Build Coastguard Worker| `static_library` | `rtc_static_library` | 234*d9f75844SAndroid Build Coastguard Worker| `test` | `rtc_test` | 235*d9f75844SAndroid Build Coastguard Worker 236*d9f75844SAndroid Build Coastguard Worker 237*d9f75844SAndroid Build Coastguard Worker[gn-templ]: https://gn.googlesource.com/gn/+/HEAD/docs/language.md#Templates 238*d9f75844SAndroid Build Coastguard Worker[gn-target]: https://gn.googlesource.com/gn/+/HEAD/docs/language.md#Targets 239*d9f75844SAndroid Build Coastguard Worker 240*d9f75844SAndroid Build Coastguard Worker### Target visibility and the native API 241*d9f75844SAndroid Build Coastguard Worker 242*d9f75844SAndroid Build Coastguard WorkerThe [WebRTC-specific GN templates](#webrtc-gn-templates) declare build targets 243*d9f75844SAndroid Build Coastguard Workerwhose default `visibility` allows all other targets in the WebRTC tree (and no 244*d9f75844SAndroid Build Coastguard Workertargets outside the tree) to depend on them. 245*d9f75844SAndroid Build Coastguard Worker 246*d9f75844SAndroid Build Coastguard WorkerPrefer to restrict the `visibility` if possible: 247*d9f75844SAndroid Build Coastguard Worker 248*d9f75844SAndroid Build Coastguard Worker* If a target is used by only one or a tiny number of other targets, prefer to 249*d9f75844SAndroid Build Coastguard Worker list them explicitly: `visibility = [ ":foo", ":bar" ]` 250*d9f75844SAndroid Build Coastguard Worker* If a target is used only by targets in the same `BUILD.gn` file: 251*d9f75844SAndroid Build Coastguard Worker `visibility = [ ":*" ]`. 252*d9f75844SAndroid Build Coastguard Worker 253*d9f75844SAndroid Build Coastguard WorkerSetting `visibility = [ "*" ]` means that targets outside the WebRTC tree can 254*d9f75844SAndroid Build Coastguard Workerdepend on this target; use this only for build targets whose headers are part of 255*d9f75844SAndroid Build Coastguard Workerthe [native WebRTC API](native-api.md). 256*d9f75844SAndroid Build Coastguard Worker 257*d9f75844SAndroid Build Coastguard Worker### Conditional compilation with the C preprocessor 258*d9f75844SAndroid Build Coastguard Worker 259*d9f75844SAndroid Build Coastguard WorkerAvoid using the C preprocessor to conditionally enable or disable pieces of 260*d9f75844SAndroid Build Coastguard Workercode. But if you can't avoid it, introduce a GN variable, and then set a 261*d9f75844SAndroid Build Coastguard Workerpreprocessor constant to either 0 or 1 in the build targets that need it: 262*d9f75844SAndroid Build Coastguard Worker 263*d9f75844SAndroid Build Coastguard Worker```gn 264*d9f75844SAndroid Build Coastguard Workerif (apm_debug_dump) { 265*d9f75844SAndroid Build Coastguard Worker defines = [ "WEBRTC_APM_DEBUG_DUMP=1" ] 266*d9f75844SAndroid Build Coastguard Worker} else { 267*d9f75844SAndroid Build Coastguard Worker defines = [ "WEBRTC_APM_DEBUG_DUMP=0" ] 268*d9f75844SAndroid Build Coastguard Worker} 269*d9f75844SAndroid Build Coastguard Worker``` 270*d9f75844SAndroid Build Coastguard Worker 271*d9f75844SAndroid Build Coastguard WorkerIn the C, C++, or Objective-C files, use `#if` when testing the flag, 272*d9f75844SAndroid Build Coastguard Workernot `#ifdef` or `#if defined()`: 273*d9f75844SAndroid Build Coastguard Worker 274*d9f75844SAndroid Build Coastguard Worker```c 275*d9f75844SAndroid Build Coastguard Worker#if WEBRTC_APM_DEBUG_DUMP 276*d9f75844SAndroid Build Coastguard Worker// One way. 277*d9f75844SAndroid Build Coastguard Worker#else 278*d9f75844SAndroid Build Coastguard Worker// Or another. 279*d9f75844SAndroid Build Coastguard Worker#endif 280*d9f75844SAndroid Build Coastguard Worker``` 281*d9f75844SAndroid Build Coastguard Worker 282*d9f75844SAndroid Build Coastguard WorkerWhen combined with the `-Wundef` compiler option, this produces compile time 283*d9f75844SAndroid Build Coastguard Workerwarnings if preprocessor symbols are misspelled, or used without corresponding 284*d9f75844SAndroid Build Coastguard Workerbuild rules to set them. 285