-
Notifications
You must be signed in to change notification settings - Fork 0
/
DICompilers.inc
477 lines (390 loc) · 15.3 KB
/
DICompilers.inc
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
//------------------------------------------------------------------------------
// Compiler Version Information
//------------------------------------------------------------------------------
(*
- Feature Directives
The features directives are used to test if the compiler supports specific
features, such as method overloading, and adjust the sources accordingly. Use
of these directives is preferred over the use of the DELPHI and COMPILER
directives.
Directive Description
------------------------------------------------------------------------------
SUPPORTS_FOR_IN Compiler supports for in loops (D9+)
SUPPORTS_LONGWORD Compiler supports the LongWord type (unsigned 32 bit) (D4+/BCB4+)
HAS_UNIT_RTLCONSTS Unit RTLConsts exists (D6+/BCB6+/FPC)
HAS_UNIT_TYPES Unit Types exists (D6+/BCB6+/FPC)
HAS_UNITSCOPE Unit scope names are prepended to unit names in the VCL-FMX-RTL libraries.
*)
{$IFDEF FPC}
//------------------------------------------------------------------------------
// FreePascal
//------------------------------------------------------------------------------
{$MODE DELPHI}
{$ASMMODE Intel}
{$DEFINE HAS_UNIT_RTLCONSTS}
{$DEFINE SUPPORTS_DEFAULTPARAMS}
{$DEFINE SUPPORTS_DEPRECATED}
{$DEFINE SUPPORTS_DEPRECATED_WARNINGS}
{$DEFINE SUPPORTS_ENUMVALUE}
{$DEFINE SUPPORTS_FOR_IN}
{$DEFINE SUPPORTS_INT64}
{$DEFINE SUPPORTS_LONGWORD}
{$DEFINE SUPPORTS_OVERLOAD}
{$DEFINE SUPPORTS_UNICODE_STRING} // FPC has UnicodeString like Unicode Delphi 2009.
{$DEFINE SUPPORTS_VARARGS}
{$ELSE FPC}
//------------------------------------------------------------------------------
// Borland / CodeGear compilers
//------------------------------------------------------------------------------
{$IFDEF Win32}
{$IFNDEF MSWINDOWS}
{$DEFINE MSWINDOWS}
{$ENDIF}
{$ENDIF}
// VERXXX to COMPILER_X, DELPHI_X and BCB_X mappings
{$IFDEF MSWINDOWS}
{$IFDEF VER80}
{$DEFINE DELPHI}
{$DEFINE DELPHI_1}
{$DEFINE COMPILER_1}
{$ENDIF}
{$IFDEF VER90}
{$DEFINE DELPHI}
{$DEFINE DELPHI_2}
{$DEFINE COMPILER_2}
{$ENDIF}
{$IFDEF VER93}
{$DEFINE BCB}
{$DEFINE BCB_1}
{$DEFINE COMPILER_2} // C++ Builder v1 compiler is really v2
{$ENDIF}
{$IFDEF VER100}
{$DEFINE DELPHI}
{$DEFINE DELPHI_3}
{$DEFINE COMPILER_3}
{$ENDIF}
{$IFDEF VER110}
{$DEFINE BCB}
{$DEFINE BCB_3}
{$DEFINE COMPILER_35}
{$ENDIF}
{$IFDEF VER125}
{$DEFINE BCB}
{$DEFINE BCB_4}
{$DEFINE COMPILER_4}
{$ENDIF}
{$IFDEF VER120}
{$DEFINE DELPHI}
{$DEFINE DELPHI_4}
{$DEFINE COMPILER_4}
{$ENDIF}
{$IFDEF VER130}
{$IFDEF BCB}
{$DEFINE BCB_5}
{$ELSE}
{$DEFINE DELPHI}
{$DEFINE DELPHI_5}
{$ENDIF}
{$DEFINE COMPILER_5}
{$ENDIF}
{$IFDEF VER140}
{$IFDEF BCB}
{$DEFINE BCB_6}
{$ELSE}
{$DEFINE DELPHI}
{$DEFINE DELPHI_6}
{$ENDIF}
{$DEFINE COMPILER_6}
{$ENDIF}
{$IFDEF VER150}
{$DEFINE DELPHI}
{$DEFINE DELPHI_7}
{$DEFINE COMPILER_7}
{$ENDIF}
{$IFDEF VER160}
{$DEFINE DELPHI}
{$DEFINE DELPHI_8}
{$DEFINE COMPILER_8}
{$ENDIF}
{$IFDEF VER170} // BDS 3, Delphi 2005
{$DEFINE DELPHI}
{$DEFINE DELPHI_9}
{$DEFINE COMPILER_9}
{$ENDIF}
{$IFDEF VER180} // RAD Studio 5, Delphi 2007
{$IFDEF VER185}
{$IFDEF BCB}
{$DEFINE BCB_11}
{$ELSE}
{$DEFINE DELPHI}
{$DEFINE DELPHI_11}
{$ENDIF}
{$DEFINE COMPILER_11}
{$ELSE VER180}
{$IFDEF BCB}
{$DEFINE BCB_10}
{$ELSE}
{$DEFINE DELPHI}
{$DEFINE DELPHI_10}
{$ENDIF}
{$DEFINE COMPILER_10}
{$ENDIF}
{$ENDIF}
{$IFDEF VER200} // RAD Studio 2009
{$IFDEF BCB}
{$DEFINE BCB_12}
{$ELSE}
{$DEFINE DELPHI}
{$DEFINE DELPHI_12}
{$ENDIF BCB}
{$DEFINE COMPILER_12}
{$ENDIF VER200}
{$IFDEF VER210} // RAD Studio 2010
{$IFDEF BCB}
{$DEFINE BCB_14}
{$ELSE}
{$DEFINE DELPHI}
{$DEFINE DELPHI_14}
{$ENDIF BCB}
{$DEFINE COMPILER_14}
{$ENDIF VER210}
{$IFDEF VER220} // RAD Studio XE
{$IFDEF BCB}
{$DEFINE BCB_15}
{$ELSE}
{$DEFINE DELPHI}
{$DEFINE DELPHI_15}
{$ENDIF BCB}
{$DEFINE COMPILER_15}
{$ENDIF VER220}
{$IFDEF VER230} // RAD Studio XE2
{$IFDEF BCB}
{$DEFINE BCB_16}
{$ELSE}
{$DEFINE DELPHI}
{$DEFINE DELPHI_16}
{$ENDIF BCB}
{$DEFINE COMPILER_16}
{$ENDIF VER230}
{$ENDIF MSWINDOWS}
// CLR - DotNet
{$IFDEF CLR}
{$IFDEF VER160}
{$DEFINE DELPHI}
{$DEFINE DELPHI_8}
{$DEFINE COMPILER_8}
{$ENDIF}
{$ENDIF CLR}
// Linux
{$IFDEF LINUX}
{$IFDEF VER150}
{$DEFINE KYLIX}
{$DEFINE KYLIX_3}
{$DEFINE COMPILER_7}
{$ENDIF}
{$IFDEF VER140}
{$DEFINE KYLIX}
{$DEFINE KYLIX_2}
{$DEFINE COMPILER_6}
{$ENDIF}
// KYLIXX_UP from KYLIXX mappings
{$IFDEF KYLIX_3} {$DEFINE KYLIX_3_UP} {$ENDIF}
{$IFDEF KYLIX_2} {$DEFINE KYLIX_2_UP} {$ENDIF}
{$IFDEF KYLIX_1} {$DEFINE KYLIX_1_UP} {$ENDIF}
// KYLIX_X_UP from KYLIX_X_UP mappings
{$IFDEF KYLIX_3_UP} {$DEFINE KYLIX_2_UP} {$ENDIF}
{$IFDEF KYLIX_2_UP} {$DEFINE KYLIX_1_UP} {$ENDIF}
{$ENDIF Linux}
// DELPHI_X_UP from DELPHI_X mappings
{$IFDEF DELPHI_16} {$DEFINE DELPHI_16_UP} {$ENDIF}
{$IFDEF DELPHI_15} {$DEFINE DELPHI_15_UP} {$ENDIF}
{$IFDEF DELPHI_14} {$DEFINE DELPHI_14_UP} {$ENDIF}
{$IFDEF DELPHI_12} {$DEFINE DELPHI_12_UP} {$ENDIF}
{$IFDEF DELPHI_11} {$DEFINE DELPHI_11_UP} {$ENDIF}
{$IFDEF DELPHI_10} {$DEFINE DELPHI_10_UP} {$ENDIF}
{$IFDEF DELPHI_9} {$DEFINE DELPHI_9_UP} {$ENDIF}
{$IFDEF DELPHI_8} {$DEFINE DELPHI_8_UP} {$ENDIF}
{$IFDEF DELPHI_7} {$DEFINE DELPHI_7_UP} {$ENDIF}
{$IFDEF DELPHI_6} {$DEFINE DELPHI_6_UP} {$ENDIF}
{$IFDEF DELPHI_5} {$DEFINE DELPHI_5_UP} {$ENDIF}
{$IFDEF DELPHI_4} {$DEFINE DELPHI_4_UP} {$ENDIF}
{$IFDEF DELPHI_3} {$DEFINE DELPHI_3_UP} {$ENDIF}
{$IFDEF DELPHI_2} {$DEFINE DELPHI_2_UP} {$ENDIF}
{$IFDEF DELPHI_1} {$DEFINE DELPHI_1_UP} {$ENDIF}
// DELPHI_X_UP from DELPHI_X_UP mappings
{$IFDEF DELPHI_16_UP} {$DEFINE DELPHI_15_UP} {$ENDIF}
{$IFDEF DELPHI_15_UP} {$DEFINE DELPHI_14_UP} {$ENDIF}
{$IFDEF DELPHI_14_UP} {$DEFINE DELPHI_12_UP} {$ENDIF}
{$IFDEF DELPHI_12_UP} {$DEFINE DELPHI_11_UP} {$ENDIF}
{$IFDEF DELPHI_11_UP} {$DEFINE DELPHI_10_UP} {$ENDIF}
{$IFDEF DELPHI_10_UP} {$DEFINE DELPHI_9_UP} {$ENDIF}
{$IFDEF DELPHI_9_UP} {$DEFINE DELPHI_8_UP} {$ENDIF}
{$IFDEF DELPHI_8_UP} {$DEFINE DELPHI_7_UP} {$ENDIF}
{$IFDEF DELPHI_7_UP} {$DEFINE DELPHI_6_UP} {$ENDIF}
{$IFDEF DELPHI_6_UP} {$DEFINE DELPHI_5_UP} {$ENDIF}
{$IFDEF DELPHI_5_UP} {$DEFINE DELPHI_4_UP} {$ENDIF}
{$IFDEF DELPHI_4_UP} {$DEFINE DELPHI_3_UP} {$ENDIF}
{$IFDEF DELPHI_3_UP} {$DEFINE DELPHI_2_UP} {$ENDIF}
{$IFDEF DELPHI_2_UP} {$DEFINE DELPHI_1_UP} {$ENDIF}
// BCB_X_UP from BCB_X mappings
{$IFDEF BCB_16} {$DEFINE BCB_16_UP} {$ENDIF}
{$IFDEF BCB_15} {$DEFINE BCB_15_UP} {$ENDIF}
{$IFDEF BCB_14} {$DEFINE BCB_14_UP} {$ENDIF}
{$IFDEF BCB_12} {$DEFINE BCB_12_UP} {$ENDIF}
{$IFDEF BCB_11} {$DEFINE BCB_11_UP} {$ENDIF}
{$IFDEF BCB_10} {$DEFINE BCB_10_UP} {$ENDIF}
{$IFDEF BCB_6} {$DEFINE BCB_6_UP} {$ENDIF}
{$IFDEF BCB_5} {$DEFINE BCB_5_UP} {$ENDIF}
{$IFDEF BCB_4} {$DEFINE BCB_4_UP} {$ENDIF}
{$IFDEF BCB_3} {$DEFINE BCB_3_UP} {$ENDIF}
{$IFDEF BCB_1} {$DEFINE BCB_1_UP} {$ENDIF}
// BCBX_UP from BCBX_UP mappings
{$IFDEF BCB_16_UP} {$DEFINE BCB_15_UP} {$ENDIF}
{$IFDEF BCB_15_UP} {$DEFINE BCB_14_UP} {$ENDIF}
{$IFDEF BCB_14_UP} {$DEFINE BCB_12_UP} {$ENDIF}
{$IFDEF BCB_12_UP} {$DEFINE BCB_11_UP} {$ENDIF}
{$IFDEF BCB_11_UP} {$DEFINE BCB_10_UP} {$ENDIF}
{$IFDEF BCB_10_UP} {$DEFINE BCB_6_UP} {$ENDIF}
{$IFDEF BCB_6_UP} {$DEFINE BCB_5_UP} {$ENDIF}
{$IFDEF BCB_5_UP} {$DEFINE BCB_4_UP} {$ENDIF}
{$IFDEF BCB_4_UP} {$DEFINE BCB_3_UP} {$ENDIF}
{$IFDEF BCB_3_UP} {$DEFINE BCB_1_UP} {$ENDIF}
// COMPILER_X_UP from COMPILER_X mappings
{$IFDEF COMPILER_16} {$DEFINE COMPILER_16_UP} {$ENDIF}
{$IFDEF COMPILER_15} {$DEFINE COMPILER_15_UP} {$ENDIF}
{$IFDEF COMPILER_14} {$DEFINE COMPILER_14_UP} {$ENDIF}
{$IFDEF COMPILER_12} {$DEFINE COMPILER_12_UP} {$ENDIF}
{$IFDEF COMPILER_11} {$DEFINE COMPILER_11_UP} {$ENDIF}
{$IFDEF COMPILER_10} {$DEFINE COMPILER_10_UP} {$ENDIF}
{$IFDEF COMPILER_9} {$DEFINE COMPILER_9_UP} {$ENDIF}
{$IFDEF COMPILER_8} {$DEFINE COMPILER_8_UP} {$ENDIF}
{$IFDEF COMPILER_7} {$DEFINE COMPILER_7_UP} {$ENDIF}
{$IFDEF COMPILER_6} {$DEFINE COMPILER_6_UP} {$ENDIF}
{$IFDEF COMPILER_5} {$DEFINE COMPILER_5_UP} {$ENDIF}
{$IFDEF COMPILER_4} {$DEFINE COMPILER_4_UP} {$ENDIF}
{$IFDEF COMPILER_35} {$DEFINE COMPILER_35_UP} {$ENDIF}
{$IFDEF COMPILER_3} {$DEFINE COMPILER_3_UP} {$ENDIF}
{$IFDEF COMPILER_2} {$DEFINE COMPILER_2_UP} {$ENDIF}
{$IFDEF COMPILER_1} {$DEFINE COMPILER_1_UP} {$ENDIF}
// COMPIlER_X_UP from COMPILER_X_UP mappings
{$IFDEF COMPILER_16_UP} {$DEFINE COMPILER_15_UP} {$ENDIF}
{$IFDEF COMPILER_15_UP} {$DEFINE COMPILER_14_UP} {$ENDIF}
{$IFDEF COMPILER_14_UP} {$DEFINE COMPILER_12_UP} {$ENDIF}
{$IFDEF COMPILER_12_UP} {$DEFINE COMPILER_11_UP} {$ENDIF}
{$IFDEF COMPILER_11_UP} {$DEFINE COMPILER_10_UP} {$ENDIF}
{$IFDEF COMPILER_10_UP} {$DEFINE COMPILER_9_UP} {$ENDIF}
{$IFDEF COMPILER_9_UP} {$DEFINE COMPILER_8_UP} {$ENDIF}
{$IFDEF COMPILER_8_UP} {$DEFINE COMPILER_7_UP} {$ENDIF}
{$IFDEF COMPILER_7_UP} {$DEFINE COMPILER_6_UP} {$ENDIF}
{$IFDEF COMPILER_6_UP} {$DEFINE COMPILER_5_UP} {$ENDIF}
{$IFDEF COMPILER_5_UP} {$DEFINE COMPILER_4_UP} {$ENDIF}
{$IFDEF COMPILER_4_UP} {$DEFINE COMPILER_35_UP} {$ENDIF}
{$IFDEF COMPILER_35_UP} {$DEFINE COMPILER_3_UP} {$ENDIF}
{$IFDEF COMPILER_3_UP} {$DEFINE COMPILER_2_UP} {$ENDIF}
{$IFDEF COMPILER_2_UP} {$DEFINE COMPILER_1_UP} {$ENDIF}
// Map COMPILER_X_UP to friendly feature names
{$IFDEF COMPILER_4_UP}
{$DEFINE SUPPORTS_DEFAULTPARAMS}
{$DEFINE SUPPORTS_INT64}
{$DEFINE SUPPORTS_LONGWORD}
{$DEFINE SUPPORTS_OVERLOAD}
{$ENDIF COMPILER_4_UP}
{$IFDEF COMPILER_6_UP}
{$DEFINE HAS_UNIT_RTLCONSTS}
{$DEFINE HAS_UNIT_TYPES}
{$DEFINE SUPPORTS_DEPRECATED}
{$DEFINE SUPPORTS_DEPRECATED_WARNINGS}
{$DEFINE SUPPORTS_ENUMVALUE}
{$DEFINE SUPPORTS_VARARGS}
{$ENDIF COMPILER_6_UP}
{$IFDEF COMPILER_9_UP}
{$DEFINE SUPPORTS_FOR_IN}
{$DEFINE SUPPORTS_INLINE}
{$ENDIF COMPILER_9_UP}
{$IFDEF COMPILER_12_UP}
{$IFNDEF CLR}
{$DEFINE SUPPORTS_UNICODE_STRING}
{$ENDIF CLR}
{$ENDIF COMPILER_12_UP}
{$IFDEF COMPILER_16_UP}
{$DEFINE HAS_UNITSCOPE}
{$ENDIF COMPILER_16_UP}
{ Test for 64 bit compiler. }
{$IFDEF CPUX64}
{$DEFINE CPU64} // Compiler target is 64 bit, rather than 32 bit.
{$ELSE CPUX64}
{ Assume 32-bit compiler by default. }
{$DEFINE CPUX86} // CPU is an Intel 386 or later on any platform.
{$DEFINE CPU32} // Compiler target is 32 bit, rather than 64 bit.
{$ENDIF CPUX64}
{$ENDIF FPC}
//------------------------------------------------------------------------------
// General Compiler Settings
//------------------------------------------------------------------------------
{$A+}
(* The $A directive controls alignment of fields in record types.
In the {$A+} state, fields in record types that are declared without the
packed modifier are aligned. In the {$A-} state, fields in record types
are never aligned. Record type field alignment is described in the Object
Pascal Language Guide.
Regardless of the state of the $A directive, variables and typed constants
are always aligned for optimal access. In the {$A+} state, execution
will be faster. *)
{$B-}
(* The $B directive switches between the two different models of code
generation for the and and or Boolean operators.
In the {$B+} state, the compiler generates code for complete Boolean
expression evaluation. This means that every operand of a Boolean
expression built from the and and or operators is guaranteed to be
evaluated, even when the result of the entire expression is already known.
In the {$B-} state, the compiler generates code for short-circuit Boolean
expression evaluation, which means that evaluation stops as soon as the
result of the entire expression becomes evident in left to right order
of evaluation. *)
{$H+}
(* The $H directive controls the meaning of the reserved word string when
used alone in a type declaration. The generic type string can represent
either a long, dynamically-allocated string (the fundamental type AnsiString)
or a short, statically-allocated string (the fundamental type ShortString).
By default {$H+}, Delphi defines the generic string type to be the long
AnsiString. All components in the Visual Component Library are compiled
in this state. If you write components, they should also use long strings,
as should any code that receives data from VCL string-type properties.
The {$H-} state is mostly useful for using code from versions of Object
Pascal that used short strings by default. You can locally override the
meaning of string-type definitions to ensure generation of short strings.
You can also change declarations of short string types to string[255] or
ShortString, which are unambiguous and independent of the $H setting. *)
{$J-}
(* The $J directive controls whether typed constants can be modified or not.
In the {$J+} state, typed constants can be modified, and are in essence
initialized variables. In the {$J-} state, typed constants are truly
constant, and any attempt to modify a typed constant causes the compiler
to report an error. *)
{$T+}
(* The $T directive controls the types of pointer values generated by the
@ operator and the compatibility of pointer types.
In the {$T-} state, the result of the @ operator is always an untyped
pointer (Pointer) that is compatible with all other pointer types.
When @ is applied to a variable reference in the {$T+} state, the result
is a typed pointer that is compatible only with Pointer and with other
pointers to the type of the variable. *)
{$X+}
(* The $X directive enables or disables Delphi's extended syntax. *)
{$IFDEF BCB_3_UP}
{$OBJEXPORTALL ON}
{$ENDIF}
(* C++ Builder requires this if you use Delphi components in run-time packages. *)
{$IFDEF COMPILER_6_UP}
{$DEFINE HAS_UNIT_VARIANTS}
{$WARN SYMBOL_PLATFORM OFF}
{$WARN UNIT_PLATFORM OFF}
{$ENDIF}
(* Disables platform warnings for Delphi 6 and later. *)
{$IFDEF COMPILER_7_UP}
{$WARN UNSAFE_CAST OFF}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_TYPE OFF}
{$ENDIF}
(* Disables .NET warnings for Delphi 7 and later. *)
{ }