Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
19902365
Commit
19902365
authored
Nov 12, 2012
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: enhance get_libs to get libraries for tests, too.
Signed-off-by:
Rusty Russell
<
rusty@rustcorp.com.au
>
parent
1842f551
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
8 deletions
+34
-8
tools/ccanlint/tests/examples_compile.c
tools/ccanlint/tests/examples_compile.c
+1
-1
tools/ccanlint/tests/module_links.c
tools/ccanlint/tests/module_links.c
+1
-1
tools/ccanlint/tests/tests_compile.c
tools/ccanlint/tests/tests_compile.c
+1
-1
tools/depends.c
tools/depends.c
+25
-3
tools/tools.h
tools/tools.h
+6
-2
No files found.
tools/ccanlint/tests/examples_compile.c
View file @
19902365
...
...
@@ -120,7 +120,7 @@ static char *example_lib_list(const void *ctx, struct manifest **deps)
/* FIXME: This doesn't uniquify. */
for
(
i
=
0
;
i
<
talloc_array_length
(
deps
);
i
++
)
{
libs
=
get_libs
(
ctx
,
deps
[
i
]
->
dir
,
false
,
get_or_compile_info
);
libs
=
get_libs
(
ctx
,
deps
[
i
]
->
dir
,
NULL
,
get_or_compile_info
);
for
(
j
=
0
;
libs
[
j
];
j
++
)
list
=
talloc_asprintf_append
(
list
,
"-l%s "
,
libs
[
j
]);
}
...
...
tools/ccanlint/tests/module_links.c
View file @
19902365
...
...
@@ -47,7 +47,7 @@ static char *lib_list(const struct manifest *m)
char
**
libs
;
char
*
ret
=
talloc_strdup
(
m
,
""
);
libs
=
get_libs
(
m
,
m
->
dir
,
true
,
get_or_compile_info
);
libs
=
get_libs
(
m
,
m
->
dir
,
"depends"
,
get_or_compile_info
);
for
(
i
=
0
;
libs
[
i
];
i
++
)
ret
=
talloc_asprintf_append
(
ret
,
"-l%s "
,
libs
[
i
]);
return
ret
;
...
...
tools/ccanlint/tests/tests_compile.c
View file @
19902365
...
...
@@ -58,7 +58,7 @@ char *lib_list(const struct manifest *m, enum compile_type ctype)
char
**
libs
;
char
*
ret
=
talloc_strdup
(
m
,
""
);
libs
=
get_libs
(
m
,
m
->
dir
,
true
,
get_or_compile_info
);
libs
=
get_libs
(
m
,
m
->
dir
,
"depends"
,
get_or_compile_info
);
for
(
i
=
0
;
libs
[
i
];
i
++
)
ret
=
talloc_asprintf_append
(
ret
,
"-l%s "
,
libs
[
i
]);
return
ret
;
...
...
tools/depends.c
View file @
19902365
...
...
@@ -244,7 +244,24 @@ static char **get_one_libs(const void *ctx, const char *dir,
return
lines
;
}
char
**
get_libs
(
const
void
*
ctx
,
const
char
*
dir
,
bool
recurse
,
/* O(n^2) but n is small. */
static
char
**
add_deps
(
char
**
deps1
,
char
**
deps2
)
{
unsigned
int
i
,
len
;
len
=
talloc_array_length
(
deps1
);
for
(
i
=
0
;
deps2
[
i
];
i
++
)
{
if
(
have_dep
(
deps1
,
deps2
[
i
]))
continue
;
deps1
=
talloc_realloc
(
NULL
,
deps1
,
char
*
,
len
+
1
);
deps1
[
len
-
1
]
=
talloc_steal
(
deps1
,
deps2
[
i
]);
deps1
[
len
++
]
=
NULL
;
}
return
deps1
;
}
char
**
get_libs
(
const
void
*
ctx
,
const
char
*
dir
,
const
char
*
style
,
char
*
(
*
get_info
)(
const
void
*
ctx
,
const
char
*
dir
))
{
char
**
deps
,
**
libs
;
...
...
@@ -253,8 +270,13 @@ char **get_libs(const void *ctx, const char *dir, bool recurse,
libs
=
get_one_libs
(
ctx
,
dir
,
get_info
);
len
=
talloc_array_length
(
libs
);
if
(
recurse
)
{
deps
=
get_deps
(
ctx
,
dir
,
"depends"
,
true
,
get_info
);
if
(
style
)
{
deps
=
get_deps
(
ctx
,
dir
,
style
,
true
,
get_info
);
if
(
streq
(
style
,
"testdepends"
))
deps
=
add_deps
(
deps
,
get_deps
(
ctx
,
dir
,
"depends"
,
true
,
get_info
));
for
(
i
=
0
;
deps
[
i
];
i
++
)
{
char
**
newlibs
,
*
subdir
;
size_t
newlen
;
...
...
tools/tools.h
View file @
19902365
...
...
@@ -31,8 +31,12 @@ char **get_deps(const void *ctx, const char *dir, const char *style,
char
**
get_safe_ccan_deps
(
const
void
*
ctx
,
const
char
*
dir
,
const
char
*
style
,
bool
recurse
);
/* This also needs to compile the info file. */
char
**
get_libs
(
const
void
*
ctx
,
const
char
*
dir
,
bool
recurse
,
/* This also needs to compile the info file:
* style == NULL: don't recurse.
* style == depends: recurse dependencies.
* style == testdepends: recurse testdepends and depends.
*/
char
**
get_libs
(
const
void
*
ctx
,
const
char
*
dir
,
const
char
*
style
,
char
*
(
*
get_info
)(
const
void
*
ctx
,
const
char
*
dir
));
/* From tools.c */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment