Merge from gnulib, for extern-inline.
[bpt/emacs.git] / m4 / extern-inline.m4
CommitLineData
a0d4efe9
PE
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__ ? __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# define _GL_INLINE_HEADER_END \
29 _Pragma ("GCC diagnostic pop")
30# endif
31#else
32# define _GL_INLINE static inline
33# define _GL_EXTERN_INLINE static inline
34#endif
35
36#ifndef _GL_INLINE_HEADER_BEGIN
37# define _GL_INLINE_HEADER_BEGIN
38# define _GL_INLINE_HEADER_END
39#endif])
40])