commit:     ee416a879d94e6c9a14cc858480d5cb97aa1f89e
Author:     Mats Lidell <matsl <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 28 20:19:20 2024 +0000
Commit:     Mats Lidell <matsl <AT> gentoo <DOT> org>
CommitDate: Sat Sep 28 20:28:27 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee416a87

app-editors/xemacs: Add misalignment and va_args patches

Signed-off-by: Mats Lidell <matsl <AT> gentoo.org>

 .../xemacs/files/xemacs-21.5.35-misalignment.patch |  67 ++++++++
 .../xemacs/files/xemacs-21.5.35-va_args.patch      | 179 +++++++++++++++++++++
 ...-21.5.35-r3.ebuild => xemacs-21.5.35-r4.ebuild} |   2 +
 3 files changed, 248 insertions(+)

diff --git a/app-editors/xemacs/files/xemacs-21.5.35-misalignment.patch 
b/app-editors/xemacs/files/xemacs-21.5.35-misalignment.patch
new file mode 100644
index 000000000000..deb3ef36664a
--- /dev/null
+++ b/app-editors/xemacs/files/xemacs-21.5.35-misalignment.patch
@@ -0,0 +1,67 @@
+# HG changeset patch
+# User Aidan Kehoe <keh...@parhasard.net>
+# Date 1727073391 -3600
+#      Mon Sep 23 07:36:31 2024 +0100
+# Node ID 00eb7276ebb1a22e20e6f6b9b5247b196b44f3f1
+# Parent  d40990b854cf32198aea31eae0d60ce91ce0f4f7
+Avoid misaligned coding systems objects in the dump file,
+
+src/ChangeLog addition:
+
+2024-09-22  Aidan Kehoe  <keh...@parhasard.net>
+
+       * file-coding.c:
+       * file-coding.c (aligned_sizeof_coding_system): New.
+       * file-coding.c (allocate_coding_system): Use it.
+       Avoid misaligned coding systems objects in the dump file,
+       previously addressed for lstreams, specifiers, opaque data in
+       Martin Buchholz's change of 2001-01-24. Approach taken the same as
+       that for specifiers.
+       * file-coding.c (struct convert_eol_coding_system):
+       Remove a dummy integer no longer needed.
+
+[Changelog patch removed]
+
+diff -r d40990b854cf -r 00eb7276ebb1 src/file-coding.c
+--- a/src/file-coding.c        Mon Sep 23 08:03:15 2024 +0100
++++ b/src/file-coding.c        Mon Sep 23 07:36:31 2024 +0100
+@@ -312,11 +312,18 @@
+   MAYBE_XCODESYSMETH (obj, finalize, (obj));
+ }
+ 
++inline static Bytecount
++aligned_sizeof_coding_system (Bytecount type_specific_size)
++{
++  return MAX_ALIGN_SIZE (offsetof (Lisp_Coding_System, data)
++                         + type_specific_size);
++}
++
+ static Bytecount
+ sizeof_coding_system (Lisp_Object obj)
+ {
+   const Lisp_Coding_System *p = XCODING_SYSTEM (obj);
+-  return offsetof (Lisp_Coding_System, data) + p->methods->extra_data_size;
++  return aligned_sizeof_coding_system (p->methods->extra_data_size);
+ }
+ 
+ static const struct memory_description coding_system_methods_description_1[]
+@@ -835,7 +842,7 @@
+                       Bytecount data_size,
+                       Lisp_Object name)
+ {
+-  Bytecount total_size = offsetof (Lisp_Coding_System, data) + data_size;
++  Bytecount total_size = aligned_sizeof_coding_system (data_size);
+   Lisp_Object obj = ALLOC_SIZED_LISP_OBJECT (total_size, coding_system);
+   Lisp_Coding_System *codesys = XCODING_SYSTEM (obj);
+ 
+@@ -3951,10 +3958,6 @@
+ struct convert_eol_coding_system
+ {
+   enum eol_type subtype;
+-  int dummy; /* On some architectures (eg ia64) the portable dumper can
+-                produce unaligned access errors without this field.  Probably
+-                because the combined structure of this structure and
+-                Lisp_Coding_System is not properly aligned. */
+ };
+ 
+ #define CODING_SYSTEM_CONVERT_EOL_SUBTYPE(codesys) \

diff --git a/app-editors/xemacs/files/xemacs-21.5.35-va_args.patch 
b/app-editors/xemacs/files/xemacs-21.5.35-va_args.patch
new file mode 100644
index 000000000000..a3d5f14b728a
--- /dev/null
+++ b/app-editors/xemacs/files/xemacs-21.5.35-va_args.patch
@@ -0,0 +1,179 @@
+# HG changeset patch
+# User Aidan Kehoe <keh...@parhasard.net>
+# Date 1727074995 -3600
+#      Mon Sep 23 08:03:15 2024 +0100
+# Node ID d40990b854cf32198aea31eae0d60ce91ce0f4f7
+# Parent  d3dfe7ea1c31cc619bf8416e04c5466927d9c6f5
+Avoid passing an int among Lisp_Object va_args, specifier instantiate methods.
+
+src/ChangeLog addition:
+
+2024-09-08  Aidan Kehoe  <keh...@parhasard.net>
+
+       * fontcolor.c (color_instantiate):
+       * fontcolor.c (font_instantiate):
+       * fontcolor.c (face_boolean_instantiate):
+       * fontcolor.c (face_background_placement_instantiate):
+       * glyphs.c (image_instantiate):
+       * specifier.c (specifier_instance_from_inst_list):
+       * specifier.h (struct specifier_methods):
+       Avoid passing an int among the Lisp_Object va_args of the
+       specifier instantiate methods, this is not portable behaviour,
+       thank you clang and -fsanitize=undefined.
+
+[Changelog patch removed]
+
+diff -r d3dfe7ea1c31 -r d40990b854cf src/fontcolor.c
+--- a/src/fontcolor.c  Mon Sep 23 08:01:37 2024 +0100
++++ b/src/fontcolor.c  Mon Sep 23 08:03:15 2024 +0100
+@@ -1380,7 +1380,7 @@
+ static Lisp_Object
+ color_instantiate (Lisp_Object specifier, Lisp_Object UNUSED (matchspec),
+                  Lisp_Object domain, Lisp_Object instantiator,
+-                 Lisp_Object depth, int no_fallback)
++                 Lisp_Object depth, Lisp_Object no_fallback)
+ {
+   /* When called, we're inside of call_with_suspended_errors(),
+      so we can freely error. */
+@@ -1436,7 +1436,7 @@
+                 (Fget_face (XVECTOR_DATA (instantiator)[0]),
+                  COLOR_SPECIFIER_FACE_PROPERTY
+                  (XCOLOR_SPECIFIER (specifier)),
+-                 domain, ERROR_ME, no_fallback, depth));
++                     domain, ERROR_ME, !NILP (no_fallback), depth));
+ 
+       case 2:
+         return (FACE_PROPERTY_INSTANCE_1
+@@ -1653,7 +1653,7 @@
+ font_instantiate (Lisp_Object UNUSED (specifier),
+                 Lisp_Object USED_IF_MULE (matchspec),
+                 Lisp_Object domain, Lisp_Object instantiator,
+-                Lisp_Object depth, int no_fallback)
++                Lisp_Object depth, Lisp_Object no_fallback)
+ {
+   /* When called, we're inside of call_with_suspended_errors(),
+      so we can freely error. */
+@@ -1766,13 +1766,15 @@
+ 
+       match_inst = face_property_matching_instance
+       (Fget_face (XVECTOR_DATA (instantiator)[0]), Qfont,
+-       charset, domain, ERROR_ME, no_fallback, depth, STAGE_INITIAL);
++           charset, domain, ERROR_ME, !NILP (no_fallback),
++           depth, STAGE_INITIAL);
+ 
+       if (UNBOUNDP(match_inst))
+       {
+         match_inst = face_property_matching_instance
+           (Fget_face (XVECTOR_DATA (instantiator)[0]), Qfont,
+-           charset, domain, ERROR_ME, no_fallback, depth, STAGE_FINAL);
++               charset, domain, ERROR_ME, !NILP (no_fallback), depth,
++               STAGE_FINAL);
+       }
+ 
+       return match_inst;
+@@ -1868,7 +1870,7 @@
+ face_boolean_instantiate (Lisp_Object specifier,
+                         Lisp_Object UNUSED (matchspec),
+                         Lisp_Object domain, Lisp_Object instantiator,
+-                        Lisp_Object depth, int no_fallback)
++                        Lisp_Object depth, Lisp_Object no_fallback)
+ {
+   /* When called, we're inside of call_with_suspended_errors(),
+      so we can freely error. */
+@@ -1895,7 +1897,7 @@
+ 
+       retval = (FACE_PROPERTY_INSTANCE_1
+               (Fget_face (XVECTOR_DATA (instantiator)[0]),
+-               prop, domain, ERROR_ME, no_fallback, depth));
++                   prop, domain, ERROR_ME, !NILP (no_fallback), depth));
+ 
+       if (instantiator_len == 3 && !NILP (XVECTOR_DATA (instantiator)[2]))
+       retval = NILP (retval) ? Qt : Qnil;
+@@ -2015,7 +2017,7 @@
+                                      Lisp_Object domain,
+                                      Lisp_Object instantiator,
+                                      Lisp_Object depth,
+-                                     int no_fallback)
++                                       Lisp_Object no_fallback)
+ {
+   /* When called, we're inside of call_with_suspended_errors(),
+      so we can freely error. */
+@@ -2027,7 +2029,7 @@
+ 
+       return FACE_PROPERTY_INSTANCE_1
+       (Fget_face (XVECTOR_DATA (instantiator)[0]),
+-       Qbackground_placement, domain, ERROR_ME, no_fallback, depth);
++           Qbackground_placement, domain, ERROR_ME, !NILP (no_fallback), 
depth);
+     }
+   else
+     ABORT (); /* Eh? */
+diff -r d3dfe7ea1c31 -r d40990b854cf src/glyphs.c
+--- a/src/glyphs.c     Mon Sep 23 08:01:37 2024 +0100
++++ b/src/glyphs.c     Mon Sep 23 08:03:15 2024 +0100
+@@ -3179,7 +3179,7 @@
+ static Lisp_Object
+ image_instantiate (Lisp_Object specifier, Lisp_Object UNUSED (matchspec),
+                  Lisp_Object domain, Lisp_Object instantiator,
+-                 Lisp_Object depth, int no_fallback)
++                 Lisp_Object depth, Lisp_Object no_fallback)
+ {
+   Lisp_Object glyph = IMAGE_SPECIFIER_ATTACHEE (XIMAGE_SPECIFIER (specifier));
+   int dest_mask = XIMAGE_SPECIFIER_ALLOWED (specifier);
+@@ -3218,7 +3218,7 @@
+       assert (XVECTOR_LENGTH (instantiator) == 3);
+       return (FACE_PROPERTY_INSTANCE
+             (Fget_face (XVECTOR_DATA (instantiator)[2]),
+-             Qbackground_pixmap, domain, no_fallback, depth));
++             Qbackground_pixmap, domain, !NILP (no_fallback), depth));
+     }
+   else
+     {
+diff -r d3dfe7ea1c31 -r d40990b854cf src/specifier.c
+--- a/src/specifier.c  Mon Sep 23 08:01:37 2024 +0100
++++ b/src/specifier.c  Mon Sep 23 08:03:15 2024 +0100
+@@ -2862,8 +2862,8 @@
+       if (HAS_SPECMETH_P (sp, instantiate))
+       val = call_with_suspended_errors
+         ((lisp_fn_t) RAW_SPECMETH (sp, instantiate),
+-         Qunbound, Qspecifier, ERROR_ME_WARN, 5, specifier,
+-         matchspec, domain, val, depth, no_fallback);
++         Qunbound, Qspecifier, ERROR_ME_WARN, 6, specifier,
++         matchspec, domain, val, depth, no_fallback ? Qt : Qnil);
+ 
+       if (!UNBOUNDP (val))
+       {
+@@ -2911,8 +2911,8 @@
+       if (HAS_SPECMETH_P (sp, instantiate))
+       val = call_with_suspended_errors
+         ((lisp_fn_t) RAW_SPECMETH (sp, instantiate),
+-         Qunbound, Qspecifier, errb, 5, specifier,
+-         matchspec, domain, val, depth, no_fallback);
++         Qunbound, Qspecifier, errb, 6, specifier,
++         matchspec, domain, val, depth, no_fallback ? Qt : Qnil);
+ 
+       if (!UNBOUNDP (val))
+       {
+diff -r d3dfe7ea1c31 -r d40990b854cf src/specifier.h
+--- a/src/specifier.h  Mon Sep 23 08:01:37 2024 +0100
++++ b/src/specifier.h  Mon Sep 23 08:03:15 2024 +0100
+@@ -147,8 +147,9 @@
+      name specifier_instance) to avoid creating "external"
+      specification loops.
+ 
+-     NO_FALLBACK indicates that the method should not try the fallbacks
+-     (and thus simply return Qunbound) in case of a failure to instantiate.
++     NO_FALLBACK non-nil indicates that the method should not try the
++     fallbacks (and thus simply return Qunbound) in case of a failure to
++     instantiate.
+ 
+      This method must presume that both INSTANTIATOR and MATCHSPEC are
+      already validated by the corresponding validate_* methods, and
+@@ -165,7 +166,7 @@
+                                    Lisp_Object domain,
+                                    Lisp_Object instantiator,
+                                    Lisp_Object depth,
+-                                   int no_fallback);
++                                   Lisp_Object no_fallback);
+ 
+   /* Going-to-add method: Called when an instantiator is about
+      to be added to a specifier.  This function can specify

diff --git a/app-editors/xemacs/xemacs-21.5.35-r3.ebuild 
b/app-editors/xemacs/xemacs-21.5.35-r4.ebuild
similarity index 98%
rename from app-editors/xemacs/xemacs-21.5.35-r3.ebuild
rename to app-editors/xemacs/xemacs-21.5.35-r4.ebuild
index c6d6120f7236..ded18e39b3c5 100644
--- a/app-editors/xemacs/xemacs-21.5.35-r3.ebuild
+++ b/app-editors/xemacs/xemacs-21.5.35-r4.ebuild
@@ -64,6 +64,8 @@ src_prepare() {
        eapply "${FILESDIR}/${P}-mule-tests.patch"
        eapply "${FILESDIR}/${P}-configure-libc-version.patch"
        eapply "${FILESDIR}/${P}-which.patch"
+       eapply "${FILESDIR}/${P}-misalignment.patch"
+       eapply "${FILESDIR}/${P}-va_args.patch"
 
        eapply_user
 

Reply via email to