Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 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 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 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. |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 12 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 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. |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 17 | |
| 18 | You should have received a copy of the GNU General Public License |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 19 | along with Bash. If not, see <http://www.gnu.org/licenses/>. |
| 20 | */ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 21 | |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 22 | #if !defined (_STDC_H_) |
| 23 | #define _STDC_H_ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 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)); */ |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 30 | |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 31 | #if !defined (__P) |
Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 32 | # if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus) || defined (PROTOTYPES) |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 33 | # define __P(protos) protos |
| 34 | # else |
| 35 | # define __P(protos) () |
| 36 | # endif |
| 37 | #endif |
| 38 | |
Chet Ramey | ac50fba | 2014-02-26 09:36:43 -0500 | [diff] [blame] | 39 | /* Fortify, at least, has trouble with this definition */ |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 40 | #if defined (HAVE_STRINGIZE) |
Chet Ramey | ac50fba | 2014-02-26 09:36:43 -0500 | [diff] [blame] | 41 | # define CPP_STRING(x) #x |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 42 | #else |
Chet Ramey | ac50fba | 2014-02-26 09:36:43 -0500 | [diff] [blame] | 43 | # define CPP_STRING(x) "x" |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 44 | #endif |
| 45 | |
| 46 | #if !defined (__STDC__) |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 47 | |
| 48 | #if defined (__GNUC__) /* gcc with -traditional */ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 49 | # if !defined (signed) |
| 50 | # define signed __signed |
| 51 | # endif |
| 52 | # if !defined (volatile) |
| 53 | # define volatile __volatile |
| 54 | # endif |
| 55 | #else /* !__GNUC__ */ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 56 | # if !defined (inline) |
| 57 | # define inline |
| 58 | # endif |
| 59 | # if !defined (signed) |
| 60 | # define signed |
| 61 | # endif |
| 62 | # if !defined (volatile) |
| 63 | # define volatile |
| 64 | # endif |
| 65 | #endif /* !__GNUC__ */ |
| 66 | |
| 67 | #endif /* !__STDC__ */ |
| 68 | |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 69 | #ifndef __attribute__ |
Jari Aalto | b80f644 | 2004-07-27 13:29:18 +0000 | [diff] [blame] | 70 | # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 71 | # define __attribute__(x) |
| 72 | # endif |
| 73 | #endif |
| 74 | |
Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 75 | /* For those situations when gcc handles inlining a particular function but |
| 76 | other compilers complain. */ |
| 77 | #ifdef __GNUC__ |
| 78 | # define INLINE inline |
| 79 | #else |
| 80 | # define INLINE |
| 81 | #endif |
| 82 | |
| 83 | #if defined (PREFER_STDARG) |
| 84 | # define SH_VA_START(va, arg) va_start(va, arg) |
| 85 | #else |
| 86 | # define SH_VA_START(va, arg) va_start(va) |
| 87 | #endif |
| 88 | |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 89 | #endif /* !_STDC_H_ */ |