merge trunk
[bpt/emacs.git] / m4 / extern-inline.m4
1 dnl 'extern inline' a la ISO C99.
2
3 dnl Copyright 2012 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 AC_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__ ? __GNUC_STDC_INLINE__ : 199901L <= __STDC_VERSION__
22 # define _GL_INLINE inline
23 # define _GL_EXTERN_INLINE extern inline
24 # if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
25 # define _GL_INLINE_HEADER_BEGIN \
26 _Pragma ("GCC diagnostic push") \
27 _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
28 _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"")
29 # define _GL_INLINE_HEADER_END \
30 _Pragma ("GCC diagnostic pop")
31 # endif
32 #else
33 # define _GL_INLINE static inline
34 # define _GL_EXTERN_INLINE static inline
35 #endif
36
37 #ifndef _GL_INLINE_HEADER_BEGIN
38 # define _GL_INLINE_HEADER_BEGIN
39 # define _GL_INLINE_HEADER_END
40 #endif])
41 ])