]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-json: make static analyzers shut up
authorLennart Poettering <lennart@poettering.net>
Thu, 13 Jun 2024 13:22:27 +0000 (15:22 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 13 Jun 2024 15:53:33 +0000 (17:53 +0200)
https://github.com/systemd/systemd/pull/32628#pullrequestreview-2115501478

src/libsystemd/sd-json/sd-json.c

index 2c5c0a35c9420f713e043df0df8c6fa62815afc7..d7b3ffdbc606907c37f60bd20a1de823b7b00f69 100644 (file)
@@ -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. */