chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
shared: use SocketAddress in socket_address_matches_fd()
[elogind.git]
/
src
/
shared
/
macro.h
diff --git
a/src/shared/macro.h
b/src/shared/macro.h
index daa42c4c68101ce5e70fb773a7fafd5937c417e8..7f89951d62e00ee5f68809e017c2572f1e174770 100644
(file)
--- a/
src/shared/macro.h
+++ b/
src/shared/macro.h
@@
-67,6
+67,10
@@
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wshadow\"")
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wshadow\"")
+#define DISABLE_WARNING_INCOMPATIBLE_POINTER_TYPES \
+ _Pragma("GCC diagnostic push"); \
+ _Pragma("GCC diagnostic ignored \"-Wincompatible-pointer-types\"")
+
#define REENABLE_WARNING \
_Pragma("GCC diagnostic pop")
#define REENABLE_WARNING \
_Pragma("GCC diagnostic pop")
@@
-238,7
+242,7
@@
static inline unsigned long ALIGN_POWER2(unsigned long u) {
#else
#define assert_cc(expr) \
DISABLE_WARNING_DECLARATION_AFTER_STATEMENT; \
#else
#define assert_cc(expr) \
DISABLE_WARNING_DECLARATION_AFTER_STATEMENT; \
- struct CONCATENATE(_assert_struct_, __
LINE__) {
\
+ struct CONCATENATE(_assert_struct_, __
COUNTER__) {
\
char x[(expr) ? 0 : -1]; \
}; \
REENABLE_WARNING
char x[(expr) ? 0 : -1]; \
}; \
REENABLE_WARNING
@@
-379,7
+383,8
@@
do { \
/* Returns the number of chars needed to format variables of the
* specified type as a decimal string. Adds in extra space for a
/* Returns the number of chars needed to format variables of the
* specified type as a decimal string. Adds in extra space for a
- * negative '-' prefix. */
+ * negative '-' prefix (hence works correctly on signed
+ * types). Includes space for the trailing NUL. */
#define DECIMAL_STR_MAX(type) \
(2+(sizeof(type) <= 1 ? 3 : \
sizeof(type) <= 2 ? 5 : \
#define DECIMAL_STR_MAX(type) \
(2+(sizeof(type) <= 1 ? 3 : \
sizeof(type) <= 2 ? 5 : \
@@
-446,4
+451,11
@@
do { \
#define GID_INVALID ((gid_t) -1)
#define MODE_INVALID ((mode_t) -1)
#define GID_INVALID ((gid_t) -1)
#define MODE_INVALID ((mode_t) -1)
+#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \
+ static inline void func##p(type *p) { \
+ if (*p) \
+ func(*p); \
+ } \
+ struct __useless_struct_to_allow_trailing_semicolon__
+
#include "log.h"
#include "log.h"