From: Lennart Poettering Date: Thu, 13 Jun 2024 13:22:27 +0000 (+0200) Subject: sd-json: make static analyzers shut up X-Git-Tag: v257-rc1~1165 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=828e52bf8fae8778cc784d207252a6db82e4bee2;p=thirdparty%2Fsystemd.git sd-json: make static analyzers shut up https://github.com/systemd/systemd/pull/32628#pullrequestreview-2115501478 --- diff --git a/src/libsystemd/sd-json/sd-json.c b/src/libsystemd/sd-json/sd-json.c index 2c5c0a35c94..d7b3ffdbc60 100644 --- a/src/libsystemd/sd-json/sd-json.c +++ b/src/libsystemd/sd-json/sd-json.c @@ -76,7 +76,11 @@ struct sd_json_variant { /* The current 'depth' of the sd_json_variant, i.e. how many levels of member variants this has */ uint16_t depth; - int type:8; /* actually sd_json_variant_type_t, but reduced to 8bit size */ + signed int type:8; /* actually sd_json_variant_type_t, but reduced to 8bit size (we used "signed int" + * rather than just "int", since apparently compilers are free to pick signedness + * otherwise. We don't really care about the signedess, we care more about whether + * the enum can be converted to this, but we never use the negative values of + * sd_json_variant_type_t here.) */ /* A marker whether this variant is embedded into in array/object or not. If true, the 'parent' pointer above * is valid. If false, the 'n_ref' field above is valid instead. */