aboutsummaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4')
-rw-r--r--m4/extern-inline.m445
1 files changed, 8 insertions, 37 deletions
diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4
index 7f1bb397c..c4c5e7f22 100644
--- a/m4/extern-inline.m4
+++ b/m4/extern-inline.m4
@@ -1,6 +1,6 @@
1dnl 'extern inline' a la ISO C99. 1dnl 'extern inline' a la ISO C99.
2 2
3dnl Copyright 2012-2014 Free Software Foundation, Inc. 3dnl Copyright 2012-2013 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
@@ -19,56 +19,27 @@ AC_DEFUN([gl_EXTERN_INLINE],
19 'reference to static identifier "f" in extern inline function'. 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. 20 This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16.
21 21
22 Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) 22 Suppress the use of extern inline on Apple's platforms, as Libc at least
23 on configurations that mistakenly use 'static inline' to implement 23 through Libc-825.26 (2013-04-09) is incompatible with it; see, e.g.,
24 functions or macros in standard C headers like <ctype.h>. For example, 24 <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
25 if isdigit is mistakenly implemented via a static inline function, 25 Perhaps Apple will fix this some day. */
26 a program containing an extern inline function that calls isdigit
27 may not work since the C standard prohibits extern inline functions
28 from calling static functions. This bug is known to occur on:
29
30 OS X 10.8 and earlier; see:
31 http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html
32
33 DragonFly; see
34 http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log
35
36 FreeBSD; see:
37 http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00104.html
38
39 OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and
40 for clang but remains for g++; see <http://trac.macports.org/ticket/41033>.
41 Assume DragonFly and FreeBSD will be similar. */
42#if (((defined __APPLE__ && defined __MACH__) \
43 || defined __DragonFly__ || defined __FreeBSD__) \
44 && (defined __header_inline \
45 ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \
46 && ! defined __clang__) \
47 : ((! defined _DONT_USE_CTYPE_INLINE_ \
48 && (defined __GNUC__ || defined __cplusplus)) \
49 || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
50 && defined __GNUC__ && ! defined __cplusplus))))
51# define _GL_EXTERN_INLINE_STDHEADER_BUG
52#endif
53#if ((__GNUC__ \ 26#if ((__GNUC__ \
54 ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ 27 ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
55 : (199901L <= __STDC_VERSION__ \ 28 : (199901L <= __STDC_VERSION__ \
56 && !defined __HP_cc \ 29 && !defined __HP_cc \
57 && !(defined __SUNPRO_C && __STDC__))) \ 30 && !(defined __SUNPRO_C && __STDC__))) \
58 && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) 31 && !defined __APPLE__)
59# define _GL_INLINE inline 32# define _GL_INLINE inline
60# define _GL_EXTERN_INLINE extern inline 33# define _GL_EXTERN_INLINE extern inline
61# define _GL_EXTERN_INLINE_IN_USE
62#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ 34#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \
63 && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) 35 && !defined __APPLE__)
64# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ 36# if __GNUC_GNU_INLINE__
65 /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ 37 /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */
66# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) 38# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
67# else 39# else
68# define _GL_INLINE extern inline 40# define _GL_INLINE extern inline
69# endif 41# endif
70# define _GL_EXTERN_INLINE extern 42# define _GL_EXTERN_INLINE extern
71# define _GL_EXTERN_INLINE_IN_USE
72#else 43#else
73# define _GL_INLINE static _GL_UNUSED 44# define _GL_INLINE static _GL_UNUSED
74# define _GL_EXTERN_INLINE static _GL_UNUSED 45# define _GL_EXTERN_INLINE static _GL_UNUSED