]> git.ipfire.org Git - thirdparty/gcc.git/blame - fixincludes/fixincl.tpl
i386: Add clear_ratio to processor_costs
[thirdparty/gcc.git] / fixincludes / fixincl.tpl
CommitLineData
341714a9 1[= AutoGen5 Template -*- Mode: C -*-
49b4955b 2x=fixincl.x =]
e6f92441 3[=
d6856a0e 4 (if (version-compare >= autogen-version "5.18.1")
e6f92441 5 (dne "-D" " * " "/* ")
6 (dne " * " "/* ") ) =]
d45e22c2 7 */
2d87ca1a 8/* DO NOT SVN-MERGE THIS FILE, EITHER [=
9 (define re-ct 0) (define max-mach 0) (define ct 0)
10 (define HACK "") (define Hack "") (define tmp "")
11 (shell "date") =]
6274714d 12 *
d45e22c2 13 * You must regenerate it. Use the ./genfixes script.
14 *
15 *
16 * This is part of the fixincl program used to install modified versions of
17 * certain ANSI-incompatible system header files which are fixed to work
18 * correctly with ANSI C and placed in a directory that GNU C will search.
6274714d 19 *
341714a9 20 * This file contains [=(count "fix")=] fixup descriptions.
6274714d 21 *
49e3683c 22 * See README for more information.
6274714d 23 *
2d87ca1a 24 * inclhack copyright (c) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
25 * 2006, 2007, 2008
d4c4b01d 26 * The Free Software Foundation, Inc.
53668ad4 27 *
2d87ca1a 28 * inclhack is free software: you can redistribute it and/or modify it
29 * under the terms of the GNU General Public License as published by the
30 * Free Software Foundation, either version 3 of the License, or
31 * (at your option) any later version.
32 *
33 * inclhack is distributed in the hope that it will be useful, but
34 * WITHOUT ANY WARRANTY; without even the implied warranty of
35 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
36 * See the GNU General Public License for more details.
37 *
38 * You should have received a copy of the GNU General Public License along
39 * with this program. If not, see <http://www.gnu.org/licenses/>.
d4c4b01d 40 */
b32d497c 41#ifndef SED_PROGRAM
42#define SED_PROGRAM "/usr/bin/sed"
43#endif
44static char const sed_cmd_z[] = SED_PROGRAM;
341714a9 45[=
6274714d 46
341714a9 47FOR fix =]
d4c4b01d 48/* * * * * * * * * * * * * * * * * * * * * * * * * *
6274714d 49 *
341714a9 50 * Description of [=
51 (set! Hack (string-capitalize! (get "hackname")))
52 (set! HACK (string-upcase! (get "hackname")))
3072d11f 53 (if (and (not (exist? "test_text")) (not (exist? "replace")))
54 (error (sprintf "include fix '%s' has no test text" Hack )) )
341714a9 55 (. Hack)=] fix
d4c4b01d 56 */[=
57
58# Note that this is not just for debugging purposes, but in case
59 some C fix wishes to refer to the regexps it is paired with.
60 See commentary at the top of fixfixes.c.
61=]
341714a9 62tSCC z[=(. Hack)=]Name[] =
63 "[=hackname=]";
d4c4b01d 64
6274714d 65/*
66 * File name selection pattern
67 */[=
68
e6f92441 69 IF (exist? "files") =]
341714a9 70tSCC z[=(. Hack)=]List[] =
e9afa104 71 "[= (join "\\0" (stack "files")) =]\0";[=
6274714d 72
e6f92441 73 ELSE =]
341714a9 74#define z[=(. Hack)=]List (char*)NULL[=
75 ENDIF (exist? "files") =]
6274714d 76/*
77 * Machine/OS name selection pattern
78 */[=
79
e6f92441 80 IF (exist? "mach") =]
341714a9 81tSCC* apz[=(. Hack)=]Machs[] = {[=
82 (set! ct 0) =][=
5daf7ede 83
e6f92441 84 FOR mach =]
341714a9 85 [=
86 (set! tmp (get "mach"))
87 (set! ct (+ ct (string-length tmp) 5))
88 (kr-string tmp)=],[=
e6f92441 89 ENDFOR =]
6274714d 90 (const char*)NULL };[=
91
341714a9 92 (if (> ct max-mach) (set! max-mach ct)) =][=
5daf7ede 93
e6f92441 94 ELSE =]
341714a9 95#define apz[=(. Hack)=]Machs (const char**)NULL[=
e9afa104 96 ENDIF (exist? "mach") =][=
6274714d 97
341714a9 98 IF (exist? "select")=]
6274714d 99
100/*
53668ad4 101 * content selection pattern - do fix if pattern found
6274714d 102 */[=
e6f92441 103 FOR select =]
341714a9 104tSCC z[=(. Hack)=]Select[=(for-index)=][] =
105 [=(kr-string (get "select"))=];[=
e6f92441 106 ENDFOR select =][=
107 ENDIF =][=
6274714d 108
e6f92441 109 IF (exist? "bypass") =]
6274714d 110
111/*
53668ad4 112 * content bypass pattern - skip fix if pattern found
6274714d 113 */[=
e6f92441 114 FOR bypass =]
341714a9 115tSCC z[=(. Hack)=]Bypass[=(for-index)=][] =
116 [=(kr-string (get "bypass"))=];[=
e6f92441 117 ENDFOR bypass =][=
118 ENDIF =][=
119
120 IF (exist? "sum")=][=
121 (if (not (exist? "files"))
122 (error "specifying a 'sum' requires specifying 'files'"))
123 =]
6274714d 124
e6f92441 125/*
126 * file selection - do fix if checksum matches
127 */[=
128 FOR sum =]
129tSCC z[=(. Hack)=]Sum[=(for-index)=][] =
130 [=(kr-string (get "sum"))=];[=
131 ENDFOR sum =][=
132 ENDIF =][=
133
134 IF (exist? "test") =]
6274714d 135
136/*
53668ad4 137 * perform the 'test' shell command - do fix on success
6274714d 138 */[=
e6f92441 139 FOR test =]
341714a9 140tSCC z[=(. Hack)=]Test[=(for-index)=][] =
141 [=(kr-string (get "test"))=];[=
e6f92441 142 ENDFOR =][=
143 ENDIF =][=
6274714d 144
e6f92441 145 IF (exist? "c_test") =]
5daf7ede 146
147/*
148 * perform the C function call test
149 */[=
e6f92441 150 FOR c_test =]
341714a9 151tSCC z[=(. Hack)=]FTst[=(for-index)=][] = "[=c_test=]";[=
e6f92441 152 ENDFOR c_test =][=
153 ENDIF =][=
5daf7ede 154
341714a9 155 IF (set! ct (+ (count "select") (count "bypass")
156 (count "test") (count "c_test")))
53668ad4 157
341714a9 158 (= ct 0)
6274714d 159=]
341714a9 160#define [=(. HACK)=]_TEST_CT 0
161#define a[=(. Hack)=]Tests (tTestDesc*)NULL[=
162 ELSE =]
163
164#define [=(. HACK)=]_TEST_CT [=(. ct)=][=
e6f92441 165 (set! re-ct (+ re-ct (count "select") (count "bypass"))) =]
341714a9 166static tTestDesc a[=(. Hack)=]Tests[] = {[=
167
e6f92441 168 FOR test =]
341714a9 169 { TT_TEST, z[=(. Hack)=]Test[=(for-index)=], 0 /* unused */ },[=
e6f92441 170 ENDFOR test =][=
341714a9 171
e6f92441 172 FOR c_test =]
341714a9 173 { TT_FUNCTION, z[=(. Hack)=]FTst[=(for-index)=], 0 /* unused */ },[=
e6f92441 174 ENDFOR c_test =][=
341714a9 175
e6f92441 176 FOR bypass =]
341714a9 177 { TT_NEGREP, z[=(. Hack)=]Bypass[=(for-index)=], (regex_t*)NULL },[=
e6f92441 178 ENDFOR bypass =][=
6274714d 179
e6f92441 180 FOR select =]
341714a9 181 { TT_EGREP, z[=(. Hack)=]Select[=(for-index)=], (regex_t*)NULL },[=
e6f92441 182 ENDFOR select =][=
183
184 FOR sum =]
185 { TT_CKSUM, z[=(. Hack)=]Sum[=(for-index)=], 0 /* unused */ },[=
186 ENDFOR sum =] };[=
341714a9 187 ENDIF =]
6274714d 188
189/*
341714a9 190 * Fix Command Arguments for [=(. Hack)=]
6274714d 191 */
341714a9 192static const char* apz[=(. Hack)=]Patch[] = {[=
b32d497c 193 IF (exist? "sed")=] sed_cmd_z[=
341714a9 194 FOR sed=],
195 "-e", [=(kr-string (get "sed"))=][=
196 ENDFOR sed=],[=
5daf7ede 197
341714a9 198 ELIF (exist? "shell")=] "sh", "-c",
199 [=(kr-string (get "shell"))=],[=
5daf7ede 200
341714a9 201 ELIF (exist? "c_fix")=]
202 [=(kr-string (get "c_fix"))=],[=
09fe1d5c 203
341714a9 204 FOR c_fix_arg =]
205 [=(kr-string (get "c_fix_arg"))=],[=
206 ENDFOR c_fix_arg =][=
5daf7ede 207
341714a9 208 ELIF (> (len "replace") 0) =]
209[=(kr-string (get "replace"))=],[=
5daf7ede 210
341714a9 211 ENDIF=]
6274714d 212 (char*)NULL };
341714a9 213[=ENDFOR fix=]
6274714d 214
d4c4b01d 215/* * * * * * * * * * * * * * * * * * * * * * * * * *
6274714d 216 *
217 * List of all fixes
d4c4b01d 218 */[=
5daf7ede 219# as of this writing, 49 bytes are needed by the case statement format.
220 We also must allow for the size of the target machine machine name.
221 This allows for a 79 byte machine name. Better be enough.
222=]
341714a9 223#define REGEX_COUNT [= (. re-ct) =]
224#define MACH_LIST_SIZE_LIMIT [= (+ 128 max-mach) =]
225#define FIX_COUNT [= (count "fix") =]
5daf7ede 226
3072d11f 227/*
228 * Enumerate the fixes[= # in a way that minimizes diffs :-) =]
229 */
230typedef enum {[=
231
232FOR fix "," =]
233 [=(string-upcase! (get "hackname"))=]_FIXIDX[=
234ENDFOR
235
236=]
237} t_fixinc_idx;
238
53668ad4 239tFixDesc fixDescList[ FIX_COUNT ] = {[=
6274714d 240
241
341714a9 242FOR fix ",\n" =][=
243 (set! Hack (string-capitalize! (get "hackname")))
244 (set! HACK (string-upcase! (get "hackname"))) =]
245 { z[=(. Hack)=]Name, z[=(. Hack)=]List,
246 apz[=(. Hack)=]Machs,
247 [=(. HACK)=]_TEST_CT, [=
248 IF (exist? "not_machine") =]FD_MACH_IFNOT[=
249 ELSE =]FD_MACH_ONLY[=
250 ENDIF =][=
251 IF (exist? "shell") =] | FD_SHELL_SCRIPT[=
252 ELIF (exist? "c_fix") =] | FD_SUBROUTINE[=
253 ELIF (exist? "replace") =] | FD_REPLACEMENT[=
254 ENDIF =],
255 a[=(. Hack)=]Tests, apz[=(. Hack)=]Patch, 0 }[=
256
257ENDFOR =]
6274714d 258};