source: scripts/patches/flex-2.5.31-debian_fixes-2.patch@ 9b0e5f2

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 9b0e5f2 was 7f65c0e, checked in by Jim Gifford <clfs@…>, 19 years ago

r625@server (orig r623): jim | 2005-10-31 12:43:24 -0800
Final Move

  • Property mode set to 100644
File size: 8.8 KB
RevLine 
[617118d]1Submitted By: Zack Winkles <winkie@linuxfromscratch.org>
2Date: 2004-03-01
3Initial Package Version: 2.5.31
4Origin: Debian
5Description: This fixes a ton of things. I'm not entirely sure what, but
6 it's all stuff that Debian thought to be broken, and I trust them.
7 All the non-code changes have been stripped (otherwise it would
8 be gargantuan). I've been using this patch for a few months now
9 and it makes flex not suck anymore. That's a good thing.
10
11diff -Naur flex-2.5.31.orig/filter.c flex-2.5.31/filter.c
12--- flex-2.5.31.orig/filter.c 2003-03-25 11:39:08.000000000 -0500
13+++ flex-2.5.31/filter.c 2004-03-01 23:14:28.868777672 -0500
14@@ -157,11 +157,15 @@
15 if (chain->filter_func) {
16 int r;
17
18- /* setup streams again */
19+ /* setup streams again -- Removed. POSIX states that children inherit
20+ open streams in the parent. Also, ANSI C99 states that the stdin
21+ and stdout macors need not be modified lvalues; so this code is
22+ broken in the first place.
23 if ((stdin = fdopen (0, "r")) == NULL)
24 flexfatal (_("fdopen(0) failed"));
25 if ((stdout = fdopen (1, "w")) == NULL)
26 flexfatal (_("fdopen(1) failed"));
27+ */
28
29 if ((r = chain->filter_func (chain)) == -1)
30 flexfatal (_("filter_func failed"));
31@@ -181,9 +185,11 @@
32 if (dup2 (pipes[1], 1) == -1)
33 flexfatal (_("dup2(pipes[1],1)"));
34 close (pipes[1]);
35+ /* This is not legal; stfout does not need to be a modifiable
36+ lvalue
37 if ((stdout = fdopen (1, "w")) == NULL)
38 flexfatal (_("fdopen(1) failed"));
39-
40+ */
41 return true;
42 }
43
44diff -Naur flex-2.5.31.orig/flex.skl flex-2.5.31/flex.skl
45--- flex-2.5.31.orig/flex.skl 2003-03-31 20:51:38.000000000 -0500
46+++ flex-2.5.31/flex.skl 2004-03-01 23:14:28.870777368 -0500
47@@ -27,6 +27,11 @@
48 %# Macros for runtime processing stage.
49 m4_changecom
50 m4_changequote
51+
52+%# Let user use our quoting strings
53+m4_changequote({, })
54+m4_define( {m4_userquote_start}, {m4_changequote(<, >)[[m4_changequote([[, ]])})
55+m4_define( {m4_userquote_end}, {m4_changequote(<, >)]]m4_changequote([[, ]])})
56 m4_changequote([[, ]])
57
58 %#
59@@ -345,19 +350,19 @@
60 %# yyscan_t yyscanner;
61 %#
62 %# Generate traditional function defs
63- m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG)
64+ m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG) [[\]]
65 M4_YY_DECL_LAST_ARG]])
66- m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG)
67- $1 $2;
68+ m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG) [[\]]
69+ $1 $2; [[\]]
70 M4_YY_DECL_LAST_ARG]])
71- m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG)
72- $1 $2;
73- $3 $4;
74+ m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG) [[\]]
75+ $1 $2; [[\]]
76+ $3 $4; [[\]]
77 M4_YY_DECL_LAST_ARG]])
78- m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG)
79- $1 $2;
80- $3 $4;
81- $5 $6;
82+ m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG) [[\]]
83+ $1 $2; [[\]]
84+ $3 $4; [[\]]
85+ $5 $6; [[\]]
86 M4_YY_DECL_LAST_ARG]])
87 ]],
88 [[
89@@ -724,6 +729,7 @@
90
91 m4_ifdef( [[M4_YY_NO_UNISTD_H]],,
92 [[
93+#ifndef YY_NO_UNISTD_H
94 /* Special case for "unistd.h", since it is non-ANSI. We include it way
95 * down here because we want the user's section 1 to have been scanned first.
96 * The user has a chance to override it with an option.
97@@ -734,6 +740,7 @@
98 %if-c++-only
99 #include <unistd.h>
100 %endif
101+#endif
102 ]])
103
104 #ifndef YY_EXTRA_TYPE
105@@ -1124,9 +1131,9 @@
106 m4_dnl The bison pure parser is used. Redefine yylex to
107 m4_dnl accept the lval parameter.
108
109- m4_define( [[M4_YY_LEX_PROTO]],
110+ m4_define( [[M4_YY_LEX_PROTO]], [[\]]
111 [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])
112- m4_define( [[M4_YY_LEX_DECLARATION]],
113+ m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
114 [[YYFARGS1(YYSTYPE *,yylval_param)]])
115 ]])
116
117@@ -1134,9 +1141,9 @@
118 [[
119 m4_dnl Locations are used. yylex should also accept the ylloc parameter.
120
121- m4_define( [[M4_YY_LEX_PROTO]],
122+ m4_define( [[M4_YY_LEX_PROTO]], [[\]]
123 [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]])
124- m4_define( [[M4_YY_LEX_DECLARATION]],
125+ m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
126 [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]])
127 ]])
128
129@@ -2251,11 +2258,11 @@
130 * @note If you want to scan bytes that may contain NUL values, then use
131 * yy_scan_bytes() instead.
132 */
133-YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *,str)
134+YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *,yy_str)
135 {
136 m4_dnl M4_YY_DECL_GUTS_VAR();
137
138- return yy_scan_bytes( str, strlen(str) M4_YY_CALL_LAST_ARG);
139+ return yy_scan_bytes( yy_str, strlen(yy_str) M4_YY_CALL_LAST_ARG);
140 }
141 %endif
142 ]])
143diff -Naur flex-2.5.31.orig/gen.c flex-2.5.31/gen.c
144--- flex-2.5.31.orig/gen.c 2003-03-30 14:58:44.000000000 -0500
145+++ flex-2.5.31/gen.c 2004-03-01 23:14:28.862778584 -0500
146@@ -1812,7 +1812,6 @@
147 if (yytext_is_array) {
148 if (!reentrant){
149 indent_puts ("static int yy_more_offset = 0;");
150- }else{
151 indent_puts ("static int yy_prev_more_offset = 0;");
152 }
153 }
154diff -Naur flex-2.5.31.orig/main.c flex-2.5.31/main.c
155--- flex-2.5.31.orig/main.c 2003-03-31 20:51:38.000000000 -0500
156+++ flex-2.5.31/main.c 2004-03-01 23:14:28.863778432 -0500
157@@ -199,6 +199,7 @@
158 {
159 #if ENABLE_NLS
160 setlocale (LC_MESSAGES, "");
161+ setlocale (LC_CTYPE, "");
162 textdomain (PACKAGE);
163 bindtextdomain (PACKAGE, LOCALEDIR);
164 #endif
165@@ -1595,7 +1596,6 @@
166 outn ("#else");
167 outn (yy_stdinit);
168 outn ("#endif");
169- outn ("#endif");
170 }
171
172 else {
173diff -Naur flex-2.5.31.orig/scan.c flex-2.5.31/scan.c
174--- flex-2.5.31.orig/scan.c 2003-04-01 11:33:17.000000000 -0500
175+++ flex-2.5.31/scan.c 2004-03-01 23:14:28.860778888 -0500
176@@ -1619,11 +1619,13 @@
177 #define LINEDIR 18
178 #define CODEBLOCK_MATCH_BRACE 19
179
180+#ifndef YY_NO_UNISTD_H
181 /* Special case for "unistd.h", since it is non-ANSI. We include it way
182 * down here because we want the user's section 1 to have been scanned first.
183 * The user has a chance to override it with an option.
184 */
185 #include <unistd.h>
186+#endif
187
188 #ifndef YY_EXTRA_TYPE
189 #define YY_EXTRA_TYPE void *
190diff -Naur flex-2.5.31.orig/scan.l flex-2.5.31/scan.l
191--- flex-2.5.31.orig/scan.l 2003-03-31 20:51:38.000000000 -0500
192+++ flex-2.5.31/scan.l 2004-03-01 23:14:28.864778280 -0500
193@@ -194,8 +194,14 @@
194 <COMMENT>{
195 "*/" ACTION_ECHO; yy_pop_state();
196 "*" ACTION_ECHO;
197- [^*\n]+ ACTION_ECHO;
198- [^*\n]*{NL} ++linenum; ACTION_ECHO;
199+ [\[\]] ACTION_ECHO;
200+ [^*\[\]\n]+ ACTION_ECHO;
201+ [^*\[\]\n]*{NL} ++linenum; ACTION_ECHO;
202+ \[\[ add_action("[" "[]" "]m4_" "userquote_start()");
203+ \]\] add_action("[" "[]" "]m4_" "userquote_end()");
204+ /* Macros need to be clearly separated from surrounding
205+ * text and this file needs to go through flex untouched.
206+ */
207 }
208
209 <LINEDIR>{
210diff -Naur flex-2.5.31.orig/skel.c flex-2.5.31/skel.c
211--- flex-2.5.31.orig/skel.c 2003-04-01 11:33:08.000000000 -0500
212+++ flex-2.5.31/skel.c 2004-03-01 23:14:28.867777824 -0500
213@@ -404,16 +404,16 @@
214 "%# yyscan_t yyscanner;",
215 "%#",
216 "%# Generate traditional function defs",
217- " m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG)",
218+ " m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG) [[\\]]",
219 " M4_YY_DECL_LAST_ARG]])",
220- " m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG)",
221+ " m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG) [[\\]]",
222 " $1 $2;",
223 " M4_YY_DECL_LAST_ARG]])",
224- " m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG)",
225+ " m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG) [[\\]]",
226 " $1 $2;",
227 " $3 $4;",
228 " M4_YY_DECL_LAST_ARG]])",
229- " m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG)",
230+ " m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG) [[\\]]",
231 " $1 $2;",
232 " $3 $4;",
233 " $5 $6;",
234@@ -783,6 +783,7 @@
235 "",
236 "m4_ifdef( [[M4_YY_NO_UNISTD_H]],,",
237 "[[",
238+ "#ifndef YY_NO_UNISTD_H",
239 "/* Special case for \"unistd.h\", since it is non-ANSI. We include it way",
240 " * down here because we want the user's section 1 to have been scanned first.",
241 " * The user has a chance to override it with an option.",
242@@ -793,6 +794,7 @@
243 "%if-c++-only",
244 "#include <unistd.h>",
245 "%endif",
246+ "#endif",
247 "]])",
248 "",
249 "#ifndef YY_EXTRA_TYPE",
250@@ -2454,11 +2456,11 @@
251 " * @note If you want to scan bytes that may contain NUL values, then use",
252 " * yy_scan_bytes() instead.",
253 " */",
254- "YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *,str)",
255+ "YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *,yy_str)",
256 "{",
257 " m4_dnl M4_YY_DECL_GUTS_VAR();",
258 "",
259- " return yy_scan_bytes( str, strlen(str) M4_YY_CALL_LAST_ARG);",
260+ " return yy_scan_bytes( yy_str, strlen(yy_str) M4_YY_CALL_LAST_ARG);",
261 "}",
262 "%endif",
263 "]])",
Note: See TracBrowser for help on using the repository browser.