Found this via a warning, but it's a substantive fix.
Since this is only for a cache, it should be safe to silently drop the
file if opening fails. I think.
In two cases, move constructors or assignment operators defined as
`= default` were being implicitly deleted because one of the class's
fields did not have suitable constructors/assignment operators.
Switch to explicitly deleting them; this does not affect behavior.
Note that in the case of PhysicalCore, only the move assignment operator
is implicitly deleted (because there's a field of reference type);
the move *constructor* is valid, and is required to be valid in order to
have a std::vector<PhysicalCore>.
- Add a type check so that calling Push with an invalid type produces a
compile error rather than a linker error.
- vi.cpp was calling Push with a variable of type `std::size_t`.
There's no explicit overload for `size_t`, but there is one for `u64`,
which on most platforms is the same type as `size_t`. On macOS,
however, it isn't: both types are 64 bits, but `size_t` is `unsigned
long` and `u64` is `unsigned long long`. Regardless, it makes more
sense to explicitly use `u64` here instaed of `size_t`.
On Apple platforms, FALSE and TRUE are defined as macros by
<mach/boolean.h>, which is included by various system headers.
Note that there appear to be no actual users of the names to fix up.
Actually, two enum classes, since for some reason there are two separate
yet identical `PollFD` types used in the codebase. I get one is
ABI-compatible with the Switch while the other is an abstract type used
for the host, but why not use `WSAPOLLFD` directly for the latter?
Anyway, why make this change? Because on Apple platforms, `POLL_IN`,
`POLL_OUT`, etc. (with the underscore) are defined as macros in
<sys/signal.h>. (This is inherited from FreeBSD.) So defining
a variable with the same name causes a compile error.
I could just rename the variables, but while I was at it I thought I may
as well switch to an enum for stronger typing.
Also, change the type used for values copied directly to/from the
`events` and `revents` fields of the host *native*
`pollfd`/`WSASPOLLFD`, from `u32` to `short`, as `short` is the correct
canonical type on both Unix and Windows.
Add a std::bit_cast-like function archiving the same runtime results as
the standard function, without compile time support.
This allows us to use bit_cast while we wait for compiler support, it
can be trivially replaced in the future.
VirtualBuffer makes use of VirtualAlloc (on Windows) and mmap() (on
other platforms). Neither of these ensure that non-trivial objects are
properly constructed in the allocated memory.
To prevent potential undefined behavior occurring due to that, we can
add a static assert to loudly complain about cases where that is done.
Makes page tables and virtual buffers able to be moved, but not copied,
making the interface more flexible.
Previously, with the destructor specified, but no move assignment or
constructor specified, they wouldn't be implicitly generated.