Update gnulib to current upstream master
[deliverable/binutils-gdb.git] / gdb / gnulib / import / m4 / extern-inline.m4
CommitLineData
a512b375
JB
1dnl 'extern inline' a la ISO C99.
2
4a626d0a 3dnl Copyright 2012-2015 Free Software Foundation, Inc.
a512b375
JB
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],
4a626d0a
PA
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 extern inline (with or without __attribute__ ((__gnu_inline__)))
23 on configurations that mistakenly use 'static inline' to implement
24 functions or macros in standard C headers like <ctype.h>. For example,
25 if isdigit is mistakenly implemented via a static inline function,
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
a512b375
JB
53#if ((__GNUC__ \
54 ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
4a626d0a
PA
55 : (199901L <= __STDC_VERSION__ \
56 && !defined __HP_cc \
57 && !(defined __SUNPRO_C && __STDC__))) \
58 && !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
a512b375
JB
59# define _GL_INLINE inline
60# define _GL_EXTERN_INLINE extern inline
4a626d0a
PA
61# define _GL_EXTERN_INLINE_IN_USE
62#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \
63 && !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
64# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__
a512b375
JB
65 /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */
66# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
67# else
68# define _GL_INLINE extern inline
69# endif
70# define _GL_EXTERN_INLINE extern
4a626d0a 71# define _GL_EXTERN_INLINE_IN_USE
a512b375
JB
72#else
73# define _GL_INLINE static _GL_UNUSED
74# define _GL_EXTERN_INLINE static _GL_UNUSED
75#endif
76
4a626d0a
PA
77/* In GCC 4.6 (inclusive) to 5.1 (exclusive),
78 suppress bogus "no previous prototype for 'FOO'"
79 and "no previous declaration for 'FOO'" diagnostics,
80 when FOO is an inline function in the header; see
81 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and
82 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>. */
83#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__
a512b375
JB
84# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
85# define _GL_INLINE_HEADER_CONST_PRAGMA
86# else
87# define _GL_INLINE_HEADER_CONST_PRAGMA \
88 _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
89# endif
90# define _GL_INLINE_HEADER_BEGIN \
91 _Pragma ("GCC diagnostic push") \
92 _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
93 _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \
94 _GL_INLINE_HEADER_CONST_PRAGMA
95# define _GL_INLINE_HEADER_END \
96 _Pragma ("GCC diagnostic pop")
97#else
98# define _GL_INLINE_HEADER_BEGIN
99# define _GL_INLINE_HEADER_END
100#endif])
101])
This page took 0.245808 seconds and 4 git commands to generate.