Skip to content

Commit ceafaf6

Browse files
committed
Merge pull request swiftlang#19 from dgrove-oss/tests-libbsd-fliags
Enable libbsd for test compilation and cleanup misc. warnings
2 parents 35eb408 + db2d779 commit ceafaf6

File tree

4 files changed

+13
-22
lines changed

4 files changed

+13
-22
lines changed

tests/Makefile.am

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,17 @@ ORIGINAL_LIST_OF_TESTS= \
101101

102102
TESTS=$(PORTED_TESTS_PASSED) $(PORTED_TESTS_FAILED)
103103

104-
dispatch_c99_CFLAGS=$(AM_CFLAGS) -std=c99
104+
dispatch_c99_CFLAGS=$(DISPATCH_TESTS_CFLAGS) $(CBLOCKS_FLAGS) $(KQUEUE_CFLAGS) -std=c99
105105
dispatch_plusplus_SOURCES=dispatch_plusplus.cpp
106106
dispatch_priority2_SOURCES=dispatch_priority.c
107107
dispatch_priority2_CPPFLAGS=$(AM_CPPFLAGS) -DUSE_SET_TARGET_QUEUE=1
108108

109109
AM_CPPFLAGS=-I$(top_builddir) -I$(top_srcdir)
110110

111111
DISPATCH_TESTS_CFLAGS=-Wall -Wno-deprecated-declarations $(MARCH_FLAGS)
112-
AM_CFLAGS=$(DISPATCH_TESTS_CFLAGS) $(CBLOCKS_FLAGS) $(KQUEUE_CFLAGS)
112+
AM_CFLAGS=$(DISPATCH_TESTS_CFLAGS) $(CBLOCKS_FLAGS) $(KQUEUE_CFLAGS) $(BSD_OVERLAY_CFLAGS)
113113
AM_OBJCFLAGS=$(DISPATCH_TESTS_CFLAGS) $(CBLOCKS_FLAGS)
114-
AM_CXXFLAGS=$(DISPATCH_TESTS_CFLAGS) $(CXXBLOCKS_FLAGS)
114+
AM_CXXFLAGS=$(DISPATCH_TESTS_CFLAGS) $(CXXBLOCKS_FLAGS) $(BSD_OVERLAY_CFLAGS)
115115
AM_OBJCXXFLAGS=$(DISPATCH_TESTS_CFLAGS) $(CXXBLOCKS_FLAGS)
116116

117117
if HAVE_PTHREAD_WORKQUEUES
@@ -121,7 +121,7 @@ endif
121121
LDADD=libbsdtests.la ../src/libdispatch.la $(KQUEUE_LIBS) $(PTHREAD_WORKQUEUE_LIBS) $(BSD_OVERLAY_LIBS)
122122
libbsdtests_la_LDFLAGS=-avoid-version
123123

124-
bsdtestsummarize_LDADD=-lm
124+
bsdtestsummarize_LDADD=-lm $(BSD_OVERLAY_LIBS)
125125
dispatch_timer_short_LDADD=-lm $(LDADD)
126126
dispatch_group_LDADD=-lm $(LDADD)
127127

tests/bsdtests.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@
2929
#include <CoreFoundation/CoreFoundation.h>
3030
#endif
3131

32-
#ifdef __linux__
33-
#define __printflike(a,b) __attribute__((format(printf, a, b)))
34-
#include <inttypes.h>
35-
#endif
32+
#include <string.h>
3633

3734
static inline const char*
3835
__BASENAME__(const char *_str_)

tests/bsdtestsummarize.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,6 @@
2424
#include <string.h>
2525
#include <sys/param.h>
2626

27-
#ifndef __APPLE__
28-
static char*
29-
fgetln(FILE *stream, size_t *len)
30-
{
31-
static char buf[1024];
32-
char *cp = fgets(buf,1024,stream);
33-
if (cp)
34-
*len = strlen(cp);
35-
else
36-
*len = 0;
37-
return cp;
38-
}
39-
#endif
40-
4127
int
4228
has_prefix(const char* str, const char* prefix)
4329
{

tests/dispatch_c99.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
#include <dispatch/dispatch.h>
2222
#include <stdlib.h>
2323

24+
#ifdef __linux__
25+
// On Linux normally comes from libbsd overlay files,
26+
// but the headers are not c99 compliant so we compile
27+
// this test case without $(BSD_OVERLAY_CFLAGS)
28+
#define __printflike(a,b) __attribute__((format(printf, a, b)))
29+
#include <inttypes.h>
30+
#endif
31+
2432
#include <bsdtests.h>
2533
#include "dispatch_test.h"
2634

0 commit comments

Comments
 (0)