[cpl-plugin-vimos] 01/01: Make irplib gcc5 compatible.
Ole Streicher
olebole at moszumanska.debian.org
Sun Apr 19 13:18:27 UTC 2015
This is an automated email from the git hooks/post-receive script.
olebole pushed a commit to branch debian
in repository cpl-plugin-vimos.
commit 384115a1081a6df486ded2e148c118c4f8edc590
Author: Ole Streicher <olebole at debian.org>
Date: Sun Apr 19 15:18:21 2015 +0200
Make irplib gcc5 compatible.
---
debian/changelog | 2 +
debian/patches/fix_irplib_gcc5.patch | 110 +++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 113 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index eb92106..db0700b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ cpl-plugin-vimos (2.9.15+dfsg-2) UNRELEASED; urgency=low
* Update maintainer e-mail
* Update standards version to 3.9.6. No changes needed.
* Add simple CI test
+ * Make irplib gcc5 compatible. Closes: #777825
+ * Increase tolerance to fix FTBS on mips64el. Closes: #774240
-- Ole Streicher <olebole at debian.org> Sun, 26 Oct 2014 14:02:45 +0100
diff --git a/debian/patches/fix_irplib_gcc5.patch b/debian/patches/fix_irplib_gcc5.patch
new file mode 100644
index 0000000..fa3b637
--- /dev/null
+++ b/debian/patches/fix_irplib_gcc5.patch
@@ -0,0 +1,110 @@
+From: jtaylor <jtaylor at 318c8218-2dab-440d-9263-6f70bac63e5b>
+Date: Fri, 31 Oct 2014 09:48:58 +0000
+Subject: [PATCH] make aligned allocator more robust to weird standard
+ requirements
+
+C11 requires size to be multiple of alignment, so extend the size
+internally. glibc does not require that and additionally does not require
+the alignment to be a power of two. In irplib requires this for all variants
+for consistency.
+--- a/irplib/irplib_utils.c
++++ b/irplib/irplib_utils.c
+@@ -1587,51 +1587,61 @@
+ /*----------------------------------------------------------------------------*/
+ void * irplib_aligned_malloc(size_t alignment, size_t size)
+ {
+-#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L
+- return aligned_alloc(alignment, size);
+-#elif defined HAVE_POSIX_MEMALIGN && defined HAVE_DECL_POSIX_MEMALIGN
+- void *ptr;
+- if (alignment == 1)
+- return malloc (size);
+- if (alignment == 2 || (sizeof (void *) == 8 && alignment == 4))
+- alignment = sizeof (void *);
+- if (posix_memalign (&ptr, alignment, size) == 0)
+- return ptr;
+- else
+- return NULL;
+-#else
+- /* copied from gmm_malloc.h in gcc-4.8 */
+- void * malloc_ptr;
+- void * aligned_ptr;
+-
++ if (alignment == 0)
++ alignment = 1;
+ /* Error if align is not a power of two. */
+ if (alignment & (alignment - 1)) {
+ errno = EINVAL;
+ return NULL;
+ }
++ /* make size a multiple of alignment (required by C11) */
++ if ((size % alignment) != 0) {
++ size += alignment - (size % alignment);
++ }
+
+- if (size == 0)
+- return NULL;
+-
+- /* Assume malloc'd pointer is aligned at least to sizeof (void*).
+- If necessary, add another sizeof (void*) to store the value
+- returned by malloc. Effectively this enforces a minimum alignment
+- of sizeof double. */
+- if (alignment < 2 * sizeof (void *))
+- alignment = 2 * sizeof (void *);
+-
+- malloc_ptr = malloc (size + alignment);
+- if (!malloc_ptr)
+- return NULL;
+-
+- /* Align We have at least sizeof (void *) space below malloc'd ptr. */
+- aligned_ptr = (void *) (((size_t) malloc_ptr + alignment)
+- & ~((size_t) (alignment) - 1));
++#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L
++ return aligned_alloc(alignment, size);
++#elif defined HAVE_POSIX_MEMALIGN && defined HAVE_DECL_POSIX_MEMALIGN
++ {
++ void *ptr;
++ if (alignment == 1)
++ return malloc (size);
++ if (alignment == 2 || (sizeof (void *) == 8 && alignment == 4))
++ alignment = sizeof (void *);
++ if (posix_memalign (&ptr, alignment, size) == 0)
++ return ptr;
++ else
++ return NULL;
++ }
++#else
++ /* copied from gmm_malloc.h in gcc-4.8 */
++ {
++ void * malloc_ptr;
++ void * aligned_ptr;
++
++ if (size == 0)
++ return NULL;
++
++ /* Assume malloc'd pointer is aligned at least to sizeof (void*).
++ If necessary, add another sizeof (void*) to store the value
++ returned by malloc. Effectively this enforces a minimum alignment
++ of sizeof double. */
++ if (alignment < 2 * sizeof (void *))
++ alignment = 2 * sizeof (void *);
++
++ malloc_ptr = malloc (size + alignment);
++ if (!malloc_ptr)
++ return NULL;
++
++ /* Align We have at least sizeof (void *) space below malloc'd ptr. */
++ aligned_ptr = (void *) (((size_t) malloc_ptr + alignment)
++ & ~((size_t) (alignment) - 1));
+
+- /* Store the original pointer just before p. */
+- *(((void **) aligned_ptr) - 1) = malloc_ptr;
++ /* Store the original pointer just before p. */
++ *(((void **) aligned_ptr) - 1) = malloc_ptr;
+
+- return aligned_ptr;
++ return aligned_ptr;
++ }
+ #endif
+ }
+
diff --git a/debian/patches/series b/debian/patches/series
index 48b3af0..3650c12 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,3 +6,4 @@ dont_build_sextractor.patch
shlib-calls-exit.patch
fix_test_fail.patch
force-serial-tests.patch
+fix_irplib_gcc5.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-astro/packages/cpl-plugin-vimos.git
More information about the debian-science-commits
mailing list