Control: tag -1 patch

On Mon Feb 17, 2025 at 6:37 PM CET, Matthias Klose wrote:
> Package: src:mcpp
> Version: 2.7.2-5.2
> Severity: serious
> Tags: sid forky ftbfs
> User: [email protected]
> Usertags: ftbfs-gcc-15
>
> [Updated Severity and Tags to current status]
>
> The package fails to build in a test rebuild on at least amd64 with
> gcc-15/g++-15, but succeeds to build with gcc-14/g++-14.

In the repository where the fix for GCC 14 build failures came from also
contained fixes for build failures against GCC 15.
That repo is https://github.com/jbrandwood/mcpp.

It also has an issue (still) open for the GCC 15 failures:
https://github.com/jbrandwood/mcpp/issues/1

Technically in the current upstream project there is a similar issue
open: https://sourceforge.net/p/mcpp/bugs/17/.
But it looks like that repo hasn't seen activity for > 15 years, so
maybe it's a good idea to switch upstream to jbrandwood's fork?

Anyway, I grabbed 2 commits from that fork, but had to adjust context of
one of them as we don't have all that forks commits (ie improvements).

Patch attached.
I also submitted that as MR on Salsa and CI now succeeds:
https://salsa.debian.org/debian/mcpp/-/merge_requests/3

Cheers,
  Diederik
From 56a7012db05fb3f022a8b2429375fd7ed80c91dc Mon Sep 17 00:00:00 2001
From: Diederik de Haas <[email protected]>
Date: Fri, 5 Sep 2025 11:58:35 +0200
Subject: [PATCH] Fix GCC-15 build failures (Closes: #1097375)

The 'original' upstream on sourceforge seems to be abandoned, but 'John
Brandwood' made a fork on GitHub where the GCC 14 fix also came from.

In their repo an issue was created for the GCC 15 issue and he provided
a fix in that issue, but also committed it to their repo in commit
c326468d6c54 ("Fix configure.ac failing to define LL_FORM when using GCC v15.")

As that fork also applied other changes, including applying (modified
versions of) Debian patches, adjust the context of the patch so that it
applies to what Debian currently has.

Next to the direct fix to configure.ac which prevented the build from
starting all together, GCC 15 is also more strict and it doesn't like
labels with value 'true' or 'false'.
That issue is also fixed in the fork with commit
1d65736ca2c1 ("Stop using "true" and "false" as label names in system.c, it breaks modern C!")

Link: https://bugs.debian.org/1097375
Link: https://github.com/jbrandwood/mcpp/issues/1
Link: https://github.com/jbrandwood/mcpp/commit/c326468d6c5437e0c846eabbc2f5cf501143d66d
Link: https://github.com/jbrandwood/mcpp/commit/1d65736ca2c10328916ed6c98e6422a784da187a
Signed-off-by: Diederik de Haas <[email protected]>
---
 ...-failing-to-define-LL_FORM-when-usin.patch | 28 ++++++++++
 ...and-false-as-label-names-in-system.c.patch | 52 +++++++++++++++++++
 debian/patches/series                         |  2 +
 3 files changed, 82 insertions(+)
 create mode 100644 debian/patches/0009-Fix-configure.ac-failing-to-define-LL_FORM-when-usin.patch
 create mode 100644 debian/patches/0010-Stop-using-true-and-false-as-label-names-in-system.c.patch

diff --git a/debian/patches/0009-Fix-configure.ac-failing-to-define-LL_FORM-when-usin.patch b/debian/patches/0009-Fix-configure.ac-failing-to-define-LL_FORM-when-usin.patch
new file mode 100644
index 0000000..e509248
--- /dev/null
+++ b/debian/patches/0009-Fix-configure.ac-failing-to-define-LL_FORM-when-usin.patch
@@ -0,0 +1,28 @@
+From: John Brandwood <[email protected]>
+Date: Fri, 9 May 2025 11:16:51 -0400
+Subject: Fix configure.ac failing to define LL_FORM when using GCC v15.
+Origin: https://github.com/jbrandwood/mcpp.git/commit/c326468d6c5437e0c846eabbc2f5cf501143d66d
+
+---
+ configure.ac | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 29d4452..11841df 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -207,9 +207,9 @@ AC_DEFUN([AC_CHECK_MOD_LL], [
+         [ac_cv_c_printf_modifier],
+         AC_RUN_IFELSE([AC_LANG_SOURCE([
+ #include    <stdio.h>
++#include    <stdlib.h>
++#include    <string.h>
+ #include    <assert.h>
+-    int     strcmp();
+-    void    exit();
+ $3
+ int main( void)
+ {   char    buf@<:@ 20@:>@;
+-- 
+2.51.0
+
diff --git a/debian/patches/0010-Stop-using-true-and-false-as-label-names-in-system.c.patch b/debian/patches/0010-Stop-using-true-and-false-as-label-names-in-system.c.patch
new file mode 100644
index 0000000..4ad6d8a
--- /dev/null
+++ b/debian/patches/0010-Stop-using-true-and-false-as-label-names-in-system.c.patch
@@ -0,0 +1,52 @@
+From: John Brandwood <[email protected]>
+Date: Fri, 9 May 2025 11:24:24 -0400
+Subject: Stop using "true" and "false" as label names in system.c, it breaks
+ modern C!
+Origin: https://github.com/jbrandwood/mcpp.git/commit/1d65736ca2c10328916ed6c98e6422a784da187a
+
+---
+ src/system.c | 9 ++++-----
+ 1 file changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/src/system.c b/src/system.c
+index cb21e99..a6ff95b 100644
+--- a/src/system.c
++++ b/src/system.c
+@@ -3450,7 +3450,7 @@ search:
+     if (! fullname)                 /* Non-existent or directory    */
+         return  FALSE;
+     if (standard && included( fullname))        /* Once included    */
+-        goto  true;
++        return  TRUE;
+         
+     if ((max_open != 0 && max_open <= include_nest)
+                             /* Exceed the known limit of open files */
+@@ -3477,12 +3477,12 @@ search:
+         if ((fp = fopen( fullname, "r")) == NULL) {
+             file->fp = fopen( cur_fullname, "r");
+             fseek( file->fp, file->pos, SEEK_SET);
+-            goto  false;
++            goto  failed;
+         }
+         if (max_open == 0)      /* Remember the limit of the system */
+             max_open = include_nest;
+     } else if (fp == NULL)                  /* No read permission   */ 
+-        goto  false;
++        goto  failed;
+     /* Truncate buffer of the includer to save memory   */
+     len = (int) (file->bptr - file->buffer);
+     if (len) {
+@@ -3529,9 +3529,8 @@ search:
+     if (mkdep && ((mkdep & MD_SYSHEADER) || ! infile->sys_header))
+         put_depend( fullname);          /* Output dependency line   */
+ 
+-true:
+     return  TRUE;
+-false:
++failed:
+     free( fullname);
+     return  FALSE;
+ }
+-- 
+2.51.0
+
diff --git a/debian/patches/series b/debian/patches/series
index 052bf14..deae9b5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,3 +6,5 @@
 06-gniibe-fix-autotools.patch
 07-fix-16.patch
 fix-implicit-function-declaration.patch
+0009-Fix-configure.ac-failing-to-define-LL_FORM-when-usin.patch
+0010-Stop-using-true-and-false-as-label-names-in-system.c.patch
-- 
2.51.0

Attachment: signature.asc
Description: PGP signature

Reply via email to