]>
Commit | Line | Data |
---|---|---|
726f6388 JA |
1 | /* stdc.h -- macros to make source compile on both ANSI C and K&R C |
2 | compilers. */ | |
3 | ||
4 | /* Copyright (C) 1993 Free Software Foundation, Inc. | |
5 | ||
6 | This file is part of GNU Bash, the Bourne Again SHell. | |
7 | ||
3185942a JA |
8 | Bash is free software: you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation, either version 3 of the License, or | |
11 | (at your option) any later version. | |
726f6388 | 12 | |
3185942a JA |
13 | Bash is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
726f6388 JA |
17 | |
18 | You should have received a copy of the GNU General Public License | |
3185942a JA |
19 | along with Bash. If not, see <http://www.gnu.org/licenses/>. |
20 | */ | |
726f6388 | 21 | |
ccc6cda3 JA |
22 | #if !defined (_STDC_H_) |
23 | #define _STDC_H_ | |
726f6388 JA |
24 | |
25 | /* Adapted from BSD /usr/include/sys/cdefs.h. */ | |
26 | ||
27 | /* A function can be defined using prototypes and compile on both ANSI C | |
28 | and traditional C compilers with something like this: | |
29 | extern char *func __P((char *, char *, int)); */ | |
ccc6cda3 | 30 | |
bb70624e | 31 | #if !defined (__P) |
7117c2d2 | 32 | # if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus) || defined (PROTOTYPES) |
726f6388 | 33 | # define __P(protos) protos |
bb70624e JA |
34 | # else |
35 | # define __P(protos) () | |
726f6388 | 36 | # endif |
bb70624e JA |
37 | #endif |
38 | ||
d233b485 CR |
39 | /* New definition to use, moving away from __P since it's part of a reserved |
40 | namespace */ | |
41 | #if !defined (PARAMS) | |
42 | # if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus) || defined (PROTOTYPES) | |
43 | # define PARAMS(protos) protos | |
44 | # else | |
45 | # define PARAMS(protos) () | |
46 | # endif | |
47 | #endif | |
48 | ||
ac50fbac | 49 | /* Fortify, at least, has trouble with this definition */ |
f73dda09 | 50 | #if defined (HAVE_STRINGIZE) |
ac50fbac | 51 | # define CPP_STRING(x) #x |
f73dda09 | 52 | #else |
ac50fbac | 53 | # define CPP_STRING(x) "x" |
f73dda09 JA |
54 | #endif |
55 | ||
56 | #if !defined (__STDC__) | |
726f6388 JA |
57 | |
58 | #if defined (__GNUC__) /* gcc with -traditional */ | |
726f6388 JA |
59 | # if !defined (signed) |
60 | # define signed __signed | |
61 | # endif | |
62 | # if !defined (volatile) | |
63 | # define volatile __volatile | |
64 | # endif | |
65 | #else /* !__GNUC__ */ | |
726f6388 JA |
66 | # if !defined (inline) |
67 | # define inline | |
68 | # endif | |
69 | # if !defined (signed) | |
70 | # define signed | |
71 | # endif | |
72 | # if !defined (volatile) | |
73 | # define volatile | |
74 | # endif | |
75 | #endif /* !__GNUC__ */ | |
76 | ||
77 | #endif /* !__STDC__ */ | |
78 | ||
f73dda09 | 79 | #ifndef __attribute__ |
b80f6443 | 80 | # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) |
f73dda09 JA |
81 | # define __attribute__(x) |
82 | # endif | |
83 | #endif | |
84 | ||
7117c2d2 JA |
85 | /* For those situations when gcc handles inlining a particular function but |
86 | other compilers complain. */ | |
87 | #ifdef __GNUC__ | |
88 | # define INLINE inline | |
89 | #else | |
90 | # define INLINE | |
91 | #endif | |
92 | ||
93 | #if defined (PREFER_STDARG) | |
94 | # define SH_VA_START(va, arg) va_start(va, arg) | |
95 | #else | |
96 | # define SH_VA_START(va, arg) va_start(va) | |
97 | #endif | |
98 | ||
ccc6cda3 | 99 | #endif /* !_STDC_H_ */ |