Source: openrc
Severity: minor
Tags: patch
User: pkg-llvm-t...@lists.alioth.debian.org
Usertags: clang-ftbfs

Hello,

Using the rebuild infrastructure, your package fails to build with clang 
(instead of gcc).

We detected this kinf of error:
http://clang.debian.net/status.php?version=3.5.0rc1&key=NOT_ALLOWED_HERE

Full build log is available here:
http://clang.debian.net/logs/2014-06-16/openrc_0.12.4+20131230-9_unstable_clang.log

Thanks,
Alexander

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
--- ./src/librc/librc-depend.c	2014-08-19 00:44:32.000000000 +0400
+++ ../openrc-0.12.4+20131230-my/./src/librc/librc-depend.c	2014-08-19 00:34:41.960965257 +0400
@@ -886,6 +886,83 @@
 	return '?';
 }
 
+static idid_entry_t *idid_counters = NULL;
+static int idid_count2 = 0;
+
+static void idid_btree_builddescarray(const void *nodep, const VISIT which, const int depth) {
+    (void)depth;
+    switch (which) {
+        case preorder:
+        case leaf: {
+            const idid_entry_t *idid_entry_p = *(idid_entry_t * const*)nodep;
+
+            memcpy(&idid_counters[idid_count2], idid_entry_p, sizeof(idid_counters[idid_count2]));
+            idid_count2++;
+            break;
+        }
+        default:
+            break;
+    }
+    return;
+}
+
+static char printwarn;
+static RC_DEPINFO *depinfo_from = NULL;
+static RC_DEPINFO *depinfo_to = NULL;
+
+void
+rc_deptree_remove_loopdependency(service_id_t **unap[UNAPM_MAX], service_id_t dep_remove_from_service_id, service_id_t dep_remove_to_service_id, RC_DEPINFO *di_from, RC_DEPINFO *di_to, const char *const type, unapm_type_t unapm_type)
+{
+    RC_DEPTYPE *deptype_from = NULL, *deptype_to = NULL;
+    int dep_num, dep_count;
+    const char *type_reverse = NULL;
+    int deptype_num;
+
+    /* removing use/after from cache */
+    if (di_from != NULL) {
+        deptype_from = get_deptype(di_from, type);
+        if (deptype_from != NULL)
+            rc_stringlist_delete(deptype_from->services, di_to->service);
+    }
+
+    /* removing from the UNAP matrix */
+    if (deptype_from != NULL || di_from == NULL) {
+        dep_num   = 0;
+        dep_count = unap[unapm_type][dep_remove_from_service_id][0];
+        while (dep_num++ < dep_count) {
+            if (unap[unapm_type][dep_remove_from_service_id][dep_num] == dep_remove_to_service_id) {
+                unap[unapm_type][dep_remove_from_service_id][dep_num] =
+                    unap[unapm_type][dep_remove_from_service_id][dep_count--];
+
+                if (printwarn)
+                    ewarn("Solving the loop by breaking %s %c> %s.",
+                        depinfo_to->service, deptype2char(unapm_type), depinfo_from->service);
+            }
+        }
+        unap[unapm_type][dep_remove_from_service_id][0] = dep_count;
+    }
+
+    /* removing back dependencies */
+
+    if (di_to == NULL)
+        return;
+
+    deptype_num = 0;
+    while (deppairs[deptype_num].depend) {
+        if (!strcmp(deppairs[deptype_num].depend, type)) {
+            type_reverse = deppairs[deptype_num].addto;
+            break;
+        }
+        deptype_num++;
+    }
+
+    deptype_to = get_deptype(di_to, type_reverse);
+    if (deptype_to != NULL)
+        rc_stringlist_delete(deptype_to->services, di_from->service);
+
+    return;
+}
+
 /*! Solves dependecies loops
  * @param unap_matrix matrixes to scan ways to solve the loop
  * @param service_id looped service id
@@ -900,7 +977,7 @@
 	int chains_size = unap_matrix[0][0][0], chain_count;
 
 	/* svc_id2depinfo_bt may be NULL while any unit tests to simplify them */
-	char printwarn  =  (svc_id2depinfo_bt != NULL) && (flags & RCDTFLAGS_LOOPSOLVER_WARNINGS);
+    printwarn  =  (svc_id2depinfo_bt != NULL) && (flags & RCDTFLAGS_LOOPSOLVER_WARNINGS);
 	char printerr   =   svc_id2depinfo_bt != NULL;
 
 	if (! (flags & RCDTFLAGS_LOOPSOLVER))
@@ -1243,26 +1320,6 @@
 		/* building array of dependencies sorted by descending presence counter */
 
 		{
-			int idid_count2;
-			idid_entry_t *idid_counters;
-
-			void idid_btree_builddescarray(const void *nodep, const VISIT which, const int depth) {
-				(void)depth;
-				switch (which) {
-					case preorder:
-					case leaf: {
-						const idid_entry_t *idid_entry_p = *(idid_entry_t * const*)nodep;
-
-						memcpy(&idid_counters[idid_count2], idid_entry_p, sizeof(idid_counters[idid_count2]));
-						idid_count2++;
-						break;
-					}
-					default:
-						break;
-				}
-				return;
-			}
-
 			idid_counters = xmalloc(idid_count * sizeof(*idid_counters));
 
 			idid_count2 = 0;
@@ -1296,60 +1353,6 @@
 
 				{
 					ENTRY item, **item_pp;
-					RC_DEPINFO *depinfo_from = NULL, *depinfo_to = NULL;
-
-					void
-					rc_deptree_remove_loopdependency(service_id_t **unap[UNAPM_MAX], service_id_t dep_remove_from_service_id, service_id_t dep_remove_to_service_id, RC_DEPINFO *di_from, RC_DEPINFO *di_to, const char *const type, unapm_type_t unapm_type)
-					{
-						RC_DEPTYPE *deptype_from = NULL, *deptype_to = NULL;
-						int dep_num, dep_count;
-						const char *type_reverse = NULL;
-						int deptype_num;
-
-						/* removing use/after from cache */
-						if (di_from != NULL) {
-							deptype_from = get_deptype(di_from, type);
-							if (deptype_from != NULL)
-								rc_stringlist_delete(deptype_from->services, di_to->service);
-						}
-
-						/* removing from the UNAP matrix */
-						if (deptype_from != NULL || di_from == NULL) {
-							dep_num   = 0;
-							dep_count = unap[unapm_type][dep_remove_from_service_id][0];
-							while (dep_num++ < dep_count) {
-								if (unap[unapm_type][dep_remove_from_service_id][dep_num] == dep_remove_to_service_id) {
-									unap[unapm_type][dep_remove_from_service_id][dep_num] =
-										unap[unapm_type][dep_remove_from_service_id][dep_count--];
-
-									if (printwarn)
-										ewarn("Solving the loop by breaking %s %c> %s.",
-											depinfo_to->service, deptype2char(unapm_type), depinfo_from->service);
-								}
-							}
-							unap[unapm_type][dep_remove_from_service_id][0] = dep_count;
-						}
-
-						/* removing back dependencies */
-
-						if (di_to == NULL)
-							return;
-
-						deptype_num = 0;
-						while (deppairs[deptype_num].depend) {
-							if (!strcmp(deppairs[deptype_num].depend, type)) {
-								type_reverse = deppairs[deptype_num].addto;
-								break;
-							}
-							deptype_num++;
-						}
-
-						deptype_to = get_deptype(di_to, type_reverse);
-						if (deptype_to != NULL)
-							rc_stringlist_delete(deptype_to->services, di_from->service);
-
-						return;
-					}
 
 					if (printwarn) {
 						item.key     = (void *)(long)service_id_from;
--- ./src/lsb2rcconf/main.c	2014-08-19 00:44:32.000000000 +0400
+++ ../openrc-0.12.4+20131230-my/./src/lsb2rcconf/main.c	2014-08-19 00:43:30.239581661 +0400
@@ -63,11 +63,12 @@
 #define hsearch_data_t void *
 
 #define hsearch_r(...) hsearch_r_2_tsearch(__VA_ARGS__)
-static inline int hsearch_r_2_tsearch(ENTRY item, ACTION action, ENTRY **retval, hsearch_data_t *htab) {
-	int hsearch_r_2_tsearch_compare(const ENTRY *a, const ENTRY *b) {
+static int hsearch_r_2_tsearch_compare(const ENTRY *a, const ENTRY *b) {
 		return strcmp(a->key, b->key);
 	}
 
+static inline int hsearch_r_2_tsearch(ENTRY item, ACTION action, ENTRY **retval, hsearch_data_t *htab) {
+
 	ENTRY **tret = NULL;
 
 	switch (action) {
@@ -202,11 +203,18 @@
 	}
 }
 
+static struct relation_arg *arg_p_ = NULL;
+
+static void relation_add_mark_real_service(char *service, void *arg) {
+    relation_add_oneservice(service, arg_p_);
+}
+
 void relation_add(const char *const _service, struct relation_arg *arg_p)
 {
 	if (!strcmp(_service, service_me)) {
 		return;
 	}
+    arg_p_ = arg_p;
 
 	char *service_buf = xstrdup(_service), *service = service_buf;
 
@@ -228,9 +236,6 @@
 
 				const char *const services = lsb_v2s(service);
 				if (services != NULL) {
-					void relation_add_mark_real_service(char *service, void *arg) {
-						relation_add_oneservice(service, arg_p);
-					}
 					services_foreach(services, (services_foreach_funct_t)relation_add_mark_real_service, NULL);
 				}
 				break;
@@ -302,6 +307,35 @@
 	return r;
 }
 
+static char *services_unrolled_ptr = NULL;
+static char *services_unrolled_end = NULL;
+
+static void parse_insserv_parse_service(char *service, void *arg) {
+    const char *services;
+    switch (*service) {
+        case '$':
+            service++;
+            services = lsb_v2s(service);
+            break;
+        default:
+            services = service;
+            break;
+    }
+    if (services == NULL)
+        return;
+
+    size_t len = strlen(services);
+
+    if (&services_unrolled_ptr[len] >= services_unrolled_end) {
+        fprintf(stderr, "Error: Too long field value.\n");
+        exit(EOVERFLOW);
+    }
+
+    memcpy(services_unrolled_ptr, services, len);
+    services_unrolled_ptr = &services_unrolled_ptr[len];
+    *(services_unrolled_ptr++) = ' ';
+}
+
 void parse_insserv()
 {
 	FILE *file_insserv = fopen(PATH_INSSERV, "r");
@@ -340,34 +374,9 @@
 			/* $virtual:	+service +service +service +service	*/
 			/*			      services			*/
 
-			char services_unrolled[BUFSIZ], *services_unrolled_ptr = services_unrolled, *services_unrolled_end = &services_unrolled[BUFSIZ];
-
-			void parse_insserv_parse_service(char *service, void *arg) {
-				const char *services;
-				switch (*service) {
-					case '$':
-						service++;
-						services = lsb_v2s(service);
-						break;
-					default:
-						services = service;
-						break;
-				}
-				if (services == NULL)
-					return;
-
-				size_t len = strlen(services);
-
-				if (&services_unrolled_ptr[len] >= services_unrolled_end) {
-					fprintf(stderr, "Error: Too long field value.\n");
-					exit(EOVERFLOW);
-				}
-
-				memcpy(services_unrolled_ptr, services, len);
-				services_unrolled_ptr = &services_unrolled_ptr[len];
-				*(services_unrolled_ptr++) = ' ';
-			}
-
+            char services_unrolled[BUFSIZ];
+            services_unrolled_ptr = services_unrolled;
+            services_unrolled_end = &services_unrolled[BUFSIZ];
 			services_foreach(services, (services_foreach_funct_t)parse_insserv_parse_service, NULL);
 			*(--services_unrolled_ptr) = 0;
 

Reply via email to