[ccan] [PATCH] stringbuilder: Functions for joining strings.

Rusty Russell rusty at rustcorp.com.au
Mon Mar 30 16:25:31 AEDT 2015


David Gibson <david at gibson.dropbear.id.au> writes:
> On Sat, Aug 23, 2014 at 02:30:12PM +1000, Stuart Longland wrote:
>> If I run ccanlint directly withot ccan/str listed in the dependencies,
>> I get:
>> > stringbuilder: Module's CCAN dependencies are the only CCAN files
>> > #included (depends_accurate): FAIL 
>> > /home/stuartl/hamradio/hhcp/ccan/ccan/stringbuilder/test/run.c:6:ccan/str
>> > not listed in _info
>> 
>> But then if I comment out that line and run ccanlint again:
>> > stringbuilder: Module's CCAN dependencies are the only CCAN files
>> > #included (depends_accurate): PASS 
>> > /home/stuartl/hamradio/hhcp/ccan/ccan/stringbuilder/_info:ccan/str
>> > is an unused dependency
>> 
>> So the advice is contradictory.  What I did in the last patch was to
>> make my own streq work-alike, ugly sure, but until I get ccanlint
>> sorted, it works.  I guess a merger with str might solve that problem. :-)

I fixed it up, using "testdepends" as below.

> Ah, I think you need to list separate testdepends, since ccan/str is
> only being used in the tests, not the module proper here.  See
> ccan/rfc822/_info amongst others for an example.
>
>> Where ccanlint fails is running `make check-stringbuilder`:
>> > tools/ccanlint/ccanlint --deps-fail-ignore ccan/build_assert 
>> > build_assert: Total score: 32/32 make: Circular check-str <-
>> > check-str dependency dropped. make: *** No rule to make target
>> > `check-tal/talloc', needed by `check-str'.  Stop.
>
> Ugh.. not sure what's up with that.

Make suckage.  I run ccanlint -v directly :)

Cheers,
Rusty.

>From dd76dc271c2fb2b08af996fabafdebaa74347aec Mon Sep 17 00:00:00 2001
From: Rusty Russell <rusty at rustcorp.com.au>
Date: Mon, 30 Mar 2015 15:53:45 +1030
Subject: [PATCH] stringbuilder: fix ccan/str test dependency.

It's a test dependency, not a core one, so it belongs under "testdepends".

Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

diff --git a/ccan/stringbuilder/_info b/ccan/stringbuilder/_info
index 4c78254..802914c 100644
--- a/ccan/stringbuilder/_info
+++ b/ccan/stringbuilder/_info
@@ -48,10 +48,11 @@ int main(int argc, char *argv[])
 		return 1;
 
 	if (strcmp(argv[1], "depends") == 0) {
-		/*
-		 * This triggers a circular dependency!
-		 * printf("ccan/str\n");
-		 */
+		return 0;
+	}
+
+	if (strcmp(argv[1], "testdepends") == 0) {
+		printf("ccan/str\n");
 		return 0;
 	}
 
diff --git a/ccan/stringbuilder/test/run.c b/ccan/stringbuilder/test/run.c
index 2d119f2..b59a0aa 100644
--- a/ccan/stringbuilder/test/run.c
+++ b/ccan/stringbuilder/test/run.c
@@ -1,15 +1,9 @@
 #include <ccan/stringbuilder/stringbuilder.h>
 #include <ccan/stringbuilder/stringbuilder.c>
+#include <ccan/str/str.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
-/*
- * This triggers a circular dependency
- * #include <ccan/str/str.h>
- *
- * We only want the following macro:
- */
-#define streq(s1,s2) (!strcmp(s1,s2))
 
 #include <ccan/tap/tap.h>
 


More information about the ccan mailing list