1 /* Decision whether to use 'inline' or not.
2 Copyright (C) 2006, 2009 Free Software Foundation, Inc.
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.
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.
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/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>, 2009. */
19 #ifndef _UNISTRING_INLINE_H
20 #define _UNISTRING_INLINE_H
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
25 See <http://lists.gnu.org/archive/html/bug-gnulib/2006-11/msg00055.html> */
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. */
35 /* GNU C or GNU C++. */
36 # if defined __NO_INLINE__
37 /* GCC defines __NO_INLINE__ if not optimizing or if -fno-inline is
39 # define UNISTRING_HAVE_INLINE 0
41 /* Whether 'inline' has the old GCC semantics or the ISO C 99 semantics,
43 # define UNISTRING_HAVE_INLINE 1
45 # define inline __inline__
48 #elif defined __cplusplus
49 /* Any other C++ compiler. */
50 # define UNISTRING_HAVE_INLINE 1
52 /* Any other C compiler. */
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
60 # define inline __inline
63 /* Some older C compiler. */
64 # define UNISTRING_HAVE_INLINE 0
68 #endif /* _UNISTRING_INLINE_H */