Watt-32 tcp/ip  2.2 dev-rel.10
target.h
Go to the documentation of this file.
1 #ifndef _w32_TARGET_H
2 #define _w32_TARGET_H
3 
11 #ifndef _w32_WATTCP_H
12 #error TARGET.H must be included inside or after WATTCP.H
13 #endif
14 
15 #define DOS4GW 1
16 #define DJGPP 2
17 #define PHARLAP 4
18 #define PHAR286 8
19 #define POWERPAK 16
20 #define X32VM 32
21 #define WINWATT 64
22 #define PHARLAP_DLL (0x80|PHARLAP)
23 #define DOS4GW_DLL (0x80|DOS4GW)
24 #define DJGPP_DXE (0x80|DJGPP)
26 /*
27  * Notes:
28  *
29  * (1) Most 32-bit DOS compilers (Borland/Watcom/Microsoft/HighC/DMC)
30  * will work with this DOS extender. Some compilers support far
31  * pointers (48-bits), some don't. And even worse, some of those who
32  * do, have bugs in their segment register handling!
33  * Add `-DBUGGY_FARPTR=1' to your makefile's CFLAGS if you experience
34  * this or crashes in weird places (generate .asm listing to find out).
35  *
36  * The problem is present in:
37  * - Metaware's HighC v3.1 at -O3 or above (for sure).
38  * - BCC32 v4, Some rumours say far-ptrs in combination with FPU-ops.
39  *
40  * (2) Several DOS-extenders supports Watcom-386. DOS4GW (from Tenberry)
41  * is a DPMI 0.9 host with limited API. Other compatible DOS-extenders
42  * can also be used without modifying Watt-32. These are:
43  * DOS4GW Pro, DOS4G, Pmode/W, CauseWay, DOS32A, EDOS, WDOSX, HX-DOS and
44  * Zurenava. Watcom-386 with FlashTek's X-32 hasn't been tested.
45  *
46  */
47 
48 #ifndef BUGGY_FARPTR
49 #define BUGGY_FARPTR 0 /* Assume no compilers have fp-bugs, duh! */
50 #endif
51 
52 #if defined(_MSC_VER) && defined(M_I86SM) /* Microsoft doesn't have */
53  #define __SMALL__ /* __SMALL__, __LARGE__ */
54 #endif
55 
56 #if defined(_MSC_VER) && defined(M_I86LM)
57  #define __LARGE__
58 #endif
59 
60 #if defined(__TINY__) || defined(__COMPACT__) || defined(__MEDIUM__) || defined(__HUGE__)
61  #error Unsupported memory model (tiny/compact/medium/huge)
62 #endif
63 
64 #if defined(M_I86TM) || defined(M_I86CM) || defined(M_I86MM) || defined(M_I86HM)
65  #error Unsupported memory model (tiny/compact/medium/huge)
66 #endif
67 
68 #if defined(_M_I86MM) || defined(_M_I86MH)
69  #error Unsupported memory model (medium/huge)
70 #endif
71 
72 /* 32-bit Digital Mars Compiler defines __SMALL__. So take care when testing
73  * for real __SMALL__.
74  */
75 #if defined(__DMC__) && (__INTSIZE==4) && defined(__SMALL__)
76  #define __SMALL32__
77  #define DMC386
78 #endif
79 
80 #if (defined(__SMALL__) || defined(__LARGE__)) && !defined(__SMALL32__)
81  #undef DOSX
82  #define DOSX 0
83 #endif
84 
85 /*
86  * djgpp 2.x with GNU C 2.7 or later.
87  */
88 #if defined(__DJGPP__) && defined(__GNUC__)
89  #undef DOSX
90  #define DOSX DJGPP
91 #endif
92 
93 /*
94  * Watcom 11.x or OpenWatcom 1.x.
95  */
96 #if defined(__WATCOMC__) && defined(__386__)
97  #ifndef DOSX /* If not set in watcom_*.mak file */
98  #undef DOSX
99  #define DOSX DOS4GW /* may be DOS4GW, X32VM or PHARLAP */
100  #endif
101  #define WATCOM386
102 #endif
103 
104 /*
105  * Digital Mars Compiler 8.30+
106  */
107 #if defined(__DMC__) && (__INTSIZE==4)
108  #ifndef DOSX /* If not set in dmars_*.mak file */
109  #undef DOSX
110  #define DOSX PHARLAP /* may be X32VM, DOS4GW or PHARLAP */
111  #endif
112 #endif
113 
114 /*
115  * PellesC works with Win32 only.
116  * Note: "pocc -Ze" sets _MSC_VER. Hence the #undef (would cause
117  * troubles otherwise).
118  */
119 #if defined(__POCC__)
120  #if !defined(__POCC__OLDNAMES)
121  #error Use the "pocc -Go" option.
122  #endif
123  #undef DOSX
124  #define DOSX WINWATT
125  #undef _MSC_VER
126 #endif
127 
128 /*
129  * Microsoft Visual-C 32-bit. Really not supported with PharLap,
130  * but works with Win32 as target.
131  */
132 #if defined(_MSC_VER) && (_M_IX86 >= 300)
133  #undef DOSX
134  #define DOSX WINWATT /* VC 2.0 can use PHARLAP too */
135  #define MSC386
136 #endif
137 
138 /*
139  * Metaware's High-C 3.x.
140  */
141 #if defined(__HIGHC__)
142  #if !defined(_I386) || (_I386 == 0)
143  #error What CPU are you for?
144  #endif
145  #if !defined(__i386__)
146  #define __i386__
147  #endif
148 
149  #undef DOSX
150  #define DOSX PHARLAP /* Is DOS4GW possible? */
151 #endif
152 
153 /*
154  * Borland 32-bit PowerPak compiler (v4.x, v5.x untested)
155  */
156 #if defined(__BORLANDC__) && defined(__FLAT__) && defined(__DPMI32__)
157  #define BORLAND386
158  #undef DOSX
159  #define DOSX POWERPAK /* may also be DOS4GW (for WDOSX targets) */
160  /* or PHARLAP (not yet) */
161 #endif
162 
163 #if defined(__BORLANDC__) && defined(WIN32)
164  #define BORLAND_WIN32
165  #undef DOSX
166  #define DOSX WINWATT
167 #endif
168 
169 /*
170  * LadSoft (cc386 is rather buggy, so it's not really supported)
171  */
172 #if defined(__CCDL__) && defined(__386__)
173  #undef DOSX
174  #define DOSX DOS4GW
175 #endif
176 
177 /*
178  * Build for Windows (dll and static lib).
179  */
180 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(__CYGWIN__)
181  #undef DOSX
182  #define DOSX WINWATT
183 #endif
184 
185 #if defined(__CYGWIN__) && defined(_REENT_ONLY) && defined(WATT32_BUILD)
186  #error "CygWin with _REENT_ONLY is not supported."
187 #endif
188 
189 #if !defined(DOSX)
190  #error DOSX target not defined
191 #endif
192 
193 #if (defined(MSDOS) || defined(_MSDOS)) && !defined(__MSDOS__)
194 #define __MSDOS__ /* dmc etc. defines only MSDOS+_MSDOS */
195 #endif
196 
197 #if (DOSX == 0) && !defined(__MSDOS__)
198  #error __MSDOS__ not defined for a real-mode DOS compiler!?
199 #endif
200 
201 #if (DOSX & WINWATT) == 0 && !defined(__MSDOS__)
202  #define __MSDOS__
203 #endif
204 
205 
206 /*
207  * Macros and hacks depending on target (i.e. DOS-extender or Windows).
208  */
209 
210 #if (DOSX & PHARLAP)
211  #include <stdio.h>
212  #include <pharlap.h>
213  #undef FP_OFF
214  #include <dos.h>
215 
216  #ifdef WATCOM386
217  #include <i86.h>
218  #endif
219 
220  extern REALPTR _watt_dosTbr;
221  extern DWORD _watt_dosTbSize;
222 
223  #if !defined(DMC386) && /* It supports far-ptr, but don't use them */ \
224  (!BUGGY_FARPTR) && /* Trust the compiler to handle far-ptr ? */ \
225  (__CMPLR_FEATURES__ & __FEATURE_FARPTR__) /* compilers with far-ptrs */
226  #define HAVE_FARPPTR48 /* i.e. HighC, Watcom386 */
227  extern FARPTR _watt_dosFp;
228 
229  #define DOSMEM(s,o,t) *(t _far*)(_watt_dosFp + (DWORD)((o)|(s)<<4))
230  #define PEEKB(s,o) DOSMEM(s,o,BYTE)
231  #define PEEKW(s,o) DOSMEM(s,o,WORD)
232  #define PEEKL(s,o) DOSMEM(s,o,DWORD)
233  #define POKEB(s,o,x) DOSMEM(s,o,BYTE) = (BYTE)(x)
234  #define POKEW(s,o,x) DOSMEM(s,o,WORD) = (WORD)(x)
235  #define POKEL(s,o,x) DOSMEM(s,o,DWORD) = (DWORD)(x)
236  #else
237  #define PEEKB(s,o) PeekRealByte (((s) << 16) + (o))
238  #define PEEKW(s,o) PeekRealWord (((s) << 16) + (o))
239  #define PEEKL(s,o) PeekRealDWord(((s) << 16) + (o))
240  #define POKEB(s,o,x) PokeRealByte (((s) << 16) + (o), (x))
241  #define POKEW(s,o,x) PokeRealWord (((s) << 16) + (o), (x))
242  #define POKEL(s,o,x) PokeRealDWord(((s) << 16) + (o), (x))
243  #endif
244 
245 #elif (DOSX & PHAR286) /* 16-bit protected mode */
246  #include <stdio.h>
247  #include <phapi.h>
248 
249  #error Pharlap Lite not supported yet
250 
251 #elif (DOSX & DJGPP)
252  #include <dos.h>
253  #include <dpmi.h>
254  #include <go32.h>
255  #include <sys/farptr.h>
256 
257  #define PEEKB(s,o) _farpeekb (_dos_ds, (o)+((s)<<4))
258  #define PEEKW(s,o) _farpeekw (_dos_ds, (o)+((s)<<4))
259  #define PEEKL(s,o) _farpeekl (_dos_ds, (o)+((s)<<4))
260  #define POKEB(s,o,x) _farpokeb (_dos_ds, (o)+((s)<<4), x)
261  #define POKEW(s,o,x) _farpokew (_dos_ds, (o)+((s)<<4), x)
262  #define POKEL(s,o,x) _farpokel (_dos_ds, (o)+((s)<<4), x)
263  #define BOOL int
264 
265 #elif (DOSX & DOS4GW) /* Watcom targets normally uses this section */
266  #if defined(__DJGPP__)
267  #include <dpmi.h>
268  #include <go32.h>
269 
270  #elif defined(__CCDL__)
271  #include <dpmi.h>
272  #include <i86.h>
273  #endif
274 
275  #include <dos.h>
276 
277  extern WORD _watt_dosTbSeg;
278  extern DWORD _watt_dosTbSize;
279 
280  #define DOSMEM(s,o,t) *(volatile t *) (((s) << 4) | (o))
281  #define PEEKB(s,o) DOSMEM(s,o,BYTE)
282  #define PEEKW(s,o) DOSMEM(s,o,WORD)
283  #define PEEKL(s,o) DOSMEM(s,o,DWORD)
284  #define POKEB(s,o,x) DOSMEM(s,o,BYTE) = (BYTE)(x)
285  #define POKEW(s,o,x) DOSMEM(s,o,WORD) = (WORD)(x)
286  #define POKEL(s,o,x) DOSMEM(s,o,DWORD) = (DWORD)(x)
287  #undef BOOL
288  #define BOOL int
289 
290 #elif (DOSX & X32VM)
291  #include <x32.h>
292 
293  #if defined(DMC386) || defined(WATCOM386)
294  #define HAVE_FARPTR48
295  typedef BYTE _far *FARPTR;
296  extern FARPTR _watt_dosFp;
297  #endif
298 
299  extern DWORD _watt_dosTbr, _watt_dosTbSize;
300 
301  #ifdef DMC386
302  #define DOSMEM(s,o,t) (t*)((DWORD)_x386_zero_base_ptr + (DWORD)((o)|(s)<<4))
303  #define PEEKB(s,o) *DOSMEM(s,o,BYTE)
304  #define PEEKW(s,o) *DOSMEM(s,o,WORD)
305  #define PEEKL(s,o) *DOSMEM(s,o,DWORD)
306  #define POKEB(s,o,x) *DOSMEM(s,o,BYTE) = (BYTE)(x)
307  #define POKEW(s,o,x) *DOSMEM(s,o,WORD) = (WORD)(x)
308  #define POKEL(s,o,x) *DOSMEM(s,o,DWORD) = (DWORD)(x)
309  #else
310  #define PEEKB(s,o) PeekRealByte (((s) << 16) + (o))
311  #define PEEKW(s,o) PeekRealWord (((s) << 16) + (o))
312  #define PEEKL(s,o) PeekRealDWord(((s) << 16) + (o))
313  #define POKEB(s,o,x) PokeRealByte (((s) << 16) + (o), x)
314  #define POKEW(s,o,x) PokeRealWord (((s) << 16) + (o), x)
315  #define POKEL(s,o,x) PokeRealDWord(((s) << 16) + (o), x)
316  #endif
317 
318  #undef BOOL
319  #define BOOL int
320 
321 #elif (DOSX & POWERPAK) /* Borland 32-bit DOS normally uses this section */
322  #include <dos.h>
323 
324  extern WORD _watt_dosTbSeg, _watt_dos_ds;
325  extern DWORD _watt_dosTbr, _watt_dosTbSize;
326 
327  #define PEEKB(s,o) _farpeekb (_watt_dos_ds, (o)+((s)<<4))
328  #define PEEKW(s,o) _farpeekw (_watt_dos_ds, (o)+((s)<<4))
329  #define PEEKL(s,o) _farpeekl (_watt_dos_ds, (o)+((s)<<4))
330  #define POKEB(s,o,x) _farpokeb (_watt_dos_ds, (o)+((s)<<4), x)
331  #define POKEW(s,o,x) _farpokew (_watt_dos_ds, (o)+((s)<<4), x)
332  #define POKEL(s,o,x) _farpokel (_watt_dos_ds, (o)+((s)<<4), x)
333  #undef BOOL
334  #define BOOL int
335 
336 #elif !(DOSX & WINWATT) /* All real-mode and non-Windows targets */
337  #include <dos.h>
338  #define BOOL int
339 
340  #if defined(__WATCOMC__) || defined(_MSC_VER)
341  #define PEEKB(s,o) (*((BYTE __far*) MK_FP(s,o)))
342  #define PEEKW(s,o) (*((WORD __far*) MK_FP(s,o)))
343  #define PEEKL(s,o) (*((DWORD __far*) MK_FP(s,o)))
344  #define POKEB(s,o,x) (*((BYTE __far*) MK_FP(s,o)) = (BYTE)(x))
345  #define POKEW(s,o,x) (*((WORD __far*) MK_FP(s,o)) = (WORD)(x))
346  #define POKEL(s,o,x) (*((DWORD __far*) MK_FP(s,o)) = (DWORD)(x))
347  #else
348  #define PEEKB(s,o) peekb(s,o)
349  #define PEEKW(s,o) (WORD) peek(s,o)
350  #define PEEKL(s,o) (*((DWORD far*) MK_FP(s,o)))
351  #define POKEB(s,o,x) pokeb (s,o,x)
352  #define POKEW(s,o,x) poke (s,o,x)
353  #define POKEL(s,o,x) (*((DWORD far*) MK_FP(s,o)) = (DWORD)(x))
354  #endif
355 #endif
356 
357 
358 /* Use Pharlap's definition of a DOS-memory address;
359  * segment in upper 16-bits, offset in lower 16-bits.
360  */
361 #if !(DOSX & PHARLAP) && !defined(REALPTR) && defined(__MSDOS__)
362  #define REALPTR DWORD
363 #endif
364 
365 #if (DOSX)
366  #define FARCODE
367  #define FARDATA
368 #else
369  #define FARCODE far
370  #define FARDATA far
371 #endif
372 
373 /*
374  * Macros and hacks depending on vendor (compiler).
375  */
376 
377 #if defined(__TURBOC__) && (__TURBOC__ <= 0x301)
378  #include <mem.h>
379  #include <alloc.h>
380 
381  #define OLD_TURBOC /* TCC <= 2.01 doesn't have <malloc.h> and <memory.h> */
382  #define __cdecl _Cdecl
383  #define _far far
384 #elif defined(__POCC__)
385  #include <string.h>
386  #include <stdlib.h>
387 #else
388  #include <stdlib.h>
389  #include <memory.h>
390  #include <malloc.h>
391 #endif
392 
393 #if defined(__HIGHC__)
394  #include <string.h>
395 
396  #define max(a,b) _max (a,b) /* intrinsic functions */
397  #define min(a,b) _min (a,b)
398  #define ENABLE() _inline (0xFB) /* sti */
399  #define DISABLE() _inline (0xFA) /* cli */
400 #endif
401 
402 #if defined(_MSC_VER) && !defined(__POCC__) /* "cl" and not "pocc -Ze" */
403  #if (DOSX) && (DOSX != WINWATT) && (DOSX != PHARLAP)
404  #error Microsoft-C and non-Win32 or non-Pharlap targets not supported
405  #endif
406 
407  #undef cdecl
408 
409  #if (_MSC_VER <= 600) /* A few exceptions for Quick-C <= 6.0 */
410  #define NO_INLINE_ASM /* doesn't have built-in assembler */
411  #define ENABLE() _enable()
412  #define DISABLE() _disable()
413  #define cdecl _cdecl
414  #else
415  /* #pragma warning (disable:4103 4113 4229) */
416  /* #pragma warning (disable:4024 4047 4761 4791) */
417 
418  /*
419  * 4244: "'function': convertion from '__w64' to 'int', possible
420  * loss of data".
421  * 4267: "'=': convertion from 'size_t' to 'int', possible
422  * loss of data".
423  * 4312: 'type cast' : conversion from 'int' to 'void *' of greater size.
424  * 4996: "The POSIX name for this item is deprecated. Instead, use
425  * the ISO C++ conformant name...".
426  */
427  #if (_MSC_VER >= 1500) /* VC9+ */
428  #pragma warning (disable:4090 4244 4267 4312 4996)
429  #ifndef _USE_32BIT_TIME_T
430 /* !! #error Need to define "_USE_32BIT_TIME_T" for ABI compatability. No need? */
431  #endif
432  #endif
433 
434  #define ENABLE() __asm sti
435  #define DISABLE() __asm cli
436  #define asm __asm
437  #define cdecl __cdecl
438  #endif
439 
440  #if (_MSC_VER >= 800)
441  #pragma intrinsic (abs, memcmp, memcpy, memset)
442  #pragma intrinsic (strcat, strcmp, strcpy, strlen)
443  #if (DOSX == 0)
444  #pragma intrinsic (_fmemcpy)
445  #endif
446  #endif
447 
448  #if !defined(__i386__) && defined(_M_IX86)
449  #define __i386__
450  #endif
451 
452  #if (DOSX == 0)
453  #define interrupt _interrupt far
454  #define getvect(a) _dos_getvect (a)
455  #define setvect(a,b) _dos_setvect (a, b)
456  #undef MK_FP
457  #define MK_FP(s,o) (void _far*) (((DWORD)(s) << 16) + (DWORD)(o))
458  #endif
459 #endif
460 
461 #if defined(__TURBOC__) || defined(__BORLANDC__)
462  #if defined(__DPMI16__)
463  #error 16-bit DPMI version not supported
464  #endif
465 
466  #include <string.h>
467 
468  #define ENABLE() __emit__(0xFB)
469  #define DISABLE() __emit__(0xFA)
470 
471  #pragma warn -bbf- /* "Bitfields must be signed or unsigned int" warning */
472  #pragma warn -sig- /* "Conversion may loose significant digits" warning */
473  #pragma warn -cln- /* "Constant is long" warning */
474 
475  #if defined(__DPMI32__)
476  #pragma warn -stu- /* structure undefined */
477  #pragma warn -aus- /* assigned a value that is never used */
478  #endif
479 
480  /* make string/memory functions inline */
481  #if defined(__BORLANDC__) && !defined(__DPMI32__)
482  #define strlen __strlen__
483  #define strncpy __strncpy__
484  #define strrchr __strrchr__
485  #define strncmp __strncmp__
486  #define memset __memset__
487  #define memcpy __memcpy__
488  #define memcmp __memcmp__
489  #define memchr __memchr__
490  #endif
491 #endif
492 
493 #if defined(__GNUC__)
494  #if (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1))
495  #error I need GCC 3.1 or later
496  #endif
497  #include <string.h>
498 
499  #ifndef __fastcall
500  #define __fastcall __attribute__((__fastcall__)) /* unsupported in gcc/djgpp */
501  #endif
502 
503  #ifndef _fastcall
504  #define _fastcall __attribute__((__fastcall__))
505  #endif
506 
507  #if !(DOSX & WINWATT)
508  #define ENABLE() __asm__ __volatile__ ("sti")
509  #define DISABLE() __asm__ __volatile__ ("cli")
510  #endif
511 #endif
512 
513 #if defined(__WATCOMC__)
514  #include <dos.h>
515  #include <string.h>
516 
517  #if !defined(_M_IX86)
518  #error Only Watcom x86 supported
519  #endif
520 
521  /* Code inside "W32_NO_8087" is meant to be excluded on a 8086 PC.
522  * Since they don't have a math processor, we should prevent the math
523  * emulation library to be linked in. The define "__SW_0" is set by
524  * "wcc -0".
525  */
526  #if defined(__SW_0) && !defined(__SW_FPI87)
527  #define W32_NO_8087
528  #endif
529 
530  #pragma intrinsic (strcmp, memset)
531  #pragma warning (disable:120)
532  #if (__WATCOMC__ >= 1220) /* OW 1.2+ */
533  /* #pragma warning (disable:H3006 H3007) */
534  #endif
535 
536  #if defined(__MSDOS__)
537  #define getvect(a) _dos_getvect (a)
538  #define setvect(a,b) _dos_setvect (a, b)
539  #define BOOL int
540 
541  extern void ENABLE (void);
542  extern void DISABLE (void);
543  #pragma aux ENABLE = 0xFB;
544  #pragma aux DISABLE = 0xFA;
545  #endif
546 #endif
547 
548 #if defined(WIN32) || defined(WIN64)
549  extern CRITICAL_SECTION _watt_crit_sect;
550 
551  #if defined(__LCC__)
552  #define ENTER_CRIT() EnterCriticalSection ((struct _CRITICAL_SECTION*)&_watt_crit_sect)
553  #define LEAVE_CRIT() LeaveCriticalSection ((struct _CRITICAL_SECTION*)&_watt_crit_sect)
554  #else
555  #define ENTER_CRIT() EnterCriticalSection (&_watt_crit_sect)
556  #define LEAVE_CRIT() LeaveCriticalSection (&_watt_crit_sect)
557  #endif
558 
559  #undef DISABLE
560  #undef ENABLE
561  #define DISABLE() ENTER_CRIT()
562  #define ENABLE() LEAVE_CRIT()
563 
564 #else
565 
566  #if defined(__DMC__)
567  #include <dos.h>
568  #include <dpmi.h>
569  #include <string.h>
570 
571  #define ENABLE() enable()
572  #define DISABLE() disable()
573 
574  #elif defined(__CCDL__)
575  #include <string.h>
576  #include <dos.h>
577 
578  #define cdecl _cdecl
579  #define BOOL int
580  #define ENABLE() asm sti
581  #define DISABLE() asm cli
582  #endif
583 
584  #define ENTER_CRIT() ((void)0)
585  #define LEAVE_CRIT() ((void)0)
586 #endif /* WIN32 || WIN64 */
587 
588 
589 #if !defined(cdecl) && defined(__GNUC__) && (defined(__MINGW32__) || defined(__CYGWIN__))
590 #define cdecl __attribute__((__cdecl__))
591 #endif
592 
593 #ifndef cdecl
594 #define cdecl
595 #endif
596 
597 #if (DOSX & (DOS4GW|X32VM))
598 #define HAVE_DOS_NEAR_PTR /* Can use 32-ptr to access DOS-mem directly */
599 #endif
600 
601 #ifndef max
602 #define max(a,b) (((a) > (b)) ? (a) : (b))
603 #endif
604 
605 #ifndef min
606 #define min(a,b) (((a) < (b)) ? (a) : (b))
607 #endif
608 
609 /*
610  * Macros for gcc 2.5+ features.
611  */
612 #if (W32_GCC_VERSION >= 20500)
613  #define ATTR_PRINTF(_1,_2) \
614  __attribute__((format(printf,_1,_2))) /* var-args are printf()-like */
615 
616  #define ATTR_SCANF(_1,_2) \
617  __attribute__((format(scanf,_1,_2))) /* var-args are scanf()-like */
618 
619  #define ATTR_NOINLINE() \
620  __attribute__ ((__noinline__)) /* do not inline this func */
621 
622  #define ATTR_REGPARM(_n) \
623  __attribute__((regparm(_n))) /* paramerers are in registers. */
624 
625  #define ATTR_NORETURN() \
626  __attribute__((noreturn)) /* function never returns */
627 
628  #define ATTR_DEPRECATED() \
629  __attribute__ ((__deprecated__)) /* warn on deprecated type/func */
630 
631 #else
632  #define ATTR_PRINTF(_1,_2)
633  #define ATTR_SCANF(_1,_2)
634  #define ATTR_NOINLINE()
635  #define ATTR_NORETURN()
636 #endif
637 
638 /*
639  * C-99 (?) __FUNCTION__
640  */
641 #if defined(__LCC__) || defined(__POCC__)
642  #define __FUNCTION__ __func__
643 #elif (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__DMC__)
644  /* __FUNCTION__ is built-in */
645 #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
646  #define __FUNCTION__ __func__
647 #elif !defined(__GNUC__) && !defined(__WATCOMC__)
648  #define __FUNCTION__ "func?"
649 #endif
650 
651 #endif /* _w32_TARGET_H */
652