summaryrefslogtreecommitdiff
path: root/app-editors/xemacs/files/xemacs-21.5.35-va_args.patch
blob: a3d5f14b728ad1b541a8bb021b5f89d20d5c1144 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# HG changeset patch
# User Aidan Kehoe <kehoea@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  <kehoea@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