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