Source: spl
Version: 1.0
Severity: wishlist
Tags: patch
Dear Maintainer,
Using the rebuild infrastructure http://buildd-clang.debian.net/, your
package fails to build with clang (instead of gcc).
The full log can be viewed at
http://clang.debian.net/logs/2013-07-14/spl_1.0~pre6-4_unstable_clang.log
The attached patch fixes the clang error.
Thanks
-- System Information:
Debian Release: jessie/sid
APT prefers testing-updates
APT policy: (500, 'testing-updates'), (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.12-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=pl_PL.UTF-8, LC_CTYPE=pl_PL.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -ur spl-1.0~pre6/spl_modules/mod_array.c spl-1.0~pre6-clang/spl_modules/mod_array.c
--- spl-1.0~pre6/spl_modules/mod_array.c 2008-09-18 16:34:23.000000000 +0200
+++ spl-1.0~pre6-clang/spl_modules/mod_array.c 2014-03-13 20:59:30.169213605 +0100
@@ -119,6 +119,43 @@
return SPL_NEW_INT(1);
}
+struct spl_task *task;
+struct spl_code *code;
+
+int compar(const void *a_vp, const void *b_vp)
+{
+ struct spl_node_sub **a_p = (struct spl_node_sub **)a_vp;
+ struct spl_node_sub **b_p = (struct spl_node_sub **)b_vp;
+ char *a = (*a_p)->key;
+ char *b = (*b_p)->key;
+ int switched = 0;
+ int ret = 0;
+
+ if (a_vp > b_vp) {
+ char *x = a;
+ a = b; b = x;
+ switched = 1;
+ }
+
+ spl_task_setcode(task, spl_code_get(code));
+ spl_create(task, task->ctx, "a", SPL_NEW_STRING_DUP(a), SPL_CREATE_LOCAL);
+ spl_create(task, task->ctx, "b", SPL_NEW_STRING_DUP(b), SPL_CREATE_LOCAL);
+ spl_clib_callback_run(task);
+
+ struct spl_node *rn = spl_lookup(task, task->ctx, "r", SPL_LOOKUP_TEST);
+ if (rn) {
+ // the SPL callback function returns '0' when the elements are
+ // in the right order and a different value when they are in the
+ // wrong order. But this function must return -1, 0 or +1 for
+ // less-then, equal or greater then. We need to convert this
+ // information...
+ ret = switched ? +1 : -1;
+ if (spl_get_int(rn)) ret *= -1;
+ }
+
+return ret;
+}
+
static struct spl_node *handler_array_qsort(struct spl_task *t, void *d UNUSED)
{
#ifdef USEMACOSXAPI
@@ -140,12 +177,15 @@
}
assert(!s);
- struct spl_code *code;
+ task = spl_clib_callback_task(t->vm);
+
+ spl_create(task, task->ctx, "c", spl_get(order_function), SPL_CREATE_LOCAL);
+
{
struct spl_asm *as = spl_asm_create();
spl_asm_add(as, SPL_OP_PUSHC, "r");
spl_asm_add(as, SPL_OP_ZERO, 0);
- spl_asm_add(as, SPL_OP_PUSHA, "b");
+ spl_asm_add(as, SPL_OP_PUSHA,"b");
spl_asm_add(as, SPL_OP_PUSHA, "a");
spl_asm_add(as, SPL_OP_DCALL, "c");
spl_asm_add(as, SPL_OP_POPL, 0);
@@ -154,45 +194,6 @@
spl_asm_destroy(as);
}
- struct spl_task *task = spl_clib_callback_task(t->vm);
-
- int compar(const void *a_vp, const void *b_vp)
- {
- struct spl_node_sub **a_p = (struct spl_node_sub **)a_vp;
- struct spl_node_sub **b_p = (struct spl_node_sub **)b_vp;
- char *a = (*a_p)->key;
- char *b = (*b_p)->key;
- int switched = 0;
- int ret = 0;
-
- if (a_vp > b_vp) {
- char *x = a;
- a = b; b = x;
- switched = 1;
- }
-
- spl_task_setcode(task, spl_code_get(code));
- spl_create(task, task->ctx, "a", SPL_NEW_STRING_DUP(a), SPL_CREATE_LOCAL);
- spl_create(task, task->ctx, "b", SPL_NEW_STRING_DUP(b), SPL_CREATE_LOCAL);
-
- spl_clib_callback_run(task);
-
- struct spl_node *rn = spl_lookup(task, task->ctx, "r", SPL_LOOKUP_TEST);
- if (rn) {
- // the SPL callback function returns '0' when the elements are
- // in the right order and a different value when they are in the
- // wrong order. But this function must return -1, 0 or +1 for
- // less-then, equal or greater then. We need to convert this
- // information...
- ret = switched ? +1 : -1;
- if (spl_get_int(rn)) ret *= -1;
- }
-
- return ret;
- }
-
- spl_create(task, task->ctx, "c", spl_get(order_function), SPL_CREATE_LOCAL);
-
qsort(list, array->subs_counter, sizeof(struct spl_node_sub *), compar);
spl_task_destroy(task->vm, task);
diff -ur spl-1.0~pre6/spl_modules/mod_format_xml.c spl-1.0~pre6-clang/spl_modules/mod_format_xml.c
--- spl-1.0~pre6/spl_modules/mod_format_xml.c 2008-09-18 16:34:23.000000000 +0200
+++ spl-1.0~pre6-clang/spl_modules/mod_format_xml.c 2014-03-14 13:12:20.218483888 +0100
@@ -122,6 +122,32 @@
return target;
}
+struct stack_el_t {
+ char *name;
+ int counter;
+ struct stack_el_t *next;
+};
+
+
+struct stack_t {
+ struct spl_node *node;
+ struct stack_el_t *el_list;
+ struct stack_t *next;
+};
+
+struct stack_t *stack = 0;
+int last_is_char = -1;
+struct spl_task *task;
+
+void stack_push()
+{
+ struct stack_t *s = malloc(sizeof(struct stack_t));
+ s->node = spl_get(0);
+ s->el_list = 0;
+ s->next = stack;
+ stack = s;
+}
+
/**
* This function returns a tree of ordered hashes. The keys in the ordered
* hashes are encoded as following:
@@ -165,35 +191,8 @@
* debug xmltree.["E0:html"].["E0:head"].["E0:title"].["C0"];
*/
// builtin format_xml_parse(xmldata)
-static struct spl_node *handler_format_xml_parse(struct spl_task *task, void *data UNUSED)
-{
- struct stack_el_t {
- char *name;
- int counter;
- struct stack_el_t *next;
- };
-
- struct stack_t {
- struct spl_node *node;
- struct stack_el_t *el_list;
- struct stack_t *next;
- };
-
- char *xmlfile = spl_clib_get_string(task);
- struct stack_t *stack = 0;
- int last_is_char = -1;
-
- void stack_push()
- {
- struct stack_t *s = malloc(sizeof(struct stack_t));
- s->node = spl_get(0);
- s->el_list = 0;
- s->next = stack;
- stack = s;
- }
-
- void stack_pop()
+void stack_pop()
{
struct stack_t *s = stack;
struct stack_el_t *e = s->el_list;
@@ -327,6 +326,11 @@
}
}
+static struct spl_node *handler_format_xml_parse(struct spl_task *task_tmp, void *data UNUSED)
+{
+ task = task_tmp;
+ char *xmlfile = spl_clib_get_string(task);
+
stack_push();
spl_set_string(stack->node, strdup(""));
@@ -363,22 +367,17 @@
* Create an XML text from a data structure such as returned by [[format_xml_parse()]].
*/
// builtin format_xml_dump(xmltree)
-static struct spl_node *handler_format_xml_dump(struct spl_task *task, void *data UNUSED)
-{
- struct txtlist_t {
- char *text;
- struct txtlist_t *next;
- };
- struct txtlist_t *list = 0, *current = 0;
- int textlen = 0, i, j;
- struct spl_node *tree = spl_clib_get_node(task);
- if (!tree) return 0;
+struct txtlist_t {
+ char *text;
+ struct txtlist_t *next;
+};
- spl_cleanup(task, tree);
+struct txtlist_t *list = 0, *current = 0;
+int textlen = 0;
- void newtext()
+void newtext()
{
struct txtlist_t *t = calloc(1, sizeof(struct txtlist_t));
if ( !current ) list = t;
@@ -441,6 +440,15 @@
}
}
+static struct spl_node *handler_format_xml_dump(struct spl_task *task, void *data UNUSED)
+{
+ int i, j;
+
+ struct spl_node *tree = spl_clib_get_node(task);
+ if (!tree) return 0;
+
+ spl_cleanup(task, tree);
+
dump_xml(tree, 0);
char *text = malloc(textlen+1);