Unverified Commit af8e4dc7 authored by Robert Scott's avatar Robert Scott Committed by GitHub
Browse files

Merge pull request #270901 from a-n-n-a-l-e-e/spooles

spooles: fix compiler errors and link properly; fix darwin build
parents 73b5e1f0 771fc215
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
From cc153b180829c6b561765cbbb9b621d1142ff1cd Mon Sep 17 00:00:00 2001
From: annalee <150648636+a-n-n-a-l-e-e@users.noreply.github.com>
Date: Tue, 28 Nov 2023 13:13:44 +0000
Subject: [PATCH] use proper format specifier for size_t

---
 Utilities/MM.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Utilities/MM.h b/Utilities/MM.h
index 11e86c5..301c3ec 100644
--- a/Utilities/MM.h
+++ b/Utilities/MM.h
@@ -33,18 +33,18 @@ if ( (count) > 0 ) { \
    if ( (ptr = (type *)malloc((unsigned long)((count)*sizeof(type)))) \
         == NULL ) {\
       fprintf(stderr, \
-              "\n ALLOCATE failure : bytes %d, line %d, file %s", \
+              "\n ALLOCATE failure : bytes %zu, line %d, file %s", \
               (count)*sizeof(type), __LINE__, __FILE__) ; \
       exit(-1) ; } \
    else if ( MEMORY_DEBUG > 0 ) { \
       fprintf(stderr, \
-              "\n ALLOCATE : address %p, bytes %d, line %d, file %s", \
+              "\n ALLOCATE : address %p, bytes %zu, line %d, file %s", \
               ptr, (count)*sizeof(type), __LINE__, __FILE__) ; } } \
 else if ( (count) == 0 ) { \
    ptr = NULL ; } \
 else { \
    fprintf(stderr, \
-           "\n ALLOCATE error : bytes %d, line %d, file %s", \
+           "\n ALLOCATE error : bytes %zu, line %d, file %s", \
            (count)*sizeof(type), __LINE__, __FILE__) ; \
    exit(-1) ; }
 /*
-- 
2.42.0
+5 −1
Original line number Diff line number Diff line
@@ -13,10 +13,14 @@ stdenv.mkDerivation rec {

  patches = [
    ./spooles.patch
    # fix compiler error where NULL is used as a zero parameter
    ./transform.patch
    # use proper format specifier for size_t
    ./allocate.patch
  ];

  postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
    substituteInPlace makefile --replace '-Wl,-soname' '-Wl,-install_name'
    substituteInPlace makefile --replace "-Wl,-soname," "-Wl,-install_name,$out/lib/"
  '';

  buildPhase = ''
+43 −0
Original line number Diff line number Diff line
From c5d0574182d76af3bf286dce0bb147ae3f098916 Mon Sep 17 00:00:00 2001
From: annalee <150648636+a-n-n-a-l-e-e@users.noreply.github.com>
Date: Tue, 28 Nov 2023 12:57:18 +0000
Subject: [PATCH] fix compiler error: use zero, not NULL, in calls to IVinit

---
 ETree/src/transform.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ETree/src/transform.c b/ETree/src/transform.c
index 1e36981..dbdfc70 100644
--- a/ETree/src/transform.c
+++ b/ETree/src/transform.c
@@ -291,7 +291,7 @@ etree2 = ETree_compress(etree, mapIV) ;
    remap the nzeros[] vector
    -------------------------
 */
-temp = IVinit(nfront, NULL) ;
+temp = IVinit(nfront, 0) ;
 IVcopy(nfront, temp, nzeros) ;
 IV_setSize(nzerosIV, nnew) ;
 nzeros = IV_entries(nzerosIV) ;
@@ -453,7 +453,7 @@ etree2 = ETree_compress(etree, mapIV) ;
    remap the nzeros[] vector
    -------------------------
 */
-temp = IVinit(nfront, NULL) ;
+temp = IVinit(nfront, 0) ;
 IVcopy(nfront, temp, nzeros) ;
 IV_setSize(nzerosIV, nnew) ;
 nzeros = IV_entries(nzerosIV) ;
@@ -614,7 +614,7 @@ etree2 = ETree_compress(etree, mapIV) ;
    remap the nzeros[] vector
    -------------------------
 */
-temp = IVinit(nfront, NULL) ;
+temp = IVinit(nfront, 0) ;
 IVcopy(nfront, temp, nzeros) ;
 IV_setSize(nzerosIV, nnew) ;
 nzeros = IV_entries(nzerosIV) ;
-- 
2.42.0