|
Packit |
67cb25 |
/* gsl_inline.h
|
|
Packit |
67cb25 |
*
|
|
Packit |
67cb25 |
* Copyright (C) 2008, 2009 Brian Gough
|
|
Packit |
67cb25 |
*
|
|
Packit |
67cb25 |
* This program is free software; you can redistribute it and/or modify
|
|
Packit |
67cb25 |
* it under the terms of the GNU General Public License as published by
|
|
Packit |
67cb25 |
* the Free Software Foundation; either version 3 of the License, or (at
|
|
Packit |
67cb25 |
* your option) any later version.
|
|
Packit |
67cb25 |
*
|
|
Packit |
67cb25 |
* This program is distributed in the hope that it will be useful, but
|
|
Packit |
67cb25 |
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
67cb25 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
67cb25 |
* General Public License for more details.
|
|
Packit |
67cb25 |
*
|
|
Packit |
67cb25 |
* You should have received a copy of the GNU General Public License
|
|
Packit |
67cb25 |
* along with this program; if not, write to the Free Software
|
|
Packit |
67cb25 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
Packit |
67cb25 |
*/
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
#ifndef __GSL_INLINE_H__
|
|
Packit |
67cb25 |
#define __GSL_INLINE_H__
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
/* In recent versiions of GCC, the inline keyword has two different
|
|
Packit |
67cb25 |
forms: GNU and C99.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
In GNU mode we can use 'extern inline' to make inline functions
|
|
Packit |
67cb25 |
work like macros. The function is only inlined--it is never output
|
|
Packit |
67cb25 |
as a definition in an object file.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
In the new C99 mode 'extern inline' has a different meaning--it
|
|
Packit |
67cb25 |
causes the definition of the function to be output in each object
|
|
Packit |
67cb25 |
file where it is used. This will result in multiple-definition
|
|
Packit |
67cb25 |
errors on linking. The 'inline' keyword on its own (without
|
|
Packit |
67cb25 |
extern) has the same behavior as the original GNU 'extern inline'.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
The C99 style is the default with -std=c99 in GCC 4.3.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This header file allows either form of inline to be used by
|
|
Packit |
67cb25 |
redefining the macros INLINE_DECL and INLINE_FUN. These are used
|
|
Packit |
67cb25 |
in the public header files as
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
INLINE_DECL double gsl_foo (double x);
|
|
Packit |
67cb25 |
#ifdef HAVE_INLINE
|
|
Packit |
67cb25 |
INLINE_FUN double gsl_foo (double x) { return x+1.0; } ;
|
|
Packit |
67cb25 |
#endif
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
*/
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
#ifdef HAVE_INLINE
|
|
Packit |
67cb25 |
# if defined(__GNUC_STDC_INLINE__) || defined(GSL_C99_INLINE) || defined(HAVE_C99_INLINE)
|
|
Packit |
67cb25 |
# define INLINE_DECL inline /* use C99 inline */
|
|
Packit |
67cb25 |
# define INLINE_FUN inline
|
|
Packit |
67cb25 |
# else
|
|
Packit |
67cb25 |
# define INLINE_DECL /* use GNU extern inline */
|
|
Packit |
67cb25 |
# define INLINE_FUN extern inline
|
|
Packit |
67cb25 |
# endif
|
|
Packit |
67cb25 |
#else
|
|
Packit |
67cb25 |
# define INLINE_DECL /* */
|
|
Packit |
67cb25 |
#endif
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
/* Range checking conditions in headers do not require any run-time
|
|
Packit |
67cb25 |
tests of the global variable gsl_check_range. They are enabled or
|
|
Packit |
67cb25 |
disabled in user code at compile time with GSL_RANGE_CHECK macro.
|
|
Packit |
67cb25 |
See also build.h. */
|
|
Packit |
67cb25 |
#define GSL_RANGE_COND(x) (x)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
#endif /* __GSL_INLINE_H__ */
|