ghostscript: fix build with gcc-15 on host

(From OE-Core rev: 02e282f6417274a93c6f01978bf33e2d171297b0)

Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Martin Jansa 2025-04-26 19:08:22 +02:00 committed by Richard Purdie
parent 98f2376d82
commit bbdb4ffea5
2 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,67 @@
From c595086bfe206776676e290df98cd09e91210e27 Mon Sep 17 00:00:00 2001
From: Alex Cherepanov <alex@coscript.biz>
Date: Thu, 3 Apr 2025 17:19:41 +0100
Subject: [PATCH] Bug 708160: Fix compatibility with C23 compilers
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* fixes:
http://errors.yoctoproject.org/Errors/Details/853021/
In file included from ./base/genconf.c:18:
./base/stdpre.h:348:13: error: bool cannot be defined via typedef
348 | typedef int bool;
| ^~~~
./base/stdpre.h:348:13: note: bool is a keyword with -std=c23 onwards
./base/stdpre.h:348:1: warning: useless type name in empty declaration
348 | typedef int bool;
| ^~~~~~~
Upstream-Status: Backport [Partial backport of https://cgit.ghostscript.com/cgi-bin/cgit.cgi/ghostpdl.git/commit/base/stdpre.h?id=ae940946473ceb8c5353bc6e7f04673c6e60502d]
Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
---
base/stdpre.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/base/stdpre.h b/base/stdpre.h
index dda30b6..2f9c84e 100644
--- a/base/stdpre.h
+++ b/base/stdpre.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2023 Artifex Software, Inc.
+/* Copyright (C) 2001-2025 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -341,7 +341,9 @@ typedef signed char schar;
* and the MetroWerks C++ compiler insists that bool be equivalent to
* unsigned char.
*/
-#ifndef __cplusplus
+
+/* C23 has bool as a builtin type. */
+#if !defined(__cplusplus) && (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L)
#ifdef __BEOS__
typedef unsigned char bool;
#else
diff --git a/base/gp.h b/base/gp.h
index ad5bb61..cf2c9cf 100644
--- a/base/gp.h
+++ b/base/gp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2023 Artifex Software, Inc.
+/* Copyright (C) 2001-2025 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -646,7 +646,7 @@ int gp_fseek_impl(FILE *strm, gs_offset_t offset, int origin);
/* Create a second open gp_file on the basis of a given one */
FILE *gp_fdup_impl(FILE *f, const char *mode);
-int gp_fseekable_impl(FILE *f);
+bool gp_fseekable_impl(FILE *f);
/* Force given file into binary mode (no eol translations, etc) */
/* if 2nd param true, text mode if 2nd param false */

View File

@ -25,6 +25,7 @@ def gs_verdir(v):
SRC_URI = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${@gs_verdir("${PV}")}/${BPN}-${PV}.tar.gz \ SRC_URI = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${@gs_verdir("${PV}")}/${BPN}-${PV}.tar.gz \
file://ghostscript-9.16-Werror-return-type.patch \ file://ghostscript-9.16-Werror-return-type.patch \
file://avoid-host-contamination.patch \ file://avoid-host-contamination.patch \
file://0001-Bug-708160-Fix-compatibility-with-C23-compilers.patch \
" "
SRC_URI[sha256sum] = "56e77833de683825c420d0af8cb90aa8ba7da71ea6fb5624290cbc1b53fe7942" SRC_URI[sha256sum] = "56e77833de683825c420d0af8cb90aa8ba7da71ea6fb5624290cbc1b53fe7942"