/* SPDX-License-Identifier: GPL-2.0-or-later */1/* ANSI and traditional C compatibility macros2Copyright 1991, 1992 Free Software Foundation, Inc.3This file is part of the GNU C Library.45*/67/* ANSI and traditional C compatibility macros89ANSI C is assumed if __STDC__ is #defined.1011Macro ANSI C definition Traditional C definition12----- ---- - ---------- ----------- - ----------13PTR `void *' `char *'14LONG_DOUBLE `long double' `double'15VOLATILE `volatile' `'16SIGNED `signed' `'17PTRCONST `void *const' `char *'18ANSI_PROTOTYPES 1 not defined1920CONST is also defined, but is obsolete. Just use const.2122DEFUN (name, arglist, args)2324Defines function NAME.2526ARGLIST lists the arguments, separated by commas and enclosed in27parentheses. ARGLIST becomes the argument list in traditional C.2829ARGS list the arguments with their types. It becomes a prototype in30ANSI C, and the type declarations in traditional C. Arguments should31be separated with `AND'. For functions with a variable number of32arguments, the last thing listed should be `DOTS'.3334DEFUN_VOID (name)3536Defines a function NAME, which takes no arguments.3738obsolete -- EXFUN (name, (prototype)) -- obsolete.3940Replaced by PARAMS. Do not use; will disappear someday soon.41Was used in external function declarations.42In ANSI C it is `NAME PROTOTYPE' (so PROTOTYPE should be enclosed in43parentheses). In traditional C it is `NAME()'.44For a function that takes no arguments, PROTOTYPE should be `(void)'.4546PARAMS ((args))4748We could use the EXFUN macro to handle prototype declarations, but49the name is misleading and the result is ugly. So we just define a50simple macro to handle the parameter lists, as in:5152static int foo PARAMS ((int, char));5354This produces: `static int foo();' or `static int foo (int, char);'5556EXFUN would have done it like this:5758static int EXFUN (foo, (int, char));5960but the function is not external...and it's hard to visually parse61the function name out of the mess. EXFUN should be considered62obsolete; new code should be written to use PARAMS.6364For example:65extern int printf PARAMS ((CONST char *format DOTS));66int DEFUN(fprintf, (stream, format),67FILE *stream AND CONST char *format DOTS) { ... }68void DEFUN_VOID(abort) { ... }69*/7071#ifndef _ANSIDECL_H7273#define _ANSIDECL_H 1747576/* Every source file includes this file,77so they will all get the switch for lint. */78/* LINTLIBRARY */798081#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32)82/* All known AIX compilers implement these things (but don't always83define __STDC__). The RISC/OS MIPS compiler defines these things84in SVR4 mode, but does not define __STDC__. */8586#define PTR void *87#define PTRCONST void *CONST88#define LONG_DOUBLE long double8990#define AND ,91#define NOARGS void92#define CONST const93#define VOLATILE volatile94#define SIGNED signed95#define DOTS , ...9697#define EXFUN(name, proto) name proto98#define DEFUN(name, arglist, args) name(args)99#define DEFUN_VOID(name) name(void)100101#define PROTO(type, name, arglist) type name arglist102#define PARAMS(paramlist) paramlist103#define ANSI_PROTOTYPES 1104105#else /* Not ANSI C. */106107#define PTR char *108#define PTRCONST PTR109#define LONG_DOUBLE double110111#define AND ;112#define NOARGS113#define CONST114#ifndef const /* some systems define it in header files for non-ansi mode */115#define const116#endif117#define VOLATILE118#define SIGNED119#define DOTS120121#define EXFUN(name, proto) name()122#define DEFUN(name, arglist, args) name arglist args;123#define DEFUN_VOID(name) name()124#define PROTO(type, name, arglist) type name ()125#define PARAMS(paramlist) ()126127#endif /* ANSI C. */128129#endif /* ansidecl.h */130131132