Commit | Line | Data |
---|---|---|
a0d4efe9 PE |
1 | dnl 'extern inline' a la ISO C99. |
2 | ||
9ff99d22 | 3 | dnl Copyright 2012-2013 Free Software Foundation, Inc. |
a0d4efe9 PE |
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 | [ | |
a0d4efe9 PE |
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 | |
904dd565 PE |
19 | in the same include file, after uses of _GL_INLINE. |
20 | ||
89bd9d36 PE |
21 | Suppress extern inline with HP-UX cc, as it appears to be broken; see |
22 | <http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>. | |
23 | ||
904dd565 PE |
24 | Suppress the use of extern inline on Apple's platforms, |
25 | as Libc-825.25 (2012-09-19) is incompatible with it; see | |
26 | <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>. | |
27 | Perhaps Apple will fix this some day. */ | |
28 | #if ((__GNUC__ \ | |
29 | ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ | |
89bd9d36 | 30 | : 199901L <= __STDC_VERSION__ && !defined __HP_cc) \ |
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 | |
54 | # define _GL_INLINE_HEADER_BEGIN \ | |
55 | _Pragma ("GCC diagnostic push") \ | |
56 | _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ | |
57 | _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \ | |
58 | _GL_INLINE_HEADER_CONST_PRAGMA | |
59 | # define _GL_INLINE_HEADER_END \ | |
60 | _Pragma ("GCC diagnostic pop") | |
61 | #else | |
a0d4efe9 PE |
62 | # define _GL_INLINE_HEADER_BEGIN |
63 | # define _GL_INLINE_HEADER_END | |
64 | #endif]) | |
65 | ]) |