Merge pull request #2827 from keszybz/public-headers

ANSI C compatibility for public headers
This commit is contained in:
Daniel Mack
2016-03-14 16:55:04 +01:00
8 changed files with 25 additions and 10 deletions

View File

@@ -6161,7 +6161,6 @@ DISTCHECK_CONFIGURE_FLAGS += \
endif
.PHONY: dist-check-help
dist-check-help: $(rootbin_PROGRAMS) $(bin_PROGRAMS)
for i in $(abspath $^); do \
if $$i --help | grep -v 'default:' | grep -E -q '.{80}.' ; then \
@@ -6170,6 +6169,18 @@ dist-check-help: $(rootbin_PROGRAMS) $(bin_PROGRAMS)
exit 1; \
fi; done
include_compilers = "$(CC)" "$(CC) -ansi" "$(CC) -std=iso9899:1990"
public_headers = $(filter-out src/systemd/_sd-common.h, $(pkginclude_HEADERS) $(include_HEADERS))
.PHONY: dist-check-includes
dist-check-includes: $(public_headers)
@res=0; \
for i in $(abspath $^); do \
for cc in $(include_compilers); do \
echo "$$cc -o/dev/null -c -x c -include "$$i" - </dev/null"; \
$$cc -o/dev/null -c -x c -include "$$i" - </dev/null || res=1; \
done; \
done; exit $$res
.PHONY: hwdb-update
hwdb-update:
( cd $(top_srcdir)/hwdb && \

View File

@@ -74,7 +74,7 @@
#endif
#define _SD_DEFINE_POINTER_CLEANUP_FUNC(type, func) \
static inline void func##p(type **p) { \
static __inline__ void func##p(type **p) { \
if (*p) \
func(*p); \
} \

View File

@@ -59,7 +59,7 @@ enum {
SD_BUS_TYPE_STRUCT_END = ')',
SD_BUS_TYPE_DICT_ENTRY = 'e', /* not actually used in signatures */
SD_BUS_TYPE_DICT_ENTRY_BEGIN = '{',
SD_BUS_TYPE_DICT_ENTRY_END = '}',
SD_BUS_TYPE_DICT_ENTRY_END = '}'
};
/* Well-known errors. Note that this is only a sanitized subset of the

View File

@@ -34,7 +34,7 @@ enum {
_SD_BUS_VTABLE_METHOD = 'M',
_SD_BUS_VTABLE_SIGNAL = 'S',
_SD_BUS_VTABLE_PROPERTY = 'P',
_SD_BUS_VTABLE_WRITABLE_PROPERTY = 'W',
_SD_BUS_VTABLE_WRITABLE_PROPERTY = 'W'
};
enum {

View File

@@ -89,13 +89,13 @@ enum {
SD_BUS_CREDS_WELL_KNOWN_NAMES = 1ULL << 32,
SD_BUS_CREDS_DESCRIPTION = 1ULL << 33,
SD_BUS_CREDS_AUGMENT = 1ULL << 63, /* special flag, if on sd-bus will augment creds struct, in a potentially race-full way. */
_SD_BUS_CREDS_ALL = (1ULL << 34) -1,
_SD_BUS_CREDS_ALL = (1ULL << 34) -1
};
enum {
SD_BUS_NAME_REPLACE_EXISTING = 1ULL << 0,
SD_BUS_NAME_ALLOW_REPLACEMENT = 1ULL << 1,
SD_BUS_NAME_QUEUE = 1ULL << 2,
SD_BUS_NAME_QUEUE = 1ULL << 2
};
/* Callbacks */

View File

@@ -55,7 +55,7 @@ enum {
SD_EVENT_RUNNING,
SD_EVENT_EXITING,
SD_EVENT_FINISHED,
SD_EVENT_PREPARING,
SD_EVENT_PREPARING
};
enum {
@@ -69,7 +69,11 @@ typedef int (*sd_event_handler_t)(sd_event_source *s, void *userdata);
typedef int (*sd_event_io_handler_t)(sd_event_source *s, int fd, uint32_t revents, void *userdata);
typedef int (*sd_event_time_handler_t)(sd_event_source *s, uint64_t usec, void *userdata);
typedef int (*sd_event_signal_handler_t)(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata);
#if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED
typedef int (*sd_event_child_handler_t)(sd_event_source *s, const siginfo_t *si, void *userdata);
#else
typedef void* sd_event_child_handler_t;
#endif
int sd_event_default(sd_event **e);

View File

@@ -100,11 +100,11 @@ int sd_id128_get_boot(sd_id128_t *ret);
((x).bytes[15] & 15) >= 10 ? 'a' + ((x).bytes[15] & 15) - 10 : '0' + ((x).bytes[15] & 15), \
0 })
_sd_pure_ static inline int sd_id128_equal(sd_id128_t a, sd_id128_t b) {
_sd_pure_ static __inline__ int sd_id128_equal(sd_id128_t a, sd_id128_t b) {
return memcmp(&a, &b, 16) == 0;
}
_sd_pure_ static inline int sd_id128_is_null(sd_id128_t a) {
_sd_pure_ static __inline__ int sd_id128_is_null(sd_id128_t a) {
return a.qwords[0] == 0 && a.qwords[1] == 0;
}

View File

@@ -72,7 +72,7 @@ enum {
SD_JOURNAL_SYSTEM = 4,
SD_JOURNAL_CURRENT_USER = 8,
SD_JOURNAL_SYSTEM_ONLY = SD_JOURNAL_SYSTEM, /* deprecated name */
SD_JOURNAL_SYSTEM_ONLY = SD_JOURNAL_SYSTEM /* deprecated name */
};
/* Wakeup event types */