| /* SPDX-License-Identifier: BSD-3-Clause */ |
| /* |
| * Copyright (c) 1994-2009 Red Hat, Inc. |
| * All rights reserved. |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions are met: |
| * |
| * 1. Redistributions of source code must retain the above copyright notice, |
| * this list of conditions and the following disclaimer. |
| * |
| * 2. Redistributions in binary form must reproduce the above copyright notice, |
| * this list of conditions and the following disclaimer in the documentation |
| * and/or other materials provided with the distribution. |
| * |
| * 3. Neither the name of the copyright holder nor the names of its |
| * contributors may be used to endorse or promote products derived from this |
| * software without specific prior written permission. |
| * |
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| * POSSIBILITY OF SUCH DAMAGE. |
| */ |
| |
| /* Provide support for both ANSI and non-ANSI environments. */ |
| |
| /* Some ANSI environments are "broken" in the sense that __STDC__ cannot be |
| relied upon to have it's intended meaning. Therefore we must use our own |
| concoction: _HAVE_STDC. Always use _HAVE_STDC instead of __STDC__ in newlib |
| sources! |
| |
| To get a strict ANSI C environment, define macro __STRICT_ANSI__. This will |
| "comment out" the non-ANSI parts of the ANSI header files (non-ANSI header |
| files aren't affected). */ |
| |
| #ifndef _ANSIDECL_H_ |
| #define _ANSIDECL_H_ |
| |
| /*#include <newlib.h> */ |
| /*#include <sys/config.h> */ |
| |
| /* |
| * First try to figure out whether we really are in an ANSI C environment. |
| * This probably needs some work. Perhaps sys/config.h can be |
| * prevailed upon to give us a clue. |
| */ |
| |
| #ifdef __STDC__ |
| #define _HAVE_STDC |
| #endif |
| |
| #ifdef _HAVE_STDC |
| #define _PTR void * |
| #define _AND , |
| #define _NOARGS void |
| #define _CONST const |
| #define _VOLATILE volatile |
| #define _SIGNED signed |
| #define _DOTS , ... |
| #define _VOID void |
| #ifdef __CYGWIN__ |
| #define _EXFUN(name, proto) __cdecl name proto |
| #define _EXPARM(name, proto) (* __cdecl name) proto |
| #else |
| #define _EXFUN(name, proto) name proto |
| #define _EXPARM(name, proto) (* name) proto |
| #endif |
| #define _DEFUN(name, arglist, args) name(args) |
| #define _DEFUN_VOID(name) name(_NOARGS) |
| #define _CAST_VOID (void) |
| #ifndef _LONG_DOUBLE |
| #define _LONG_DOUBLE long double |
| #endif |
| #ifndef _PARAMS |
| #define _PARAMS(paramlist) paramlist |
| #endif |
| #else |
| #define _PTR char * |
| #define _AND ; |
| #define _NOARGS |
| #define _CONST |
| #define _VOLATILE |
| #define _SIGNED |
| #define _DOTS |
| #define _VOID void |
| #define _EXFUN(name, proto) name() |
| #define _DEFUN(name, arglist, args) name arglist args; |
| #define _DEFUN_VOID(name) name() |
| #define _CAST_VOID |
| #define _LONG_DOUBLE double |
| #ifndef _PARAMS |
| #define _PARAMS(paramlist) () |
| #endif |
| #endif |
| |
| /* Support gcc's __attribute__ facility. */ |
| |
| #ifdef __GNUC__ |
| #define _ATTRIBUTE(attrs) __attribute__ (attrs) |
| #else |
| #define _ATTRIBUTE(attrs) |
| #endif |
| |
| /* ISO C++. */ |
| |
| #ifdef __cplusplus |
| #if !(defined(_BEGIN_STD_C) && defined(_END_STD_C)) |
| #ifdef _HAVE_STD_CXX |
| #define _BEGIN_STD_C namespace std { extern "C" { |
| #define _END_STD_C } } |
| #else |
| #define _BEGIN_STD_C extern "C" { |
| #define _END_STD_C } |
| #endif |
| #endif |
| #else |
| #define _BEGIN_STD_C |
| #define _END_STD_C |
| #endif |
| |
| #endif /* _ANSIDECL_H_ */ |