[roll] Roll fuchsia [fidl][cpp] Audit bits API with respect to unknown members
It seems safe for operations to avoid introducing unknown bits
accidentally, but at the same time the flexible bits is designed to
explicitly carry and reason about unknown bits.
After looking at the way bits APIs are used, we propose the following
invariant: bitwise operations should not introduce unknown bits
unless a corresponding unknown bit occur in the source operands.
This means that one could perform OR, XOR, AND, etc over flexible
unknown bits with unknowns naturally as if they are numbers. At the
same time, when using strict bits, OR, XOR, AND will not give unknowns.
Bitwise NOT is almost always used like so:
some_bits &= ~Bits::FOO;
i.e. it's used to clear some bit. This is problematic because bitwise
NOT will mask out the unknown bits. As a result the combined
`somebits &= ~Bits::FOO` operation will drop any unknown bit inside
`somebits`, whether the user intended or not. To mitigate this, we add
another operation "bitwise difference" to the binding spec and C++
bindings, which does not drop unknown bits. The Rust bindings should
also support this out-of-the-box from the bit_flags crate.
During the API review folks worried that XOR would introduce unknown
bits but it turns out that was not the case.
Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/760439
Original-Revision: d0f83e4c62a0c07e7bc12cf9070844fdc0012164
GitOrigin-RevId: 05f277c31d13d313404e6381a731936c936f143a
Change-Id: I220f026134f3165037abad56fcccbd4cfc6ffc6b
This repository contains Fuchsia's Global Integration manifest files.
All changes should be made to the internal version of this repository. Our infrastructure automatically updates this version when the internal one changes.
Currently all changes must be made by a Google employee. Non-Google employees wishing to make a change can ask for assistance via the IRC channel #fuchsia on Freenode.
First install Jiri.
Next run:
$ jiri init $ jiri import minimal https://fuchsia.googlesource.com/integration $ jiri update
Third party projects should have their own subdirectory in ./third_party.