aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2018-03-31 10:24:08 +0200
committerGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2018-03-31 10:24:08 +0200
commitf3239a70b36e5384a79dd8453be88c8bcd146717 (patch)
tree8410949270d8d5e4ebcaf9bfaa673999f231665f
parentd22122ff6fd508b14e87adb8cb317a1156cec45b (diff)
downloadlv2lint-f3239a70b36e5384a79dd8453be88c8bcd146717.zip
lv2lint-f3239a70b36e5384a79dd8453be88c8bcd146717.tar.gz
lv2lint-f3239a70b36e5384a79dd8453be88c8bcd146717.tar.bz2
lv2lint-f3239a70b36e5384a79dd8453be88c8bcd146717.tar.xz
return invalid symbols and libraries in output.
-rw-r--r--VERSION2
-rw-r--r--lv2lint.c31
-rw-r--r--lv2lint.h5
-rw-r--r--lv2lint_plugin.c25
-rw-r--r--lv2lint_ui.c10
5 files changed, 58 insertions, 15 deletions
diff --git a/VERSION b/VERSION
index 3a127dc..dd0ed61 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.249
+0.1.251
diff --git a/lv2lint.c b/lv2lint.c
index 96a95f3..2ea3792 100644
--- a/lv2lint.c
+++ b/lv2lint.c
@@ -588,8 +588,29 @@ test_url(app_t *app, const char *url)
#endif
#ifdef ENABLE_ELF_TESTS
+static void
+_append_to(char **dst, const char *src)
+{
+ static const char *prefix = "\n * ";
+
+ if(*dst)
+ {
+ const size_t sz = strlen(*dst) + strlen(prefix) + strlen(src) + 1;
+ *dst = realloc(*dst, sz);
+ strcat(*dst, prefix);
+ strcat(*dst, src);
+ }
+ else
+ {
+ const size_t sz = strlen(src) + strlen(prefix) + 1;
+ *dst = malloc(sz);
+ strcpy(*dst, prefix);
+ strcat(*dst, src);
+ }
+}
+
bool
-test_visibility(const char *path, const char *description)
+test_visibility(const char *path, const char *description, char **symbols)
{
static const char *whitelist [] = {
// C
@@ -669,6 +690,7 @@ test_visibility(const char *path, const char *description)
if(!whitelist_match)
{
+ _append_to(symbols, name);
invalid++;
}
}
@@ -688,7 +710,8 @@ test_visibility(const char *path, const char *description)
bool
test_shared_libraries(const char *path, const char *const *whitelist,
- unsigned n_whitelist, const char *const *blacklist, unsigned n_blacklist)
+ unsigned n_whitelist, const char *const *blacklist, unsigned n_blacklist,
+ char **libraries)
{
unsigned invalid = 0;
@@ -747,13 +770,13 @@ test_shared_libraries(const char *path, const char *const *whitelist,
if(n_whitelist && !whitelist_match)
{
+ _append_to(libraries, name);
invalid++;
- //fprintf(stderr, " - %s\n", name);
}
if(n_blacklist && blacklist_match)
{
+ _append_to(libraries, name);
invalid++;
- //fprintf(stderr, " - %s\n", name);
}
}
//FIXME
diff --git a/lv2lint.h b/lv2lint.h
index 9d70d18..d2dc234 100644
--- a/lv2lint.h
+++ b/lv2lint.h
@@ -284,11 +284,12 @@ test_url(app_t *app, const char *url);
#ifdef ENABLE_ELF_TESTS
bool
-test_visibility(const char *path, const char *description);
+test_visibility(const char *path, const char *description, char **symbols);
bool
test_shared_libraries(const char *path, const char *const *whitelist,
- unsigned n_whitelist, const char *const *blacklist, unsigned n_blacklist);
+ unsigned n_whitelist, const char *const *blacklist, unsigned n_blacklist,
+ char **libraries);
#endif
int
diff --git a/lv2lint_plugin.c b/lv2lint_plugin.c
index 2222e02..6b20d1f 100644
--- a/lv2lint_plugin.c
+++ b/lv2lint_plugin.c
@@ -46,7 +46,7 @@ static const ret_t *
_test_symbols(app_t *app)
{
static const ret_t ret_symbols = {
- LINT_FAIL, "binary exports superfluous globally visible symbols", LV2_CORE__binary, NULL};
+ LINT_FAIL, "binary exports superfluous globally visible symbols: %s", LV2_CORE__binary, NULL};
const ret_t *ret = NULL;
@@ -59,10 +59,16 @@ _test_symbols(app_t *app)
char *path = lilv_file_uri_parse(uri, NULL);
if(path)
{
- if(!test_visibility(path, "lv2_descriptor"))
+ char *symbols = NULL;
+ if(!test_visibility(path, "lv2_descriptor", &symbols))
{
+ *app->urn = symbols;
ret = &ret_symbols;
}
+ else if(symbols)
+ {
+ free(symbols);
+ }
lilv_free(path);
}
@@ -76,10 +82,10 @@ static const ret_t *
_test_linking(app_t *app)
{
static const ret_t ret_symbols = {
- LINT_WARN, "binary links to non-whitelisted shared library", LV2_CORE__binary,
+ LINT_WARN, "binary links to non-whitelisted shared libraries: %s", LV2_CORE__binary,
"The ideal plugin dynamically links maximally to libc and libm."},
ret_libstdcpp = {
- LINT_WARN, "binary links to libstdc++", LV2_CORE__binary,
+ LINT_WARN, "binary links to C++ libraries: %s", LV2_CORE__binary,
"C++ ABI incompatibilities between host and plugin are to be expected."};
const ret_t *ret = NULL;
@@ -107,14 +113,21 @@ _test_linking(app_t *app)
char *path = lilv_file_uri_parse(uri, NULL);
if(path)
{
- if(!test_shared_libraries(path, whitelist, n_whitelist, NULL, 0))
+ char *libraries = NULL;
+ if(!test_shared_libraries(path, whitelist, n_whitelist, NULL, 0, &libraries))
{
+ *app->urn = libraries;
ret = &ret_symbols;
}
- else if(!test_shared_libraries(path, NULL, 0, graylist, n_graylist))
+ else if(!test_shared_libraries(path, NULL, 0, graylist, n_graylist, &libraries))
{
+ *app->urn = libraries;
ret = &ret_libstdcpp;
}
+ else if(libraries)
+ {
+ free(libraries);
+ }
lilv_free(path);
}
diff --git a/lv2lint_ui.c b/lv2lint_ui.c
index 875484e..00ac79d 100644
--- a/lv2lint_ui.c
+++ b/lv2lint_ui.c
@@ -40,7 +40,7 @@ _test_symbols(app_t *app)
{
static const ret_t ret_symbols = {
.lnt = LINT_FAIL,
- .msg = "binary exports superfluous globally visible symbols",
+ .msg = "binary exports superfluous globally visible symbols: %s",
.uri = LV2_CORE__binary,
.dsc = "plugin UI binaries must not export any globally visible symbols\n"
"but lv2ui_descriptor. You may well have forgotten to compile\n"
@@ -57,8 +57,14 @@ _test_symbols(app_t *app)
char *path = lilv_file_uri_parse(uri, NULL);
if(path)
{
- if(!test_visibility(path, "lv2ui_descriptor"))
+ char *symbols = NULL;
+ if(!test_visibility(path, "lv2ui_descriptor", &symbols))
{
+ if(symbols)
+ {
+ *app->urn = strdup(symbols);
+ free(symbols);
+ }
ret = &ret_symbols;
}