Control: tags -1 + patch

[Santiago Vila]
> During a rebuild of all packages in unstable, your package failed to
> build:

The attached patch get the package building in unstable.  Note, I am
unsure about the portability of the U change.

-- 
Happy hacking
Petter Reinholdtsen
>From a7a1595cd6f8c626e0e948b956a91c82c205c12f Mon Sep 17 00:00:00 2001
From: Petter Reinholdtsen <p...@hungry.com>
Date: Fri, 14 Feb 2025 13:03:22 +0000
Subject: [PATCH] Fixed configure and build problem with newer GCC.

Closes: #1081077
---
 debian/patches/150-configure-signatures.patch | 117 ++++++++++++++++++
 debian/patches/series                         |   1 +
 2 files changed, 118 insertions(+)
 create mode 100644 debian/patches/150-configure-signatures.patch

diff --git a/debian/patches/150-configure-signatures.patch b/debian/patches/150-configure-signatures.patch
new file mode 100644
index 0000000..f2fb7f2
--- /dev/null
+++ b/debian/patches/150-configure-signatures.patch
@@ -0,0 +1,117 @@
+Description: Fix build problems with current unstable
+ Convert U"string" to U "string" and provide definition of U when
+ HAVE_UCHAR is not set.  Note, I suspect this will not work properly
+ when HAVE_UCHAR is set.
+ 
+ Added missing or correct function prototypes and signatures to make
+ current GCC happy even when STDC_HEADERS is missing for some strange
+ reason.
+Author: Petter Reinholdtsen <p...@debian.org>
+Bug-Debian: https://bugs.debian.org/1081077
+Forwarded: no
+Last-Update: 2025-02-14
+---
+--- gcc-h8300-hms-3.4.6+dfsg2.orig/gcc/cpphash.h
++++ gcc-h8300-hms-3.4.6+dfsg2/gcc/cpphash.h
+@@ -47,8 +47,10 @@ struct cset_converter
+ 
+ #ifndef HAVE_UCHAR
+ typedef unsigned char uchar;
+-#endif
++#define U (const char *)
++#else
+ #define U (const uchar *)  /* Intended use: U"string" */
++#endif
+ 
+ #define BITS_PER_CPPCHAR_T (CHAR_BIT * sizeof (cppchar_t))
+ 
+--- gcc-h8300-hms-3.4.6+dfsg2.orig/gcc/cpplex.c
++++ gcc-h8300-hms-3.4.6+dfsg2/gcc/cpplex.c
+@@ -39,7 +39,7 @@ struct token_spelling
+ };
+ 
+ static const unsigned char *const digraph_spellings[] =
+-{ U"%:", U"%:%:", U"<:", U":>", U"<%", U"%>" };
++{ U "%:", U "%:%:", U "<:", U ":>", U "<%", U "%>" };
+ 
+ #define OP(e, s) { SPELL_OPERATOR, U s           },
+ #define TK(e, s) { s,              U #e },
+--- gcc-h8300-hms-3.4.6+dfsg2.orig/gcc/cpplib.c
++++ gcc-h8300-hms-3.4.6+dfsg2/gcc/cpplib.c
+@@ -191,7 +191,7 @@ DIRECTIVE_TABLE
+    did use this notation in its preprocessed output.  */
+ static const directive linemarker_dir =
+ {
+-  do_linemarker, U"#", 1, KANDR, IN_I
++  do_linemarker, U "#", 1, KANDR, IN_I
+ };
+ 
+ #define SEEN_EOL() (pfile->cur_token[-1].type == CPP_EOF)
+@@ -656,7 +656,7 @@ parse_include (cpp_reader *pfile, int *p
+       const unsigned char *dir;
+ 
+       if (pfile->directive == &dtable[T_PRAGMA])
+-	dir = U"pragma dependency";
++	dir = U "pragma dependency";
+       else
+ 	dir = pfile->directive->name;
+       cpp_error (pfile, CPP_DL_ERROR, "#%s expects \"FILENAME\" or <FILENAME>",
+--- gcc-h8300-hms-3.4.6+dfsg2.orig/gcc/cppmacro.c
++++ gcc-h8300-hms-3.4.6+dfsg2/gcc/cppmacro.c
+@@ -220,8 +220,8 @@ _cpp_builtin_macro_text (cpp_reader *pfi
+ 	      cpp_errno (pfile, CPP_DL_WARNING,
+ 			 "could not determine date and time");
+ 		
+-	      pfile->date = U"\"??? ?? ????\"";
+-	      pfile->time = U"\"??:??:??\"";
++	      pfile->date = U "\"??? ?? ????\"";
++	      pfile->time = U "\"??:??:??\"";
+ 	    }
+ 	}
+ 
+--- gcc-h8300-hms-3.4.6+dfsg2.orig/intl/configure
++++ gcc-h8300-hms-3.4.6+dfsg2/intl/configure
+@@ -1148,7 +1148,7 @@ cat > conftest.$ac_ext << EOF
+ #line 1149 "configure"
+ #include "confdefs.h"
+ 
+-main(){return(0);}
++int main(){return(0);}
+ EOF
+ if { (eval echo configure:1154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   ac_cv_prog_cc_works=yes
+@@ -1833,7 +1833,7 @@ find_stack_direction ()
+   else
+     return (&dummy > addr) ? 1 : -1;
+ }
+-main ()
++int main ()
+ {
+   exit (find_stack_direction() < 0);
+ }
+--- gcc-h8300-hms-3.4.6+dfsg2.orig/libiberty/md5.c
++++ gcc-h8300-hms-3.4.6+dfsg2/libiberty/md5.c
+@@ -33,6 +33,8 @@
+ #else
+ # ifndef HAVE_MEMCPY
+ #  define memcpy(d, s, n) bcopy ((s), (d), (n))
++# else
++void *memcpy(void *, const void*, long unsigned int);
+ # endif
+ #endif
+ 
+--- gcc-h8300-hms-3.4.6+dfsg2.orig/libiberty/regex.c
++++ gcc-h8300-hms-3.4.6+dfsg2/libiberty/regex.c
+@@ -129,8 +129,10 @@
+ #  if defined STDC_HEADERS || defined _LIBC
+ #   include <stdlib.h>
+ #  else
+-char *malloc ();
+-char *realloc ();
++void *malloc (long unsigned int);
++void *realloc (void *, long unsigned int);
++void free(void*);
++void abort(void);
+ #  endif
+ 
+ /* When used in Emacs's lib-src, we need to get bzero and bcopy somehow.
diff --git a/debian/patches/series b/debian/patches/series
index 2294e81..47ccd0b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -26,3 +26,4 @@ bin_false_fixup
 configure-update
 debian-changes-1:3.4.6+dfsg-1
 fix_ftbs.diff
+150-configure-signatures.patch
-- 
2.47.2

Reply via email to