aboutsummaryrefslogtreecommitdiff
path: root/gcc/fixinc/fixincl.tpl
blob: 780bdb8d2cb91ecaef1ef9eaf3470d58c6b4941a (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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
[= autogen template -*- Mode: C -*-
x=fixincl.x =]
/*
 *  DO NOT EDIT THIS FILE - it has been generated
 *
 * Install modified versions of certain ANSI-incompatible system header
 * files which are fixed to work correctly with ANSI C and placed in a
 * directory that GNU C will search.
 *
 * This file contains [=_eval fix _count =] fixup descriptions.
 *
 * See README for more information.
 *
 *  inclhack copyright (c) 1998, 1999, 2000, 2001
 *  The Free Software Foundation, Inc.
 *
[=_eval inclhack "# *  " _gpl=]
 */
[= _SETENV re_ct 0 =][= _SETENV max_mach 0 =][=

_FOR fix =]
/* * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 *  Description of [=hackname _cap=] fix
 */[=

# Note that this is not just for debugging purposes, but in case
  some C fix wishes to refer to the regexps it is paired with.
  See commentary at the top of fixfixes.c.
=]
#define [=hackname _up #_FIXIDX + #%-32s _printf=] [=_eval _index=]
tSCC z[=hackname _cap=]Name[] =
     [=hackname _krstr=];

/*
 *  File name selection pattern
 */[=

  _IF files _exist=]
tSCC z[=hackname _cap=]List[] =
  "[=_FOR files =]|[=files=][=/files=]|";[=

  _ELSE =]
#define z[=hackname _cap=]List (char*)NULL[=
  _ENDIF "files _exist" =]
/*
 *  Machine/OS name selection pattern
 */[=

  _IF mach _exist=]
tSCC* apz[=hackname _cap=]Machs[] = {[=
    _SETENV this_mach 0 =][=

    _FOR mach =]
        [=mach _krstr=],[=
      _SETENV this_mach mach _len this_mach _env _val 5 + +
      =][= /mach=]
        (const char*)NULL };[=

    _SETENV max_mach _mark this_mach _env _val max_mach _env _val _max =][=

  _ELSE =]
#define apz[=hackname _cap=]Machs (const char**)NULL[=
  _ENDIF "files _exist" =][=

  _IF select _exist=]

/*
 *  content selection pattern - do fix if pattern found
 */[=
    _FOR select =]
tSCC z[=hackname _cap=]Select[=_eval _index=][] =
       [=select _krstr=];[=
    /select =][=
  _ENDIF =][=

  _IF bypass _exist=]

/*
 *  content bypass pattern - skip fix if pattern found
 */[=
    _FOR bypass =]
tSCC z[=hackname _cap=]Bypass[=_eval _index=][] =
       [=bypass _krstr=];[=
    /bypass =][=
  _ENDIF =][=

  _IF test _exist=]

/*
 *  perform the 'test' shell command - do fix on success
 */[=
    _FOR test =]
tSCC z[=hackname _cap=]Test[=_eval _index=][] =
       [=test _krstr=];[=
    /test =][=
  _ENDIF =][=

  _IF c_test _exist=]

/*
 *  perform the C function call test
 */[=
    _FOR c_test =]
tSCC z[=hackname _cap=]FTst[=_eval _index=][] = "[=c_test=]";[=
    /c_test =][=
  _ENDIF =][=


#  Build the array of test descriptions for this fix: =][=

  _IF select  _exist
      bypass  _exist |
      test    _exist |
      c_test  _exist |
=]

#define    [=hackname _up =]_TEST_CT  [=
       _eval select       _count
             bypass       _count +
             test         _count + 
             c_test       _count + =][=
_SETENV re_ct
	re_ct _env _val
	select _count +
	bypass _count + =]
static tTestDesc a[=hackname _cap=]Tests[] = {[=

    _FOR test =]
  { TT_TEST,     z[=hackname _cap=]Test[=_eval _index=],   0 /* unused */ },[=
    /test =][=

    _FOR c_test =]
  { TT_FUNCTION, z[=hackname _cap=]FTst[=_eval _index=],   0 /* unused */ },[=
    /c_test =][=

    _FOR bypass =]
  { TT_NEGREP,   z[=hackname _cap=]Bypass[=_eval _index=], (regex_t*)NULL },[=
    /bypass =][=

      _FOR select =]
  { TT_EGREP,    z[=hackname _cap=]Select[=_eval _index=], (regex_t*)NULL },[=
      /select =] };[=
  _ELSE =]
#define [=hackname _up=]_TEST_CT  0
#define a[=hackname _cap=]Tests   (tTestDesc*)NULL[=
  _ENDIF =]

/*
 *  Fix Command Arguments for [=hackname _cap=]
 */
static const char* apz[=hackname _cap=]Patch[] = {[=
    _IF   sed         _exist =] "sed"[=
      _FOR sed=],
    "-e", [=sed _krstr=][=
      /sed=],[=

    _ELIF shell       _exist =] "sh", "-c",
    [=shell _krstr=],[=

    _ELIF c_fix _exist =]
    [=
      c_fix _krstr=],[=

      _FOR c_fix_arg =]
    [=c_fix_arg _krstr=],[=
      /c_fix_arg =][=

    _ELIF replace _len =]
[=replace _krstr=],[=

    _ENDIF=]
    (char*)NULL };
[=/fix=]

/* * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 *  List of all fixes
 */[=
#  as of this writing, 49 bytes are needed by the case statement format.
   We also must allow for the size of the target machine machine name.
   This allows for a 79 byte machine name.  Better be enough.
=]
#define REGEX_COUNT          [= _eval re_ct _env =]
#define MACH_LIST_SIZE_LIMIT [= _eval max_mach _env _val 128 + =]
#define FIX_COUNT            [= _eval fix _count =]

tFixDesc fixDescList[ FIX_COUNT ] = {[=


_FOR fix ",\n" =]
  {  z[=hackname _cap=]Name,    z[=hackname _cap=]List,
     apz[=hackname _cap=]Machs,
     [=hackname  _up=]_TEST_CT, [=
       _IF not_machine _exist =]FD_MACH_IFNOT[=
       _ELSE                  =]FD_MACH_ONLY[=
       _ENDIF =][=
       _IF    shell    _exist =] | FD_SHELL_SCRIPT[=
       _ELIF  c_fix    _exist =] | FD_SUBROUTINE[=
       _ELIF  replace  _exist =] | FD_REPLACEMENT[=
       _ENDIF =],
     a[=hackname _cap=]Tests,   apz[=hackname _cap=]Patch, 0 }[=

/fix=]
};