comparison include/ansidecl.h @ 57:326d9e06c2e3

modify c-parser.c
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Mon, 15 Feb 2010 00:54:17 +0900
parents 77e2b8dfacca
children b7f97abdc517
comparison
equal deleted inserted replaced
54:f62c169bbc24 57:326d9e06c2e3
1 /* ANSI and traditional C compatability macros 1 /* ANSI and traditional C compatability macros
2 Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 2 Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
3 2002, 2003, 2004, 2005, 2006, 2007, 2009
3 Free Software Foundation, Inc. 4 Free Software Foundation, Inc.
4 This file is part of the GNU C Library. 5 This file is part of the GNU C Library.
5 6
6 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
112 AND, DOTS, NOARGS. Don't use them. */ 113 AND, DOTS, NOARGS. Don't use them. */
113 114
114 #ifndef _ANSIDECL_H 115 #ifndef _ANSIDECL_H
115 #define _ANSIDECL_H 1 116 #define _ANSIDECL_H 1
116 117
118 #ifdef __cplusplus
119 extern "C" {
120 #endif
121
117 /* Every source file includes this file, 122 /* Every source file includes this file,
118 so they will all get the switch for lint. */ 123 so they will all get the switch for lint. */
119 /* LINTLIBRARY */ 124 /* LINTLIBRARY */
120 125
121 /* Using MACRO(x,y) in cpp #if conditionals does not work with some 126 /* Using MACRO(x,y) in cpp #if conditionals does not work with some
134 gcc at all. */ 139 gcc at all. */
135 #ifndef GCC_VERSION 140 #ifndef GCC_VERSION
136 #define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) 141 #define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
137 #endif /* GCC_VERSION */ 142 #endif /* GCC_VERSION */
138 143
139 #if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32) || (defined(__alpha) && defined(__cplusplus)) 144 #if defined (__STDC__) || defined(__cplusplus) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32)
140 /* All known AIX compilers implement these things (but don't always 145 /* All known AIX compilers implement these things (but don't always
141 define __STDC__). The RISC/OS MIPS compiler defines these things 146 define __STDC__). The RISC/OS MIPS compiler defines these things
142 in SVR4 mode, but does not define __STDC__. */ 147 in SVR4 mode, but does not define __STDC__. */
143 /* eraxxon@alumni.rice.edu: The Compaq C++ compiler, unlike many other 148 /* eraxxon@alumni.rice.edu: The Compaq C++ compiler, unlike many other
144 C++ compilers, does not define __STDC__, though it acts as if this 149 C++ compilers, does not define __STDC__, though it acts as if this
171 #undef signed 176 #undef signed
172 177
173 /* inline requires special treatment; it's in C99, and GCC >=2.7 supports 178 /* inline requires special treatment; it's in C99, and GCC >=2.7 supports
174 it too, but it's not in C89. */ 179 it too, but it's not in C89. */
175 #undef inline 180 #undef inline
176 #if __STDC_VERSION__ > 199901L 181 #if __STDC_VERSION__ > 199901L || defined(__cplusplus)
177 /* it's a keyword */ 182 /* it's a keyword */
178 #else 183 #else
179 # if GCC_VERSION >= 2007 184 # if GCC_VERSION >= 2007
180 # define inline __inline__ /* __inline__ prevents -pedantic warnings */ 185 # define inline __inline__ /* __inline__ prevents -pedantic warnings */
181 # else 186 # else
254 # else 259 # else
255 # define ATTRIBUTE_MALLOC 260 # define ATTRIBUTE_MALLOC
256 # endif /* GNUC >= 2.96 */ 261 # endif /* GNUC >= 2.96 */
257 #endif /* ATTRIBUTE_MALLOC */ 262 #endif /* ATTRIBUTE_MALLOC */
258 263
259 /* Attributes on labels were valid as of gcc 2.93. */ 264 /* Attributes on labels were valid as of gcc 2.93 and g++ 4.5. For
265 g++ an attribute on a label must be followed by a semicolon. */
260 #ifndef ATTRIBUTE_UNUSED_LABEL 266 #ifndef ATTRIBUTE_UNUSED_LABEL
261 # if (!defined (__cplusplus) && GCC_VERSION >= 2093) 267 # ifndef __cplusplus
262 # define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED 268 # if GCC_VERSION >= 2093
263 # else 269 # define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED
264 # define ATTRIBUTE_UNUSED_LABEL 270 # else
265 # endif /* !__cplusplus && GNUC >= 2.93 */ 271 # define ATTRIBUTE_UNUSED_LABEL
266 #endif /* ATTRIBUTE_UNUSED_LABEL */ 272 # endif
273 # else
274 # if GCC_VERSION >= 4005
275 # define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED ;
276 # else
277 # define ATTRIBUTE_UNUSED_LABEL
278 # endif
279 # endif
280 #endif
267 281
268 #ifndef ATTRIBUTE_UNUSED 282 #ifndef ATTRIBUTE_UNUSED
269 #define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 283 #define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
270 #endif /* ATTRIBUTE_UNUSED */ 284 #endif /* ATTRIBUTE_UNUSED */
271 285
388 gcc 2.8. */ 402 gcc 2.8. */
389 #if GCC_VERSION < 2008 403 #if GCC_VERSION < 2008
390 #define __extension__ 404 #define __extension__
391 #endif 405 #endif
392 406
407 /* This is used to declare a const variable which should be visible
408 outside of the current compilation unit. Use it as
409 EXPORTED_CONST int i = 1;
410 This is because the semantics of const are different in C and C++.
411 "extern const" is permitted in C but it looks strange, and gcc
412 warns about it when -Wc++-compat is not used. */
413 #ifdef __cplusplus
414 #define EXPORTED_CONST extern const
415 #else
416 #define EXPORTED_CONST const
417 #endif
418
419 #ifdef __cplusplus
420 }
421 #endif
422
393 #endif /* ansidecl.h */ 423 #endif /* ansidecl.h */