fp might be NULL.
[minix.git] / include / ansi.h
blob9d3d8a1357bd59bb9033f82cf777485b465be70d
1 /* The <ansi.h> header attempts to decide whether the compiler has enough
2 * conformance to Standard C for Minix to take advantage of. If so, the
3 * symbol _ANSI is defined (as 31459). Otherwise _ANSI is not defined
4 * here, but it may be defined by applications that want to bend the rules.
5 * The magic number in the definition is to inhibit unnecessary bending
6 * of the rules. (For consistency with the new '#ifdef _ANSI" tests in
7 * the headers, _ANSI should really be defined as nothing, but that would
8 * break many library routines that use "#if _ANSI".)
10 * If _ANSI ends up being defined, a macro
12 * _PROTOTYPE(function, params)
14 * is defined. This macro expands in different ways, generating either
15 * ANSI Standard C prototypes or old-style K&R (Kernighan & Ritchie)
16 * prototypes, as needed. Finally, some programs use _CONST, _VOIDSTAR etc
17 * in such a way that they are portable over both ANSI and K&R compilers.
18 * The appropriate macros are defined here.
21 #ifndef _ANSI_H
22 #define _ANSI_H
24 #if __STDC__ == 1
25 #define _ANSI 31459 /* compiler claims full ANSI conformance */
26 #endif
28 #ifdef __GNUC__
29 #define _ANSI 31459 /* gcc conforms enough even in non-ANSI mode */
30 #endif
32 #define _VOIDSTAR void *
33 #define _VOID void
35 #ifdef _ANSI
37 /* Keep everything for ANSI prototypes. */
38 #define _PROTOTYPE(function, params) function params
39 #define _ARGS(params) params
41 #define _CONST const
42 #define _VOLATILE volatile
43 #define _SIZET size_t
45 #else
47 /* Throw away the parameters for K&R prototypes. */
48 #define _PROTOTYPE(function, params) function()
49 #define _ARGS(params) ()
51 #define _CONST
52 #define _VOLATILE
53 #define _SIZET int
55 #endif /* _ANSI */
57 #if defined(__GNUC__) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901
58 #define __LONG_LONG_SUPPORTED 1
59 #endif
61 /* This should be defined as restrict when a C99 compiler is used. */
62 #define _RESTRICT
64 /* Setting any of _MINIX, _POSIX_C_SOURCE or _POSIX2_SOURCE implies
65 * _POSIX_SOURCE. (Seems wrong to put this here in ANSI space.)
67 #if defined(_MINIX) || _POSIX_C_SOURCE > 0 || defined(_POSIX2_SOURCE)
68 #undef _POSIX_SOURCE
69 #define _POSIX_SOURCE 1
70 #endif
72 #endif /* ANSI_H */