1 /* Decision whether to use 'inline' or not.
2    Copyright (C) 2006, 2009 Free Software Foundation, Inc.
3 
4    This program is free software: you can redistribute it and/or modify it
5    under the terms of the GNU Lesser General Public License as published
6    by the Free Software Foundation; either version 3 of the License, or
7    (at your option) any later version.
8 
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
13 
14    You should have received a copy of the GNU Lesser General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16 
17 /* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
18 
19 #ifndef _UNISTRING_INLINE_H
20 #define _UNISTRING_INLINE_H
21 
22 /* This is like the gl_INLINE macro in gnulib/m4/inline.m4, but makes its
23    decision based on defined preprocessor symbols rather than through
24    autoconf tests.
25    See <http://lists.gnu.org/archive/html/bug-gnulib/2006-11/msg00055.html>  */
26 
27 /* Test for the 'inline' keyword or equivalent.  ISO C 99 semantics is not
28    required, only that 'static inline' works.
29    Define 'inline' to a supported equivalent, or to nothing if not supported,
30    like AC_C_INLINE does.  Also, define UNISTRING_HAVE_INLINE if 'inline' or an
31    equivalent is effectively supported, i.e. if the compiler is likely to
32    drop unused 'static inline' functions.  */
33 
34 #if defined __GNUC__
35 /* GNU C or GNU C++.  */
36 # if defined __NO_INLINE__
37 /* GCC defines __NO_INLINE__ if not optimizing or if -fno-inline is
38    specified.  */
39 #  define UNISTRING_HAVE_INLINE 0
40 # else
41 /* Whether 'inline' has the old GCC semantics or the ISO C 99 semantics,
42    does not matter.  */
43 #  define UNISTRING_HAVE_INLINE 1
44 #  ifndef inline
45 #   define inline __inline__
46 #  endif
47 # endif
48 #elif defined __cplusplus
49 /* Any other C++ compiler.  */
50 # define UNISTRING_HAVE_INLINE 1
51 #else
52 /* Any other C compiler.  */
53 # if defined __osf__
54 /* OSF/1 cc has inline.  */
55 #  define UNISTRING_HAVE_INLINE 1
56 # elif defined _AIX || defined __sgi
57 /* AIX 4 xlc, IRIX 6.5 cc have __inline.  */
58 #  define UNISTRING_HAVE_INLINE 1
59 #  ifndef inline
60 #   define inline __inline
61 #  endif
62 # else
63 /* Some older C compiler.  */
64 #  define UNISTRING_HAVE_INLINE 0
65 # endif
66 #endif
67 
68 #endif /* _UNISTRING_INLINE_H */
69