mirror of
https://github.com/systemd/systemd.git
synced 2025-01-12 13:18:14 +03:00
tree-wide: use __ prefixed gcc attributes (#10843)
As suggest here: https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax "You may optionally specify attribute names with ‘__’ preceding and following the name. This allows you to use them in header files without being concerned about a possible macro of the same name. For example, you may use the attribute name __noreturn__ instead of noreturn. "
This commit is contained in:
parent
52048013b7
commit
012c2f761b
@ -274,7 +274,7 @@ int json_log_internal(JsonVariant *variant, int level, int error, const char *fi
|
||||
|
||||
#define _JSON_VARIANT_STRING_CONST(xq, x) \
|
||||
({ \
|
||||
__attribute__((aligned(2))) static const char UNIQ_T(json_string_const, xq)[] = (x); \
|
||||
__attribute__((__aligned__(2))) static const char UNIQ_T(json_string_const, xq)[] = (x); \
|
||||
assert((((uintptr_t) UNIQ_T(json_string_const, xq)) & 1) == 0); \
|
||||
(JsonVariant*) ((uintptr_t) UNIQ_T(json_string_const, xq) + 1); \
|
||||
})
|
||||
|
@ -8,30 +8,30 @@
|
||||
#include <sys/sysmacros.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define _printf_(a, b) __attribute__ ((format (printf, a, b)))
|
||||
#define _printf_(a, b) __attribute__ ((__format__(printf, a, b)))
|
||||
#ifdef __clang__
|
||||
# define _alloc_(...)
|
||||
#else
|
||||
# define _alloc_(...) __attribute__ ((alloc_size(__VA_ARGS__)))
|
||||
# define _alloc_(...) __attribute__ ((__alloc_size__(__VA_ARGS__)))
|
||||
#endif
|
||||
#define _sentinel_ __attribute__ ((sentinel))
|
||||
#define _unused_ __attribute__ ((unused))
|
||||
#define _destructor_ __attribute__ ((destructor))
|
||||
#define _pure_ __attribute__ ((pure))
|
||||
#define _const_ __attribute__ ((const))
|
||||
#define _deprecated_ __attribute__ ((deprecated))
|
||||
#define _packed_ __attribute__ ((packed))
|
||||
#define _malloc_ __attribute__ ((malloc))
|
||||
#define _weak_ __attribute__ ((weak))
|
||||
#define _sentinel_ __attribute__ ((__sentinel__))
|
||||
#define _unused_ __attribute__ ((__unused__))
|
||||
#define _destructor_ __attribute__ ((__destructor__))
|
||||
#define _pure_ __attribute__ ((__pure__))
|
||||
#define _const_ __attribute__ ((__const__))
|
||||
#define _deprecated_ __attribute__ ((__deprecated__))
|
||||
#define _packed_ __attribute__ ((__packed__))
|
||||
#define _malloc_ __attribute__ ((__malloc__))
|
||||
#define _weak_ __attribute__ ((__weak__))
|
||||
#define _likely_(x) (__builtin_expect(!!(x), 1))
|
||||
#define _unlikely_(x) (__builtin_expect(!!(x), 0))
|
||||
#define _public_ __attribute__ ((visibility("default")))
|
||||
#define _hidden_ __attribute__ ((visibility("hidden")))
|
||||
#define _weakref_(x) __attribute__((weakref(#x)))
|
||||
#define _alignas_(x) __attribute__((aligned(__alignof(x))))
|
||||
#define _cleanup_(x) __attribute__((cleanup(x)))
|
||||
#define _public_ __attribute__ ((__visibility__("default")))
|
||||
#define _hidden_ __attribute__ ((__visibility__("hidden")))
|
||||
#define _weakref_(x) __attribute__((__weakref__(#x)))
|
||||
#define _alignas_(x) __attribute__((__aligned__(__alignof(x))))
|
||||
#define _cleanup_(x) __attribute__((__cleanup__(x)))
|
||||
#if __GNUC__ >= 7
|
||||
#define _fallthrough_ __attribute__((fallthrough))
|
||||
#define _fallthrough_ __attribute__((__fallthrough__))
|
||||
#else
|
||||
#define _fallthrough_
|
||||
#endif
|
||||
@ -41,7 +41,7 @@
|
||||
#if __STDC_VERSION__ >= 201112L
|
||||
#define _noreturn_ _Noreturn
|
||||
#else
|
||||
#define _noreturn_ __attribute__((noreturn))
|
||||
#define _noreturn_ __attribute__((__noreturn__))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -27,8 +27,8 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __CHECKER__
|
||||
#define __sd_bitwise __attribute__((bitwise))
|
||||
#define __sd_force __attribute__((force))
|
||||
#define __sd_bitwise __attribute__((__bitwise__))
|
||||
#define __sd_force __attribute__((__force__))
|
||||
#else
|
||||
#define __sd_bitwise
|
||||
#define __sd_force
|
||||
|
@ -7,37 +7,37 @@
|
||||
/* BE */
|
||||
|
||||
static inline uint16_t unaligned_read_be16(const void *_u) {
|
||||
const struct __attribute__((packed, may_alias)) { uint16_t x; } *u = _u;
|
||||
const struct __attribute__((__packed__, __may_alias__)) { uint16_t x; } *u = _u;
|
||||
|
||||
return be16toh(u->x);
|
||||
}
|
||||
|
||||
static inline uint32_t unaligned_read_be32(const void *_u) {
|
||||
const struct __attribute__((packed, may_alias)) { uint32_t x; } *u = _u;
|
||||
const struct __attribute__((__packed__, __may_alias__)) { uint32_t x; } *u = _u;
|
||||
|
||||
return be32toh(u->x);
|
||||
}
|
||||
|
||||
static inline uint64_t unaligned_read_be64(const void *_u) {
|
||||
const struct __attribute__((packed, may_alias)) { uint64_t x; } *u = _u;
|
||||
const struct __attribute__((__packed__, __may_alias__)) { uint64_t x; } *u = _u;
|
||||
|
||||
return be64toh(u->x);
|
||||
}
|
||||
|
||||
static inline void unaligned_write_be16(void *_u, uint16_t a) {
|
||||
struct __attribute__((packed, may_alias)) { uint16_t x; } *u = _u;
|
||||
struct __attribute__((__packed__, __may_alias__)) { uint16_t x; } *u = _u;
|
||||
|
||||
u->x = be16toh(a);
|
||||
}
|
||||
|
||||
static inline void unaligned_write_be32(void *_u, uint32_t a) {
|
||||
struct __attribute__((packed, may_alias)) { uint32_t x; } *u = _u;
|
||||
struct __attribute__((__packed__, __may_alias__)) { uint32_t x; } *u = _u;
|
||||
|
||||
u->x = be32toh(a);
|
||||
}
|
||||
|
||||
static inline void unaligned_write_be64(void *_u, uint64_t a) {
|
||||
struct __attribute__((packed, may_alias)) { uint64_t x; } *u = _u;
|
||||
struct __attribute__((__packed__, __may_alias__)) { uint64_t x; } *u = _u;
|
||||
|
||||
u->x = be64toh(a);
|
||||
}
|
||||
@ -45,37 +45,37 @@ static inline void unaligned_write_be64(void *_u, uint64_t a) {
|
||||
/* LE */
|
||||
|
||||
static inline uint16_t unaligned_read_le16(const void *_u) {
|
||||
const struct __attribute__((packed, may_alias)) { uint16_t x; } *u = _u;
|
||||
const struct __attribute__((__packed__, __may_alias__)) { uint16_t x; } *u = _u;
|
||||
|
||||
return le16toh(u->x);
|
||||
}
|
||||
|
||||
static inline uint32_t unaligned_read_le32(const void *_u) {
|
||||
const struct __attribute__((packed, may_alias)) { uint32_t x; } *u = _u;
|
||||
const struct __attribute__((__packed__, __may_alias__)) { uint32_t x; } *u = _u;
|
||||
|
||||
return le32toh(u->x);
|
||||
}
|
||||
|
||||
static inline uint64_t unaligned_read_le64(const void *_u) {
|
||||
const struct __attribute__((packed, may_alias)) { uint64_t x; } *u = _u;
|
||||
const struct __attribute__((__packed__, __may_alias__)) { uint64_t x; } *u = _u;
|
||||
|
||||
return le64toh(u->x);
|
||||
}
|
||||
|
||||
static inline void unaligned_write_le16(void *_u, uint16_t a) {
|
||||
struct __attribute__((packed, may_alias)) { uint16_t x; } *u = _u;
|
||||
struct __attribute__((__packed__, __may_alias__)) { uint16_t x; } *u = _u;
|
||||
|
||||
u->x = le16toh(a);
|
||||
}
|
||||
|
||||
static inline void unaligned_write_le32(void *_u, uint32_t a) {
|
||||
struct __attribute__((packed, may_alias)) { uint32_t x; } *u = _u;
|
||||
struct __attribute__((__packed__, __may_alias__)) { uint32_t x; } *u = _u;
|
||||
|
||||
u->x = le32toh(a);
|
||||
}
|
||||
|
||||
static inline void unaligned_write_le64(void *_u, uint64_t a) {
|
||||
struct __attribute__((packed, may_alias)) { uint64_t x; } *u = _u;
|
||||
struct __attribute__((__packed__, __may_alias__)) { uint64_t x; } *u = _u;
|
||||
|
||||
u->x = le64toh(a);
|
||||
}
|
||||
|
@ -172,7 +172,8 @@ static inline void _reset_errno_(int *saved_errno) {
|
||||
errno = *saved_errno;
|
||||
}
|
||||
|
||||
#define PROTECT_ERRNO _cleanup_(_reset_errno_) __attribute__((unused)) int _saved_errno_ = errno
|
||||
#define PROTECT_ERRNO \
|
||||
_cleanup_(_reset_errno_) __attribute__((__unused__)) int _saved_errno_ = errno
|
||||
|
||||
static inline int negative_errno(void) {
|
||||
/* This helper should be used to shut up gcc if you know 'errno' is
|
||||
|
@ -41,7 +41,7 @@ static inline void FreePoolp(void *p) {
|
||||
FreePool(q);
|
||||
}
|
||||
|
||||
#define _cleanup_(x) __attribute__((cleanup(x)))
|
||||
#define _cleanup_(x) __attribute__((__cleanup__(x)))
|
||||
#define _cleanup_freepool_ _cleanup_(FreePoolp)
|
||||
|
||||
static inline void FileHandleClosep(EFI_FILE_HANDLE *handle) {
|
||||
|
@ -33,11 +33,12 @@ int bus_error_set_errnofv(sd_bus_error *e, int error, const char *format, va_lis
|
||||
#define BUS_ERROR_MAP_ELF_REGISTER \
|
||||
__attribute__ ((__section__("BUS_ERROR_MAP"))) \
|
||||
__attribute__ ((__used__)) \
|
||||
__attribute__ ((aligned(8)))
|
||||
__attribute__ ((__aligned__(8)))
|
||||
|
||||
#define BUS_ERROR_MAP_ELF_USE(errors) \
|
||||
extern const sd_bus_error_map errors[]; \
|
||||
__attribute__ ((used)) static const sd_bus_error_map * const CONCATENATE(errors ## _copy_, __COUNTER__) = errors;
|
||||
__attribute__ ((__used__)) \
|
||||
static const sd_bus_error_map * const CONCATENATE(errors ## _copy_, __COUNTER__) = errors;
|
||||
|
||||
/* We use something exotic as end marker, to ensure people build the
|
||||
* maps using the macsd-ros. */
|
||||
|
@ -24,9 +24,9 @@ struct udev *udev_new(void);
|
||||
void udev_set_log_fn(struct udev *udev,
|
||||
void (*log_fn)(struct udev *udev,
|
||||
int priority, const char *file, int line, const char *fn,
|
||||
const char *format, va_list args)) __attribute__ ((deprecated));
|
||||
int udev_get_log_priority(struct udev *udev) __attribute__ ((deprecated));
|
||||
void udev_set_log_priority(struct udev *udev, int priority) __attribute__ ((deprecated));
|
||||
const char *format, va_list args)) __attribute__((__deprecated__));
|
||||
int udev_get_log_priority(struct udev *udev) __attribute__((__deprecated__));
|
||||
void udev_set_log_priority(struct udev *udev, int priority) __attribute__((__deprecated__));
|
||||
void *udev_get_userdata(struct udev *udev);
|
||||
void udev_set_userdata(struct udev *udev, void *userdata);
|
||||
|
||||
@ -153,16 +153,16 @@ struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue);
|
||||
struct udev_queue *udev_queue_unref(struct udev_queue *udev_queue);
|
||||
struct udev *udev_queue_get_udev(struct udev_queue *udev_queue);
|
||||
struct udev_queue *udev_queue_new(struct udev *udev);
|
||||
unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue) __attribute__ ((deprecated));
|
||||
unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) __attribute__ ((deprecated));
|
||||
unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue) __attribute__((__deprecated__));
|
||||
unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) __attribute__((__deprecated__));
|
||||
int udev_queue_get_udev_is_active(struct udev_queue *udev_queue);
|
||||
int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue);
|
||||
int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum) __attribute__ ((deprecated));
|
||||
int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum) __attribute__((__deprecated__));
|
||||
int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue,
|
||||
unsigned long long int start, unsigned long long int end) __attribute__ ((deprecated));
|
||||
unsigned long long int start, unsigned long long int end) __attribute__((__deprecated__));
|
||||
int udev_queue_get_fd(struct udev_queue *udev_queue);
|
||||
int udev_queue_flush(struct udev_queue *udev_queue);
|
||||
struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue) __attribute__ ((deprecated));
|
||||
struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue) __attribute__((__deprecated__));
|
||||
|
||||
/*
|
||||
* udev_hwdb
|
||||
|
@ -25,22 +25,22 @@
|
||||
|
||||
#ifndef _sd_printf_
|
||||
# if __GNUC__ >= 4
|
||||
# define _sd_printf_(a,b) __attribute__ ((format (printf, a, b)))
|
||||
# define _sd_printf_(a,b) __attribute__ ((__format__(printf, a, b)))
|
||||
# else
|
||||
# define _sd_printf_(a,b)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _sd_sentinel_
|
||||
# define _sd_sentinel_ __attribute__((sentinel))
|
||||
# define _sd_sentinel_ __attribute__((__sentinel__))
|
||||
#endif
|
||||
|
||||
#ifndef _sd_packed_
|
||||
# define _sd_packed_ __attribute__((packed))
|
||||
# define _sd_packed_ __attribute__((__packed__))
|
||||
#endif
|
||||
|
||||
#ifndef _sd_pure_
|
||||
# define _sd_pure_ __attribute__((pure))
|
||||
# define _sd_pure_ __attribute__((__pure__))
|
||||
#endif
|
||||
|
||||
#ifndef _SD_STRINGIFY
|
||||
|
Loading…
Reference in New Issue
Block a user