diff options
Diffstat (limited to 'gl/m4/inline.m4')
-rw-r--r-- | gl/m4/inline.m4 | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/gl/m4/extern-inline.m4 b/gl/m4/extern-inline.m4 new file mode 100644 index 0000000..c4c5e7f --- /dev/null +++ b/gl/m4/extern-inline.m4 | |||
@@ -0,0 +1,70 @@ | |||
1 | dnl 'extern inline' a la ISO C99. | ||
2 | |||
3 | dnl Copyright 2012-2013 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 | AH_VERBATIM([extern_inline], | ||
11 | [/* Please see the Gnulib manual for how to use these macros. | ||
12 | |||
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 | |||
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., | ||
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__ \ | ||
28 | : (199901L <= __STDC_VERSION__ \ | ||
29 | && !defined __HP_cc \ | ||
30 | && !(defined __SUNPRO_C && __STDC__))) \ | ||
31 | && !defined __APPLE__) | ||
32 | # define _GL_INLINE inline | ||
33 | # define _GL_EXTERN_INLINE extern inline | ||
34 | #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ | ||
35 | && !defined __APPLE__) | ||
36 | # if __GNUC_GNU_INLINE__ | ||
37 | /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ | ||
38 | # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) | ||
39 | # else | ||
40 | # define _GL_INLINE extern inline | ||
41 | # endif | ||
42 | # define _GL_EXTERN_INLINE extern | ||
43 | #else | ||
44 | # define _GL_INLINE static _GL_UNUSED | ||
45 | # define _GL_EXTERN_INLINE static _GL_UNUSED | ||
46 | #endif | ||
47 | |||
48 | #if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) | ||
49 | # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ | ||
50 | # define _GL_INLINE_HEADER_CONST_PRAGMA | ||
51 | # else | ||
52 | # define _GL_INLINE_HEADER_CONST_PRAGMA \ | ||
53 | _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") | ||
54 | # endif | ||
55 | /* Suppress GCC's bogus "no previous prototype for 'FOO'" | ||
56 | and "no previous declaration for 'FOO'" diagnostics, | ||
57 | when FOO is an inline function in the header; see | ||
58 | <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. */ | ||
59 | # define _GL_INLINE_HEADER_BEGIN \ | ||
60 | _Pragma ("GCC diagnostic push") \ | ||
61 | _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ | ||
62 | _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \ | ||
63 | _GL_INLINE_HEADER_CONST_PRAGMA | ||
64 | # define _GL_INLINE_HEADER_END \ | ||
65 | _Pragma ("GCC diagnostic pop") | ||
66 | #else | ||
67 | # define _GL_INLINE_HEADER_BEGIN | ||
68 | # define _GL_INLINE_HEADER_END | ||
69 | #endif]) | ||
70 | ]) | ||
diff --git a/gl/m4/inline.m4 b/gl/m4/inline.m4 deleted file mode 100644 index 4ef768d..0000000 --- a/gl/m4/inline.m4 +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | # inline.m4 serial 4 | ||
2 | dnl Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | ||
4 | dnl gives unlimited permission to copy and/or distribute it, | ||
5 | dnl with or without modifications, as long as this notice is preserved. | ||
6 | |||
7 | dnl Test for the 'inline' keyword or equivalent. | ||
8 | dnl Define 'inline' to a supported equivalent, or to nothing if not supported, | ||
9 | dnl like AC_C_INLINE does. Also, define HAVE_INLINE if 'inline' or an | ||
10 | dnl equivalent is effectively supported, i.e. if the compiler is likely to | ||
11 | dnl drop unused 'static inline' functions. | ||
12 | AC_DEFUN([gl_INLINE], | ||
13 | [ | ||
14 | AC_REQUIRE([AC_C_INLINE]) | ||
15 | AC_CACHE_CHECK([whether the compiler generally respects inline], | ||
16 | [gl_cv_c_inline_effective], | ||
17 | [if test $ac_cv_c_inline = no; then | ||
18 | gl_cv_c_inline_effective=no | ||
19 | else | ||
20 | dnl GCC defines __NO_INLINE__ if not optimizing or if -fno-inline is | ||
21 | dnl specified. | ||
22 | dnl Use AC_COMPILE_IFELSE here, not AC_EGREP_CPP, because the result | ||
23 | dnl depends on optimization flags, which can be in CFLAGS. | ||
24 | dnl (AC_EGREP_CPP looks only at the CPPFLAGS.) | ||
25 | AC_COMPILE_IFELSE( | ||
26 | [AC_LANG_PROGRAM([[]], | ||
27 | [[#ifdef __NO_INLINE__ | ||
28 | #error "inline is not effective" | ||
29 | #endif]])], | ||
30 | [gl_cv_c_inline_effective=yes], | ||
31 | [gl_cv_c_inline_effective=no]) | ||
32 | fi | ||
33 | ]) | ||
34 | if test $gl_cv_c_inline_effective = yes; then | ||
35 | AC_DEFINE([HAVE_INLINE], [1], | ||
36 | [Define to 1 if the compiler supports one of the keywords | ||
37 | 'inline', '__inline__', '__inline' and effectively inlines | ||
38 | functions marked as such.]) | ||
39 | fi | ||
40 | ]) | ||