diff options
Diffstat (limited to 'src/systemd/sd-bus.h')
-rw-r--r-- | src/systemd/sd-bus.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h index c95b5e7ab0..21a6412f0e 100644 --- a/src/systemd/sd-bus.h +++ b/src/systemd/sd-bus.h @@ -334,14 +334,24 @@ typedef struct sd_bus_name_error_mapping sd_bus_name_error_mapping; #define SD_BUS_ERROR_MAKE_CONST(name, message) ((const sd_bus_error) {(name), (message), 0}) #define SD_BUS_ERROR_NULL SD_BUS_ERROR_MAKE_CONST(NULL, NULL) + #ifndef SD_BUS_ERROR_MAPPING # define _SD_BUS_ERROR_XCONCAT(x, y) x ## y # define _SD_BUS_ERROR_CONCAT(x, y) _SD_BUS_ERROR_XCONCAT(x, y) -# define SD_BUS_ERROR_MAPPING \ - __attribute((__section__("sd_bus_errnomap"))) __attribute((__used__)) \ - static const sd_bus_name_error_mapping _SD_BUS_ERROR_CONCAT(_sd_bus_errno_mapping_, __COUNTER__)[] +# define SD_BUS_ERROR_MAPPING(name) \ + __attribute((__section__("sd_bus_errnomap"))) \ + __attribute((__used__)) \ + const sd_bus_name_error_mapping _SD_BUS_ERROR_CONCAT(_sd_bus_errno_mapping_, name)[] +# define SD_BUS_ERROR_MAPPING_USE(name) \ + extern \ + const sd_bus_name_error_mapping _SD_BUS_ERROR_CONCAT(_sd_bus_errno_mapping_, name)[]; \ + __attribute((__used__)) \ + static const sd_bus_name_error_mapping* \ + _SD_BUS_ERROR_CONCAT(sd_bus_name_error_mapping_ref, __COUNTER__) \ + = _SD_BUS_ERROR_CONCAT(_sd_bus_errno_mapping_, name); #endif + void sd_bus_error_free(sd_bus_error *e); int sd_bus_error_set(sd_bus_error *e, const char *name, const char *message); int sd_bus_error_setf(sd_bus_error *e, const char *name, const char *format, ...) _sd_printf_(3, 4); |