plotutils: Fix build with a C23 compiler

The configure script auto-enables -std=gnu23 when it's available, but
the header that defines the boolean constants doesn't support C23,
breaking compilation.

Drop the unnecessary platforms line as suggested by 'port lint'.
This commit is contained in:
Clemens Lang
2026-04-13 23:04:34 +02:00
committed by nerdling
parent 90f11404f9
commit 775a161a7f
2 changed files with 29 additions and 2 deletions
+2 -2
View File
@@ -8,7 +8,6 @@ version 2.6
revision 5
conflicts bsd-plotutils
categories graphics
platforms darwin
maintainers {snc @nerdling} openmaintainer
license GPL-3+
@@ -30,7 +29,8 @@ checksums rmd160 2a32244eb20e00b82a0742dde7b690f688e82774 \
size 3657562
patchfiles patch-configure.ac.diff \
patch-libpng-1.5.diff
patch-libpng-1.5.diff \
patch-sys-defines.h-c23-compat.diff
use_autoreconf yes
@@ -0,0 +1,27 @@
Do not redefine bool constants in C23
C23 now includes predefined constants for the boolean values true and
false, and attempting to redefine them ends with a compiler error. Avoid
doing that by adjusting the preprocessor guard around that.
Upstream-Status: Submitted [email]
--- include/sys-defines.h.orig 2026-04-13 22:50:46
+++ include/sys-defines.h 2026-04-13 22:53:57
@@ -253,7 +253,7 @@
/* Support the `bool' datatype, which is used widely in this package. */
/**************************************************************************/
-#ifndef __cplusplus
+#if !defined(__cplusplus) && (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L)
#ifdef __STDC__
typedef enum { false = 0, true = 1 } bool;
#else /* not __STDC__, do things the old-fashioned way */
@@ -261,7 +261,7 @@
#define false 0
#define true 1
#endif /* not __STDC__ */
-#endif /* not __cplusplus */
+#endif /* not __cplusplus and (not __STDC_VERSION__ or __STDC_VERSION__ < 202311L) */
/**************************************************************************/
/* Define numerical constants (unofficial, so may not be in math.h). */