Remove duplicate ChangeLog entry, again.
[bpt/emacs.git] / m4 / extern-inline.m4
CommitLineData
a0d4efe9
PE
1dnl 'extern inline' a la ISO C99.
2
9ff99d22 3dnl Copyright 2012-2013 Free Software Foundation, Inc.
a0d4efe9
PE
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[
a0d4efe9 10 AH_VERBATIM([extern_inline],
ec9295ae 11[/* Please see the Gnulib manual for how to use these macros.
904dd565 12
89bd9d36
PE
13 Suppress extern inline with HP-UX cc, as it appears to be broken; see
14 <http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>.
15
d9774ea4
PE
16 Suppress extern inline with Sun C in standards-conformance mode, as it
17 mishandles inline functions that call each other. E.g., for 'inline void f
18 (void) { } inline void g (void) { f (); }', c99 incorrectly complains
19 'reference to static identifier "f" in extern inline function'.
20 This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16.
21
22 Suppress the use of extern inline on Apple's platforms, as Libc at least
23 through Libc-825.26 (2013-04-09) is incompatible with it; see, e.g.,
904dd565
PE
24 <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
25 Perhaps Apple will fix this some day. */
26#if ((__GNUC__ \
27 ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
d9774ea4
PE
28 : (199901L <= __STDC_VERSION__ \
29 && !defined __HP_cc \
30 && !(defined __SUNPRO_C && __STDC__))) \
904dd565 31 && !defined __APPLE__)
a0d4efe9
PE
32# define _GL_INLINE inline
33# define _GL_EXTERN_INLINE extern inline
904dd565 34#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __APPLE__
01b13eb7
PE
35# if __GNUC_GNU_INLINE__
36 /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */
37# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
38# else
39# define _GL_INLINE extern inline
a0d4efe9 40# endif
01b13eb7 41# define _GL_EXTERN_INLINE extern
a0d4efe9 42#else
904dd565
PE
43# define _GL_INLINE static _GL_UNUSED
44# define _GL_EXTERN_INLINE static _GL_UNUSED
a0d4efe9
PE
45#endif
46
01b13eb7 47#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
65788e2e 48# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
01b13eb7
PE
49# define _GL_INLINE_HEADER_CONST_PRAGMA
50# else
51# define _GL_INLINE_HEADER_CONST_PRAGMA \
52 _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
53# endif
ec9295ae
PE
54 /* Suppress GCC's bogus "no previous prototype for 'FOO'"
55 and "no previous declaration for 'FOO'" diagnostics,
56 when FOO is an inline function in the header; see
57 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. */
01b13eb7
PE
58# define _GL_INLINE_HEADER_BEGIN \
59 _Pragma ("GCC diagnostic push") \
60 _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
61 _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \
62 _GL_INLINE_HEADER_CONST_PRAGMA
63# define _GL_INLINE_HEADER_END \
64 _Pragma ("GCC diagnostic pop")
65#else
a0d4efe9
PE
66# define _GL_INLINE_HEADER_BEGIN
67# define _GL_INLINE_HEADER_END
68#endif])
69])