projects
/
systemd
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d385d54
)
sd-common: add new macro for forcing 64bit size for public enums
author
Lennart Poettering
<lennart@poettering.net>
Thu, 11 Feb 2021 15:02:59 +0000
(16:02 +0100)
committer
Lennart Poettering
<lennart@poettering.net>
Tue, 16 Feb 2021 19:36:30 +0000
(20:36 +0100)
That's the only way we can retain type-safe enums while being able to
guarantee for stable enum sizes.
src/systemd/_sd-common.h
patch
|
blob
|
history
diff --git
a/src/systemd/_sd-common.h
b/src/systemd/_sd-common.h
index e3de2ae56292b465df04d53ce46523ed9dfeef64..e121429640ba4d76558718772f170b04643f552c 100644
(file)
--- a/
src/systemd/_sd-common.h
+++ b/
src/systemd/_sd-common.h
@@
-99,4
+99,10
@@
typedef void (*_sd_destroy_t)(void *userdata);
} \
struct _sd_useless_struct_to_allow_trailing_semicolon_
+/* The following macro should be used in all public enums, to force 64bit wideness on them, so that we can
+ * freely extend them later on, without breaking compatibility. */
+#define _SD_ENUM_FORCE_S64(id) \
+ _SD_##id##_INT64_MIN = INT64_MIN, \
+ _SD_##id##_INT64_MAX = INT64_MAX
+
#endif