[med-svn] r16542 - in trunk/packages/altree/trunk/debian: . patches
Vincent Danjean
vdanjean at moszumanska.debian.org
Sun Mar 30 21:55:31 UTC 2014
Author: vdanjean
Date: 2014-03-30 21:55:31 +0000 (Sun, 30 Mar 2014)
New Revision: 16542
Added:
trunk/packages/altree/trunk/debian/patches/from-upstream-no-nested-functions.patch
trunk/packages/altree/trunk/debian/patches/series
Modified:
trunk/packages/altree/trunk/debian/changelog
Log:
Avoid nested C function
Fix "FTBFS with clang instead of gcc"
clang does not support nested functions so removing them.
Instead of inlining the nested function as proposed in the
submitted patch (thanks Arthur <arthur at info9.net>),
use a external function with an explicit context (Closes: #742843)
Modified: trunk/packages/altree/trunk/debian/changelog
===================================================================
--- trunk/packages/altree/trunk/debian/changelog 2014-03-30 20:45:13 UTC (rev 16541)
+++ trunk/packages/altree/trunk/debian/changelog 2014-03-30 21:55:31 UTC (rev 16542)
@@ -1,3 +1,13 @@
+altree (1.3.1-2) unstable; urgency=medium
+
+ * Fix "FTBFS with clang instead of gcc"
+ clang does not support nested functions so removing them.
+ Instead of inlining the nested function as proposed in the submitted
+ patch (thanks Arthur <arthur at info9.net>), use a external function
+ with an explicit context (Closes: #742843)
+
+ -- Vincent Danjean <vdanjean at debian.org> Sun, 30 Mar 2014 23:43:51 +0200
+
altree (1.3.1-1) unstable; urgency=low
* New upstream release
Added: trunk/packages/altree/trunk/debian/patches/from-upstream-no-nested-functions.patch
===================================================================
--- trunk/packages/altree/trunk/debian/patches/from-upstream-no-nested-functions.patch (rev 0)
+++ trunk/packages/altree/trunk/debian/patches/from-upstream-no-nested-functions.patch 2014-03-30 21:55:31 UTC (rev 16542)
@@ -0,0 +1,105 @@
+Avoid nested C functions
+--- a/CUtils/c_sources/rhyper.c
++++ b/CUtils/c_sources/rhyper.c
+@@ -52,55 +52,61 @@
+ * If (i > 7), use Stirling's approximation, otherwise use table lookup.
+ */
+
+-static double afc(int i)
+-{
+- static int computed=10;
+- static double al[1756] =
+- {
+- 0.0,
+- 0,/*ln(0!)*/
+- 0,/*ln(1!)*/
+- 0.693147180559945309,/*ln(2!)*/
+- 1.791759469228055,/*ln(3!)*/
+- 3.17805383034794562,/*ln(4!)*/
+- 4.78749174278204599,/*ln(5!)*/
+- 6.579251212010101,/*ln(6!)*/
+- 8.5251613610654143,/*ln(7!)*/
+- 10.6046029027452502,/*ln(8!)*/
+- 12.8018274800814696,/*ln(9!)*/
+- 15.1044125730755153,/*ln(10!)*/
+- };
+- double compute(int n) {
+- static long double cur=3628800;
+- static int i=11;
+- static volatile int mutex=0;
+-
+- while (__sync_lock_test_and_set(&mutex, 1)) {
+- /* Internal loop with only read to avoid cache line ping-pong
+- on multi-processors */
+- while(mutex) {
+- /* spinlock */
+- }
+- }
++struct afc_data {
++ int computed;
++ double al[1756];
++};
++
++double compute(int n, struct afc_data * __restrict__ data) {
++ static long double cur=3628800;
++ static int i=11;
++ static volatile int mutex=0;
+
+- for(; i<=n; i++) {
+- cur*=i;
+- al[i+1]=logl(cur);
++ while (__sync_lock_test_and_set(&mutex, 1)) {
++ /* Internal loop with only read to avoid cache line ping-pong
++ on multi-processors */
++ while(mutex) {
++ /* spinlock */
+ }
+- computed=n;
+- __sync_lock_release(&mutex);
+- return al[i];
+- };
++ }
+
++ for(; i<=n; i++) {
++ cur*=i;
++ data->al[i+1]=logl(cur);
++ }
++ data->computed=n;
++ __sync_lock_release(&mutex);
++ return data->al[i];
++};
++
++static double afc(int i)
++{
+ double di, value;
++ static struct afc_data data = {
++ .computed = 10,
++ .al = {
++ 0.0,
++ 0,/*ln(0!)*/
++ 0,/*ln(1!)*/
++ 0.693147180559945309,/*ln(2!)*/
++ 1.791759469228055,/*ln(3!)*/
++ 3.17805383034794562,/*ln(4!)*/
++ 4.78749174278204599,/*ln(5!)*/
++ 6.579251212010101,/*ln(6!)*/
++ 8.5251613610654143,/*ln(7!)*/
++ 10.6046029027452502,/*ln(8!)*/
++ 12.8018274800814696,/*ln(9!)*/
++ 15.1044125730755153,/*ln(10!)*/
++ }
++ };
+
+ if (i < 0) {
+ fprintf(stderr, "rhyper.c: afc(i), i=%d < 0 -- SHOULD NOT HAPPEN!\n", i);
+ exit(1);
+- } else if (i <= computed) {
+- value = al[i + 1];
++ } else if (i <= data.computed) {
++ value = data.al[i + 1];
+ } else if (i <= 1754) {
+- value = compute(i);
++ value = compute(i, &data);
+ } else {
+ di = i;
+ value = (di + 0.5) * log(di) - di + 0.08333333333333 / di
Added: trunk/packages/altree/trunk/debian/patches/series
===================================================================
--- trunk/packages/altree/trunk/debian/patches/series (rev 0)
+++ trunk/packages/altree/trunk/debian/patches/series 2014-03-30 21:55:31 UTC (rev 16542)
@@ -0,0 +1 @@
+from-upstream-no-nested-functions.patch
More information about the debian-med-commit
mailing list