Index | Thread | Search

From:
Claudio Jeker <cjeker@diehard.n-r-g.com>
Subject:
backport commit to audio/adplay for gcc15
To:
ports@openbsd.org
Date:
Thu, 4 Dec 2025 17:38:43 +0100

Download raw body.

Thread
gcc15 defines std::max and std::min so using min() and max() macros
clashes with these functions.

Upstream fixed this issue in 95d47d7dcf65a4f0e7371f193c8d936b4e1adc77 but
there has not been a new release with that fix. I just pulled it out of
their git repo.

-- 
:wq Claudio

Index: patches/patch-src_defines_h
===================================================================
RCS file: patches/patch-src_defines_h
diff -N patches/patch-src_defines_h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_defines_h	4 Dec 2025 12:39:08 -0000
@@ -0,0 +1,23 @@
+commit 95d47d7dcf65a4f0e7371f193c8d936b4e1adc77
+
+Rename min/max macros to uppercase
+
+Index: src/defines.h
+--- src/defines.h.orig
++++ src/defines.h
+@@ -34,11 +34,11 @@
+ #define MSG_NOTE	3
+ #define MSG_DEBUG	4
+ 
+-#ifndef min
+-#  define min(a,b) (((a) < (b)) ? (a) : (b))
++#ifndef MIN
++#  define MIN(a,b) (((a) < (b)) ? (a) : (b))
+ #endif
+-#ifndef max
+-#  define max(a,b) (((a) > (b)) ? (a) : (b))
++#ifndef MAX
++#  define MAX(a,b) (((a) > (b)) ? (a) : (b))
+ #endif
+ 
+ /***** Global functions *****/
Index: patches/patch-src_output_cc
===================================================================
RCS file: patches/patch-src_output_cc
diff -N patches/patch-src_output_cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_output_cc	4 Dec 2025 12:39:08 -0000
@@ -0,0 +1,21 @@
+commit 95d47d7dcf65a4f0e7371f193c8d936b4e1adc77
+
+Rename min/max macros to uppercase
+
+Index: src/output.cc
+--- src/output.cc.orig
++++ src/output.cc
+@@ -70,11 +70,11 @@ void EmuPlayer::frame()
+       minicnt += freq;
+       playing = p->update();
+     }
+-    i = min(towrite, (long)(minicnt / p->getrefresh() + 4) & ~3);
++    i = MIN(towrite, (long)(minicnt / p->getrefresh() + 4) & ~3);
+     opl->update((short *)pos, i);
+     pos += i * getsampsize(); towrite -= i;
+     i = (long)(p->getrefresh() * i);
+-    minicnt -= max(1, i);
++    minicnt -= MAX(1, i);
+   }
+ 
+   // call output driver
Index: patches/patch-src_sdl_cc
===================================================================
RCS file: patches/patch-src_sdl_cc
diff -N patches/patch-src_sdl_cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_sdl_cc	4 Dec 2025 12:39:08 -0000
@@ -0,0 +1,16 @@
+commit 95d47d7dcf65a4f0e7371f193c8d936b4e1adc77
+
+Rename min/max macros to uppercase
+
+Index: src/sdl.cc
+--- src/sdl.cc.orig
++++ src/sdl.cc
+@@ -75,7 +75,7 @@ void SDLPlayer::callback(void *userdata, Uint8 *audiob
+       minicnt += self->spec.freq;
+       self->playing = self->p->update();
+     }
+-    i = min(towrite, (long)(minicnt / self->p->getrefresh() + 4) & ~3);
++    i = MIN(towrite, (long)(minicnt / self->p->getrefresh() + 4) & ~3);
+     self->opl->update((short *)pos, i);
+     pos += i * self->getsampsize(); towrite -= i;
+     minicnt -= (long)(self->p->getrefresh() * i);