Hi,

On Tue, Sep 07, 2021 at 09:24:31PM +0200, Christian Weisgerber wrote:
> lang/ghc                The OpenBSD ports mailing-list <ports@openbsd.org>

Untested patch -- I'll probably get a test build with it together
with all ports depending on ghc tomorrow, but if anyone want's to
beat me ...

Ciao,
        Kili

Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/ghc/Makefile,v
retrieving revision 1.188
diff -u -p -r1.188 Makefile
--- Makefile    16 Aug 2021 21:23:18 -0000      1.188
+++ Makefile    7 Sep 2021 20:42:00 -0000
@@ -19,6 +19,8 @@ DISTNAME =            ghc-${GHC_VERSION}
 CATEGORIES =           lang devel
 HOMEPAGE =             https://www.haskell.org/ghc/
 
+REVISION =             0
+
 # Version of the precompiled binaries
 BIN_VER =              8.10.3.20210429
 
Index: patches/patch-rts_Stats_c
===================================================================
RCS file: patches/patch-rts_Stats_c
diff -N patches/patch-rts_Stats_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-rts_Stats_c   7 Sep 2021 20:42:00 -0000
@@ -0,0 +1,53 @@
+$OpenBSD$
+
+Kill use of %n format specifier.
+
+Index: rts/Stats.c
+--- rts/Stats.c.orig
++++ rts/Stats.c
+@@ -69,7 +69,7 @@ static Time *GC_coll_cpu = NULL;
+ static Time *GC_coll_elapsed = NULL;
+ static Time *GC_coll_max_pause = NULL;
+ 
+-static void statsPrintf( char *s, ... ) GNUC3_ATTRIBUTE(format (PRINTF, 1, 
2));
++static int statsPrintf( char *s, ... ) GNUC3_ATTRIBUTE(format (PRINTF, 1, 2));
+ static void statsFlush( void );
+ static void statsClose( void );
+ 
+@@ -1024,8 +1024,10 @@ static void report_summary(const RTSSummaryStats* sum)
+ 
+         for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
+             int prefix_length = 0;
+-            statsPrintf("%*s" "gen[%" FMT_Word32 "%n",
+-                        col_width[0], "", g, &prefix_length);
++            prefix_length = statsPrintf("%*s" "gen[%" FMT_Word32,
++                        col_width[0], "", g);
++            if (prefix_length < 0)
++                prefix_length = 0;
+             prefix_length -= col_width[0];
+             int suffix_length = col_width[1] + prefix_length;
+             suffix_length =
+@@ -1735,9 +1737,10 @@ void getRTSStats( RTSStats *s )
+    Dumping stuff in the stats file, or via the debug message interface
+    -------------------------------------------------------------------------- 
*/
+ 
+-void
++int
+ statsPrintf( char *s, ... )
+ {
++    int ret = 0;
+     FILE *sf = RtsFlags.GcFlags.statsFile;
+     va_list ap;
+ 
+@@ -1745,9 +1748,10 @@ statsPrintf( char *s, ... )
+     if (sf == NULL) {
+         vdebugBelch(s,ap);
+     } else {
+-        vfprintf(sf, s, ap);
++        ret = vfprintf(sf, s, ap);
+     }
+     va_end(ap);
++    return ret;
+ }
+ 
+ static void

Reply via email to