Linux Audio

Check our new training course

Linux debugging, profiling, tracing and performance analysis training

Mar 24-27, 2025, special US time zones
Register
Loading...
v6.8
  1/* SPDX-License-Identifier: GPL-2.0-or-later */
  2/* ANSI and traditional C compatibility macros
  3   Copyright 1991, 1992 Free Software Foundation, Inc.
  4   This file is part of the GNU C Library.
  5
  6 */
 
 
 
 
 
 
 
 
 
 
 
 
  7
  8/* ANSI and traditional C compatibility macros
  9
 10   ANSI C is assumed if __STDC__ is #defined.
 11
 12   Macro	ANSI C definition	Traditional C definition
 13   -----	---- - ----------	----------- - ----------
 14   PTR		`void *'		`char *'
 15   LONG_DOUBLE	`long double'		`double'
 16   VOLATILE	`volatile'		`'
 17   SIGNED	`signed'		`'
 18   PTRCONST	`void *const'		`char *'
 19   ANSI_PROTOTYPES  1			not defined
 20
 21   CONST is also defined, but is obsolete.  Just use const.
 22
 23   DEFUN (name, arglist, args)
 24
 25	Defines function NAME.
 26
 27	ARGLIST lists the arguments, separated by commas and enclosed in
 28	parentheses.  ARGLIST becomes the argument list in traditional C.
 29
 30	ARGS list the arguments with their types.  It becomes a prototype in
 31	ANSI C, and the type declarations in traditional C.  Arguments should
 32	be separated with `AND'.  For functions with a variable number of
 33	arguments, the last thing listed should be `DOTS'.
 34
 35   DEFUN_VOID (name)
 36
 37	Defines a function NAME, which takes no arguments.
 38
 39   obsolete --     EXFUN (name, (prototype))	-- obsolete.
 40
 41	Replaced by PARAMS.  Do not use; will disappear someday soon.
 42	Was used in external function declarations.
 43	In ANSI C it is `NAME PROTOTYPE' (so PROTOTYPE should be enclosed in
 44	parentheses).  In traditional C it is `NAME()'.
 45	For a function that takes no arguments, PROTOTYPE should be `(void)'.
 46
 47    PARAMS ((args))
 48
 49	We could use the EXFUN macro to handle prototype declarations, but
 50	the name is misleading and the result is ugly.  So we just define a
 51	simple macro to handle the parameter lists, as in:
 52
 53	      static int foo PARAMS ((int, char));
 54
 55	This produces:  `static int foo();' or `static int foo (int, char);'
 56
 57	EXFUN would have done it like this:
 58
 59	      static int EXFUN (foo, (int, char));
 60
 61	but the function is not external...and it's hard to visually parse
 62	the function name out of the mess.   EXFUN should be considered
 63	obsolete; new code should be written to use PARAMS.
 64
 65    For example:
 66	extern int printf PARAMS ((CONST char *format DOTS));
 67	int DEFUN(fprintf, (stream, format),
 68		  FILE *stream AND CONST char *format DOTS) { ... }
 69	void DEFUN_VOID(abort) { ... }
 70*/
 71
 72#ifndef	_ANSIDECL_H
 73
 74#define	_ANSIDECL_H	1
 75
 76
 77/* Every source file includes this file,
 78   so they will all get the switch for lint.  */
 79/* LINTLIBRARY */
 80
 81
 82#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32)
 83/* All known AIX compilers implement these things (but don't always
 84   define __STDC__).  The RISC/OS MIPS compiler defines these things
 85   in SVR4 mode, but does not define __STDC__.  */
 86
 87#define	PTR		void *
 88#define	PTRCONST	void *CONST
 89#define	LONG_DOUBLE	long double
 90
 91#define	AND		,
 92#define	NOARGS		void
 93#define	CONST		const
 94#define	VOLATILE	volatile
 95#define	SIGNED		signed
 96#define	DOTS		, ...
 97
 98#define	EXFUN(name, proto)		name proto
 99#define	DEFUN(name, arglist, args)	name(args)
100#define	DEFUN_VOID(name)		name(void)
101
102#define PROTO(type, name, arglist)	type name arglist
103#define PARAMS(paramlist)		paramlist
104#define ANSI_PROTOTYPES			1
105
106#else	/* Not ANSI C.  */
107
108#define	PTR		char *
109#define	PTRCONST	PTR
110#define	LONG_DOUBLE	double
111
112#define	AND		;
113#define	NOARGS
114#define	CONST
115#ifndef const /* some systems define it in header files for non-ansi mode */
116#define	const
117#endif
118#define	VOLATILE
119#define	SIGNED
120#define	DOTS
121
122#define	EXFUN(name, proto)		name()
123#define	DEFUN(name, arglist, args)	name arglist args;
124#define	DEFUN_VOID(name)		name()
125#define PROTO(type, name, arglist) type name ()
126#define PARAMS(paramlist)		()
127
128#endif	/* ANSI C.  */
129
130#endif	/* ansidecl.h	*/
v3.1
 
  1/* ANSI and traditional C compatibility macros
  2   Copyright 1991, 1992 Free Software Foundation, Inc.
  3   This file is part of the GNU C Library.
  4
  5This program is free software; you can redistribute it and/or modify
  6it under the terms of the GNU General Public License as published by
  7the Free Software Foundation; either version 2 of the License, or
  8(at your option) any later version.
  9
 10This program is distributed in the hope that it will be useful,
 11but WITHOUT ANY WARRANTY; without even the implied warranty of
 12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13GNU General Public License for more details.
 14
 15You should have received a copy of the GNU General Public License
 16along with this program; if not, write to the Free Software
 17Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 18
 19/* ANSI and traditional C compatibility macros
 20
 21   ANSI C is assumed if __STDC__ is #defined.
 22
 23   Macro	ANSI C definition	Traditional C definition
 24   -----	---- - ----------	----------- - ----------
 25   PTR		`void *'		`char *'
 26   LONG_DOUBLE	`long double'		`double'
 27   VOLATILE	`volatile'		`'
 28   SIGNED	`signed'		`'
 29   PTRCONST	`void *const'		`char *'
 30   ANSI_PROTOTYPES  1			not defined
 31
 32   CONST is also defined, but is obsolete.  Just use const.
 33
 34   DEFUN (name, arglist, args)
 35
 36	Defines function NAME.
 37
 38	ARGLIST lists the arguments, separated by commas and enclosed in
 39	parentheses.  ARGLIST becomes the argument list in traditional C.
 40
 41	ARGS list the arguments with their types.  It becomes a prototype in
 42	ANSI C, and the type declarations in traditional C.  Arguments should
 43	be separated with `AND'.  For functions with a variable number of
 44	arguments, the last thing listed should be `DOTS'.
 45
 46   DEFUN_VOID (name)
 47
 48	Defines a function NAME, which takes no arguments.
 49
 50   obsolete --     EXFUN (name, (prototype))	-- obsolete.
 51
 52	Replaced by PARAMS.  Do not use; will disappear someday soon.
 53	Was used in external function declarations.
 54	In ANSI C it is `NAME PROTOTYPE' (so PROTOTYPE should be enclosed in
 55	parentheses).  In traditional C it is `NAME()'.
 56	For a function that takes no arguments, PROTOTYPE should be `(void)'.
 57
 58    PARAMS ((args))
 59
 60	We could use the EXFUN macro to handle prototype declarations, but
 61	the name is misleading and the result is ugly.  So we just define a
 62	simple macro to handle the parameter lists, as in:
 63
 64	      static int foo PARAMS ((int, char));
 65
 66	This produces:  `static int foo();' or `static int foo (int, char);'
 67
 68	EXFUN would have done it like this:
 69
 70	      static int EXFUN (foo, (int, char));
 71
 72	but the function is not external...and it's hard to visually parse
 73	the function name out of the mess.   EXFUN should be considered
 74	obsolete; new code should be written to use PARAMS.
 75
 76    For example:
 77	extern int printf PARAMS ((CONST char *format DOTS));
 78	int DEFUN(fprintf, (stream, format),
 79		  FILE *stream AND CONST char *format DOTS) { ... }
 80	void DEFUN_VOID(abort) { ... }
 81*/
 82
 83#ifndef	_ANSIDECL_H
 84
 85#define	_ANSIDECL_H	1
 86
 87
 88/* Every source file includes this file,
 89   so they will all get the switch for lint.  */
 90/* LINTLIBRARY */
 91
 92
 93#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32)
 94/* All known AIX compilers implement these things (but don't always
 95   define __STDC__).  The RISC/OS MIPS compiler defines these things
 96   in SVR4 mode, but does not define __STDC__.  */
 97
 98#define	PTR		void *
 99#define	PTRCONST	void *CONST
100#define	LONG_DOUBLE	long double
101
102#define	AND		,
103#define	NOARGS		void
104#define	CONST		const
105#define	VOLATILE	volatile
106#define	SIGNED		signed
107#define	DOTS		, ...
108
109#define	EXFUN(name, proto)		name proto
110#define	DEFUN(name, arglist, args)	name(args)
111#define	DEFUN_VOID(name)		name(void)
112
113#define PROTO(type, name, arglist)	type name arglist
114#define PARAMS(paramlist)		paramlist
115#define ANSI_PROTOTYPES			1
116
117#else	/* Not ANSI C.  */
118
119#define	PTR		char *
120#define	PTRCONST	PTR
121#define	LONG_DOUBLE	double
122
123#define	AND		;
124#define	NOARGS
125#define	CONST
126#ifndef const /* some systems define it in header files for non-ansi mode */
127#define	const
128#endif
129#define	VOLATILE
130#define	SIGNED
131#define	DOTS
132
133#define	EXFUN(name, proto)		name()
134#define	DEFUN(name, arglist, args)	name arglist args;
135#define	DEFUN_VOID(name)		name()
136#define PROTO(type, name, arglist) type name ()
137#define PARAMS(paramlist)		()
138
139#endif	/* ANSI C.  */
140
141#endif	/* ansidecl.h	*/