Merge remote-tracking branch 'origin/stable-2.0'
[bpt/guile.git] / m4 / extern-inline.m4
CommitLineData
7ae4e75a
LC
1dnl 'extern inline' a la ISO C99.
2
3dnl Copyright 2012 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8AC_DEFUN([gl_EXTERN_INLINE],
9[
10 AC_REQUIRE([AC_C_INLINE])
11 AH_VERBATIM([extern_inline],
12[/* _GL_INLINE is a portable alternative to ISO C99 plain 'inline'.
13 _GL_EXTERN_INLINE is a portable alternative to 'extern inline'.
14 _GL_INLINE_HEADER_BEGIN contains useful stuff to put
15 in an include file, before uses of _GL_INLINE.
16 It suppresses GCC's bogus "no previous prototype for 'FOO'" diagnostic,
17 when FOO is an inline function in the header; see
18 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>.
19 _GL_INLINE_HEADER_END contains useful stuff to put
20 in the same include file, after uses of _GL_INLINE. */
21#if (__GNUC__ \
22 ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
23 : 199901L <= __STDC_VERSION__)
24# define _GL_INLINE inline
25# define _GL_EXTERN_INLINE extern inline
26#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
27# if __GNUC_GNU_INLINE__
28 /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */
29# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
30# else
31# define _GL_INLINE extern inline
32# endif
33# define _GL_EXTERN_INLINE extern
34#else
35# define _GL_INLINE static inline
36# define _GL_EXTERN_INLINE static inline
37#endif
38
39#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
40# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
41# define _GL_INLINE_HEADER_CONST_PRAGMA
42# else
43# define _GL_INLINE_HEADER_CONST_PRAGMA \
44 _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
45# endif
46# define _GL_INLINE_HEADER_BEGIN \
47 _Pragma ("GCC diagnostic push") \
48 _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
49 _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \
50 _GL_INLINE_HEADER_CONST_PRAGMA
51# define _GL_INLINE_HEADER_END \
52 _Pragma ("GCC diagnostic pop")
53#else
54# define _GL_INLINE_HEADER_BEGIN
55# define _GL_INLINE_HEADER_END
56#endif])
57])