summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-03-25 15:39:34 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-03-25 15:39:34 +0000
commit81f22eaba6741ffcb9a9f0e18afc1f4d113ba7dd (patch)
tree5dbaf58c1d5e7a4cb939cbc75df83f767c8261a5
parent5f1057c8cdc74263f109d05fb674367d70062210 (diff)
downloadlibwapcaplet-81f22eaba6741ffcb9a9f0e18afc1f4d113ba7dd.tar.gz
libwapcaplet-81f22eaba6741ffcb9a9f0e18afc1f4d113ba7dd.tar.bz2
Fix test build.
svn path=/trunk/libwapcaplet/; revision=6875
-rw-r--r--Makefile7
-rw-r--r--src/libwapcaplet.c6
-rw-r--r--test/memorytests.c2
-rw-r--r--test/testmain.c10
4 files changed, 23 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 3793751..de8d1ea 100644
--- a/Makefile
+++ b/Makefile
@@ -16,6 +16,13 @@ WARNFLAGS := -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align \
CFLAGS := $(CFLAGS) -std=c99 -D_BSD_SOURCE -I$(CURDIR)/include/ \
-I$(CURDIR)/src $(WARNFLAGS)
+ifneq ($(PKGCONFIG),)
+ TESTCFLAGS := $(TESTCFLAGS) $(shell $(PKGCONFIG) --cflags check)
+ TESTLDFLAGS := $(TESTLDFLAGS) $(shell $(PKGCONFIG) --libs check)
+else
+ TESTLDFLAGS := $(TESTLDFLAGS) -lcheck
+endif
+
include build/makefiles/Makefile.top
# Extra installation rules
diff --git a/src/libwapcaplet.c b/src/libwapcaplet.c
index 80585f3..29b9795 100644
--- a/src/libwapcaplet.c
+++ b/src/libwapcaplet.c
@@ -12,6 +12,10 @@
#include "libwapcaplet/libwapcaplet.h"
+#ifndef UNUSED
+#define UNUSED(x) ((x) = (x))
+#endif
+
typedef uint32_t lwc_hash;
typedef uint32_t lwc_refcounter;
@@ -199,6 +203,8 @@ lwc_context_intern_substring(lwc_context *ctx,
lwc_string *
lwc_context_string_ref(lwc_context *ctx, lwc_string *str)
{
+ UNUSED(ctx);
+
assert(ctx);
assert(str);
diff --git a/test/memorytests.c b/test/memorytests.c
index c289126..7c55cce 100644
--- a/test/memorytests.c
+++ b/test/memorytests.c
@@ -33,7 +33,7 @@ tracking_allocator(void *ptr, size_t len, void *pw)
allocs++;
ret = malloc(len + sizeof(size_t));
*(size_t *)ret = len;
- return ret + sizeof(size_t);
+ return ((char *) ret) + sizeof(size_t);
}
last_op = FREE;
allocs--;
diff --git a/test/testmain.c b/test/testmain.c
index 29df8dc..7c5aee9 100644
--- a/test/testmain.c
+++ b/test/testmain.c
@@ -11,7 +11,12 @@
#include "tests.h"
+#ifndef UNUSED
+#define UNUSED(x) ((x) = (x))
+#endif
+
/* This means that assertion failures are silent in tests */
+extern void __assert_fail(void);
void __assert_fail(void) { abort(); }
int
@@ -19,7 +24,10 @@ main(int argc, char **argv)
{
int number_failed = 0;
SRunner *sr;
-
+
+ UNUSED(argc);
+ UNUSED(argv);
+
sr = srunner_create(suite_create("Test suite for libwapcaplet"));
lwc_basic_suite(sr);