• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  AH_VERBATIM([extern_inline],
11[/* _GL_INLINE is a portable alternative to ISO C99 plain 'inline'.
12   _GL_EXTERN_INLINE is a portable alternative to 'extern inline'.
13   _GL_INLINE_HEADER_BEGIN contains useful stuff to put
14     in an include file, before uses of _GL_INLINE.
15     It suppresses GCC's bogus "no previous prototype for 'FOO'" diagnostic,
16     when FOO is an inline function in the header; see
17     <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>.
18   _GL_INLINE_HEADER_END contains useful stuff to put
19     in the same include file, after uses of _GL_INLINE.
20
21   Suppress the use of extern inline on Apple's platforms,
22   as Libc-825.25 (2012-09-19) is incompatible with it; see
23   <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
24   Perhaps Apple will fix this some day.  */
25#if ((__GNUC__ \
26      ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
27      : 199901L <= __STDC_VERSION__) \
28     && !defined __APPLE__)
29# define _GL_INLINE inline
30# define _GL_EXTERN_INLINE extern inline
31#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __APPLE__
32# if __GNUC_GNU_INLINE__
33   /* __gnu_inline__ suppresses a GCC 4.2 diagnostic.  */
34#  define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
35# else
36#  define _GL_INLINE extern inline
37# endif
38# define _GL_EXTERN_INLINE extern
39#else
40# define _GL_INLINE static _GL_UNUSED
41# define _GL_EXTERN_INLINE static _GL_UNUSED
42#endif
43
44#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
45# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
46#  define _GL_INLINE_HEADER_CONST_PRAGMA
47# else
48#  define _GL_INLINE_HEADER_CONST_PRAGMA \
49     _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
50# endif
51# define _GL_INLINE_HEADER_BEGIN \
52    _Pragma ("GCC diagnostic push") \
53    _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
54    _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \
55    _GL_INLINE_HEADER_CONST_PRAGMA
56# define _GL_INLINE_HEADER_END \
57    _Pragma ("GCC diagnostic pop")
58#else
59# define _GL_INLINE_HEADER_BEGIN
60# define _GL_INLINE_HEADER_END
61#endif])
62])
63