/* ANSI and traditional C compatability macros
- Copyright 1991 Free Software Foundation, Inc.
+ Copyright 1991, 1992 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
SIGNED `signed' `'
PTRCONST `void *const' `char *'
- DEFUN(name, arglist, args)
+ DEFUN (name, arglist, args)
Defines function NAME.
be separated with `AND'. For functions with a variable number of
arguments, the last thing listed should be `DOTS'.
- DEFUN_VOID(name)
+ DEFUN_VOID (name)
Defines a function NAME, which takes no arguments.
- EXFUN(name, prototype)
+ obsolete -- EXFUN (name, (prototype)) -- obsolete.
- Is used in an external function declaration.
- In ANSI C it is `NAMEPROTOTYPE' (so PROTOTYPE should be enclosed in
+ Replaced by PARAMS. Do not use; will disappear someday soon.
+ Was used in external function declarations.
+ In ANSI C it is `NAME PROTOTYPE' (so PROTOTYPE should be enclosed in
parentheses). In traditional C it is `NAME()'.
- For a function that takes no arguments, PROTOTYPE should be `(NOARGS)'.
+ For a function that takes no arguments, PROTOTYPE should be `(void)'.
+
+ PARAMS ((args))
+
+ We could use the EXFUN macro to handle prototype declarations, but
+ the name is misleading and the result is ugly. So we just define a
+ simple macro to handle the parameter lists, as in:
+
+ static int foo PARAMS ((int, char));
+
+ This produces: `static int foo();' or `static int foo (int, char);'
+
+ EXFUN would have done it like this:
+
+ static int EXFUN (foo, (int, char));
+
+ but the function is not external...and it's hard to visually parse
+ the function name out of the mess. EXFUN should be considered
+ obsolete; new code should be written to use PARAMS.
For example:
- extern int EXFUN(printf, (CONST char *format DOTS));
+ extern int printf PARAMS ((CONST char *format DOTS));
int DEFUN(fprintf, (stream, format),
FILE *stream AND CONST char *format DOTS) { ... }
void DEFUN_VOID(abort) { ... }
/* LINTLIBRARY */
-#ifdef __STDC__
+#if defined (__STDC__) || defined (_AIX)
+/* the AIX xlc compiler implements all these things even when it is in
+ a mode which doesn't define __STDC__. */
#define PTR void *
#define PTRCONST void *CONST
#define EXFUN(name, proto) name proto
#define DEFUN(name, arglist, args) name(args)
-#define DEFUN_VOID(name) name(NOARGS)
+#define DEFUN_VOID(name) name(void)
-#define PROTO(type, name, arglist) type name arglist
-#endif
+#define PROTO(type, name, arglist) type name arglist
+#define PARAMS(paramlist) paramlist
#else /* Not ANSI C. */
#define DEFUN(name, arglist, args) name arglist args;
#define DEFUN_VOID(name) name()
#define PROTO(type, name, arglist) type name ()
-#endif /* ANSI C. */
+#define PARAMS(paramlist) ()
+#endif /* ANSI C. */
#endif /* ansidecl.h */