3 * Copyright (C) 2008, 2009 Brian Gough
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 3 of the License, or (at
8 * your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef __GSL_INLINE_H__
21 #define __GSL_INLINE_H__
23 /* In recent versiions of GCC, the inline keyword has two different
26 In GNU mode we can use 'extern inline' to make inline functions
27 work like macros. The function is only inlined--it is never output
28 as a definition in an object file.
30 In the new C99 mode 'extern inline' has a different meaning--it
31 causes the definition of the function to be output in each object
32 file where it is used. This will result in multiple-definition
33 errors on linking. The 'inline' keyword on its own (without
34 extern) has the same behavior as the original GNU 'extern inline'.
36 The C99 style is the default with -std=c99 in GCC 4.3.
38 This header file allows either form of inline to be used by
39 redefining the macros INLINE_DECL and INLINE_FUN. These are used
40 in the public header files as
42 INLINE_DECL double gsl_foo (double x);
44 INLINE_FUN double gsl_foo (double x) { return x+1.0; } ;
50 # if defined(__GNUC_STDC_INLINE__) || defined(GSL_C99_INLINE) || defined(HAVE_C99_INLINE)
51 # define INLINE_DECL inline /* use C99 inline */
52 # define INLINE_FUN inline
54 # define INLINE_DECL /* use GNU extern inline */
55 # define INLINE_FUN extern inline
58 # define INLINE_DECL /* */
61 /* Range checking conditions in headers do not require any run-time
62 tests of the global variable gsl_check_range. They are enabled or
63 disabled in user code at compile time with GSL_RANGE_CHECK macro.
65 #define GSL_RANGE_COND(x) (x)
67 #endif /* __GSL_INLINE_H__ */