Wed Aug 9 14:25:35 1995 Miles Bader <miles@geech.gnu.ai.mit.edu>
[glibc.git] / ansidecl.h
blobc351653b62b2560563bff6c50ca07b716c8ac318
1 /* Copyright (C) 1991 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 1, or (at your option)
7 any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with the GNU C Library; see the file COPYING. If not, write to
16 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
18 /* ANSI and traditional C compatibility macros
20 ANSI C is assumed if __STDC__ is #defined.
22 Macro ANSI C definition Traditional C definition
23 ----- ---- - ---------- ----------- - ----------
24 PTR `void *' `char *'
25 LONG_DOUBLE `long double' `double'
26 CONST `const' `'
27 VOLATILE `volatile' `'
28 SIGNED `signed' `'
29 PTRCONST `void *const' `char *'
31 DEFUN(name, arglist, args)
33 Defines function NAME.
35 ARGLIST lists the arguments, separated by commas and enclosed in
36 parentheses. ARGLIST becomes the argument list in traditional C.
38 ARGS list the arguments with their types. It becomes a prototype in
39 ANSI C, and the type declarations in traditional C. Arguments should
40 be separated with `AND'. For functions with a variable number of
41 arguments, the last thing listed should be `DOTS'.
43 DEFUN_VOID(name)
45 Defines a function NAME, which takes no arguments.
47 EXFUN(name, prototype)
49 Is used in an external function declaration.
50 In ANSI C it is `NAMEPROTOTYPE' (so PROTOTYPE should be enclosed in
51 parentheses). In traditional C it is `NAME()'.
52 For a function that takes no arguments, PROTOTYPE should be `(NOARGS)'.
54 For example:
55 extern int EXFUN(printf, (CONST char *format DOTS));
56 int DEFUN(fprintf, (stream, format),
57 FILE *stream AND CONST char *format DOTS) { ... }
58 void DEFUN_VOID(abort) { ... }
61 #ifndef _ANSIDECL_H
63 #define _ANSIDECL_H 1
66 /* Every source file includes this file,
67 so they will all get the switch for lint. */
68 /* LINTLIBRARY */
71 #ifdef __STDC__
73 #define PTR void *
74 #define PTRCONST void *CONST
75 #define LONG_DOUBLE long double
77 #define AND ,
78 #define NOARGS void
79 #define CONST const
80 #define VOLATILE volatile
81 #define SIGNED signed
82 #define DOTS , ...
84 #define EXFUN(name, proto) name proto
85 #define DEFUN(name, arglist, args) name(args)
86 #define DEFUN_VOID(name) name(NOARGS)
88 #else /* Not ANSI C. */
90 #define PTR char *
91 #define PTRCONST PTR
92 #define LONG_DOUBLE double
94 #define AND ;
95 #define NOARGS
96 #define CONST
97 #define VOLATILE
98 #define SIGNED
99 #define DOTS
101 #define EXFUN(name, proto) name()
102 #define DEFUN(name, arglist, args) name arglist args;
103 #define DEFUN_VOID(name) name()
105 #endif /* ANSI C. */
108 #endif /* ansidecl.h */