OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [doc/] [ansidecl.h] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/* ANSI and traditional C compatability macros
2
   Copyright 1991 Free Software Foundation, Inc.
3
   This file is part of the GNU C Library.
4
 
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
9
 
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU General Public License for more details.
14
 
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
18
 
19
/* ANSI and traditional C compatibility macros
20
 
21
   Some ANSI environments are "broken" in the sense that __STDC__ cannot be
22
   relied upon to have it's intended meaning.  Therefore we must use our own
23
   concoction: _HAVE_STDC.  Always use _HAVE_STDC instead of __STDC__ in newlib
24
   sources!
25
 
26
   ANSI C is assumed if _HAVE_STDC is #defined.
27
 
28
   Macro        ANSI C definition       Traditional C definition
29
   -----        ---- - ----------       ----------- - ----------
30
   PTR          `void *'                `char *'
31
   LONG_DOUBLE  `long double'           `double'
32
   CONST        `const'                 `'
33
   VOLATILE     `volatile'              `'
34
   SIGNED       `signed'                `'
35
   PTRCONST     `void *const'           `char *'
36
 
37
   DEFUN(name, arglist, args)
38
 
39
        Defines function NAME.
40
 
41
        ARGLIST lists the arguments, separated by commas and enclosed in
42
        parentheses.  ARGLIST becomes the argument list in traditional C.
43
 
44
        ARGS list the arguments with their types.  It becomes a prototype in
45
        ANSI C, and the type declarations in traditional C.  Arguments should
46
        be separated with `AND'.  For functions with a variable number of
47
        arguments, the last thing listed should be `DOTS'.
48
 
49
   DEFUN_VOID(name)
50
 
51
        Defines a function NAME, which takes no arguments.
52
 
53
   EXFUN(name, prototype)
54
 
55
        Is used in an external function declaration.
56
        In ANSI C it is `NAMEPROTOTYPE' (so PROTOTYPE should be enclosed in
57
        parentheses).  In traditional C it is `NAME()'.
58
        For a function that takes no arguments, PROTOTYPE should be `(NOARGS)'.
59
 
60
    For example:
61
        extern int EXFUN(printf, (CONST char *format DOTS));
62
        int DEFUN(fprintf, (stream, format),
63
                  FILE *stream AND CONST char *format DOTS) { ... }
64
        void DEFUN_VOID(abort) { ... }
65
*/
66
 
67
#ifndef _ANSIDECL_H
68
 
69
#define _ANSIDECL_H     1
70
 
71
 
72
/* Every source file includes this file,
73
   so they will all get the switch for lint.  */
74
/* LINTLIBRARY */
75
 
76
 
77
#ifdef  _HAVE_STDC
78
 
79
#define PTR             void *
80
#define PTRCONST        void *CONST
81
#define LONG_DOUBLE     long double
82
 
83
#define AND             ,
84
#define NOARGS          void
85
#define CONST           const
86
#define VOLATILE        volatile
87
#define SIGNED          signed
88
#define DOTS            , ...
89
 
90
#define EXFUN(name, proto)              name proto
91
#define DEFUN(name, arglist, args)      name(args)
92
#define DEFUN_VOID(name)                name(NOARGS)
93
 
94
#else   /* Not ANSI C.  */
95
 
96
#define PTR             char *
97
#define PTRCONST        PTR
98
#define LONG_DOUBLE     double
99
 
100
#define AND             ;
101
#define NOARGS
102
#define CONST
103
#define VOLATILE
104
#define SIGNED
105
#define DOTS
106
 
107
#define const
108
 
109
#define EXFUN(name, proto)              name()
110
#define DEFUN(name, arglist, args)      name arglist args;
111
#define DEFUN_VOID(name)                name()
112
 
113
#endif  /* ANSI C.  */
114
 
115
 
116
#endif  /* ansidecl.h   */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.