
Given the following code snippets: void Foo(Enum e) { switch (e) { case ...: ... return; } } int Bar(Enum e) { switch (e) { case ...: ... return val; } } If the switch statements do not have a default case, since all defined enum values are handled, then undefined enum values can cause undefined behavior as suggested in https://abseil.io/tips/147. Avoid this by guarding the UB code path with NOTREACHED(). Clang actually generates "ud2" instructions in debug builds in the places where this CL adds NOTREACHED(). Whereas in release builds, Clang does whatever it wants. Also do IWYU for base/notreached.h in this directory. Change-Id: I4bbfe8ed091627608bc84f9658fe2c01dc47fec1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5813603 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Peter Boström <pbos@chromium.org> Cr-Commit-Position: refs/heads/main@{#1347070}
Chromium
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone
! Instead,
follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure.
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.