jsonnet
jsonnet copied to clipboard
enumeration value 'binary' not handled in switch
Just making sure someone saw this warning
/builddir/build/BUILD/jsonnet-0.19.1/core/vm.cpp:1665:16: warning: enumeration value 'binary' not handled in switch [-Wswitch]
1665 | switch (v.type()) {
| ^
I think the deal here is if you have a more recent version of that library then there is an additional enum value. There is a PR that fixed it, but I rolled it back because the version in the third_party was older and didn't have it.
"that library" being json.hpp
Since the build is configured to turn on ~all the warnings, IMHO it would be nice to do something about this. Some options:
- Disable the warning
¯\_(ツ)_/¯
- Upgrade the bundled json.hpp and add a case for
binary
. This creates the reverse problem that people using a system-provided json library must have a version recent enough to have this enum value. It looks like this was added to nlohmann json in 2019: https://github.com/nlohmann/json/pull/1662 and released in v3.8.0, as of June 2020. For reference, Debian Buster (current supported LTS version) appears to have json v3.5.0: https://packages.debian.org/buster/nlohmann-json3-dev (the next version, Bullseye, has v3.9.1). -
#if
logic in the switch statement to define a case for value_t::binary only if we're using a json lib version >= 3.8. I would prefer not to do this. - Add a
default
case and raise an error. This should be both forward and backward compatible.