annotate m4/extern-inline.m4 @ 37229:8cabe46c47b3

extern-inline: port better to OS X 10.9 * m4/extern-inline.m4: Omit serial number; this file doesn't use them. (gl_EXTERN_INLINE): Do not suppress the use of extern inline on OS X 10.9, except for g++ where the bug is still present. See <http://trac.macports.org/ticket/41033>.
author Paul Eggert <eggert@cs.ucla.edu>
date Fri, 08 Nov 2013 07:57:15 -0800
parents 1eb5f45967c9
children 344018b6e5d7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
36713
266a805975d1 extern-inline: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
1 dnl 'extern inline' a la ISO C99.
266a805975d1 extern-inline: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
2
36940
c741bc27922a maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents: 36896
diff changeset
3 dnl Copyright 2012-2013 Free Software Foundation, Inc.
36713
266a805975d1 extern-inline: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
4 dnl This file is free software; the Free Software Foundation
266a805975d1 extern-inline: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
5 dnl gives unlimited permission to copy and/or distribute it,
266a805975d1 extern-inline: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
6 dnl with or without modifications, as long as this notice is preserved.
266a805975d1 extern-inline: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
7
266a805975d1 extern-inline: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
8 AC_DEFUN([gl_EXTERN_INLINE],
266a805975d1 extern-inline: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
9 [
266a805975d1 extern-inline: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
10 AH_VERBATIM([extern_inline],
37115
02f222566fce doc: document extern-inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 37063
diff changeset
11 [/* Please see the Gnulib manual for how to use these macros.
36896
7995aac33b4d extern-inline: avoid incompatibility with Darwin Libc
Paul Eggert <eggert@cs.ucla.edu>
parents: 36886
diff changeset
12
37021
916bace077cb extern-inline: avoid compilation error with HP-UX cc
Paul Eggert <eggert@cs.ucla.edu>
parents: 36940
diff changeset
13 Suppress extern inline with HP-UX cc, as it appears to be broken; see
916bace077cb extern-inline: avoid compilation error with HP-UX cc
Paul Eggert <eggert@cs.ucla.edu>
parents: 36940
diff changeset
14 <http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>.
916bace077cb extern-inline: avoid compilation error with HP-UX cc
Paul Eggert <eggert@cs.ucla.edu>
parents: 36940
diff changeset
15
37063
52e14abbb6d9 extern-inline: work around bug in Sun c99
Paul Eggert <eggert@cs.ucla.edu>
parents: 37021
diff changeset
16 Suppress extern inline with Sun C in standards-conformance mode, as it
52e14abbb6d9 extern-inline: work around bug in Sun c99
Paul Eggert <eggert@cs.ucla.edu>
parents: 37021
diff changeset
17 mishandles inline functions that call each other. E.g., for 'inline void f
52e14abbb6d9 extern-inline: work around bug in Sun c99
Paul Eggert <eggert@cs.ucla.edu>
parents: 37021
diff changeset
18 (void) { } inline void g (void) { f (); }', c99 incorrectly complains
52e14abbb6d9 extern-inline: work around bug in Sun c99
Paul Eggert <eggert@cs.ucla.edu>
parents: 37021
diff changeset
19 'reference to static identifier "f" in extern inline function'.
52e14abbb6d9 extern-inline: work around bug in Sun c99
Paul Eggert <eggert@cs.ucla.edu>
parents: 37021
diff changeset
20 This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16.
52e14abbb6d9 extern-inline: work around bug in Sun c99
Paul Eggert <eggert@cs.ucla.edu>
parents: 37021
diff changeset
21
37229
8cabe46c47b3 extern-inline: port better to OS X 10.9
Paul Eggert <eggert@cs.ucla.edu>
parents: 37208
diff changeset
22 Suppress the use of extern inline on problematic Apple configurations.
8cabe46c47b3 extern-inline: port better to OS X 10.9
Paul Eggert <eggert@cs.ucla.edu>
parents: 37208
diff changeset
23 OS X 10.8 and earlier mishandle it; see, e.g.,
36896
7995aac33b4d extern-inline: avoid incompatibility with Darwin Libc
Paul Eggert <eggert@cs.ucla.edu>
parents: 36886
diff changeset
24 <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
37229
8cabe46c47b3 extern-inline: port better to OS X 10.9
Paul Eggert <eggert@cs.ucla.edu>
parents: 37208
diff changeset
25 OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and
8cabe46c47b3 extern-inline: port better to OS X 10.9
Paul Eggert <eggert@cs.ucla.edu>
parents: 37208
diff changeset
26 for clang but remains for g++; see <http://trac.macports.org/ticket/41033>.
36896
7995aac33b4d extern-inline: avoid incompatibility with Darwin Libc
Paul Eggert <eggert@cs.ucla.edu>
parents: 36886
diff changeset
27 Perhaps Apple will fix this some day. */
37177
c151363623ef extern-inline: do not always suppress extern inline on OS X
Paul Eggert <eggert@cs.ucla.edu>
parents: 37116
diff changeset
28 #if (defined __APPLE__ \
37229
8cabe46c47b3 extern-inline: port better to OS X 10.9
Paul Eggert <eggert@cs.ucla.edu>
parents: 37208
diff changeset
29 && (defined __header_inline \
8cabe46c47b3 extern-inline: port better to OS X 10.9
Paul Eggert <eggert@cs.ucla.edu>
parents: 37208
diff changeset
30 ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \
8cabe46c47b3 extern-inline: port better to OS X 10.9
Paul Eggert <eggert@cs.ucla.edu>
parents: 37208
diff changeset
31 && ! defined __clang__) \
8cabe46c47b3 extern-inline: port better to OS X 10.9
Paul Eggert <eggert@cs.ucla.edu>
parents: 37208
diff changeset
32 : ((! defined _DONT_USE_CTYPE_INLINE_ \
8cabe46c47b3 extern-inline: port better to OS X 10.9
Paul Eggert <eggert@cs.ucla.edu>
parents: 37208
diff changeset
33 && (defined __GNUC__ || defined __cplusplus)) \
8cabe46c47b3 extern-inline: port better to OS X 10.9
Paul Eggert <eggert@cs.ucla.edu>
parents: 37208
diff changeset
34 || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
8cabe46c47b3 extern-inline: port better to OS X 10.9
Paul Eggert <eggert@cs.ucla.edu>
parents: 37208
diff changeset
35 && defined __GNUC__ && ! defined __cplusplus))))
37177
c151363623ef extern-inline: do not always suppress extern inline on OS X
Paul Eggert <eggert@cs.ucla.edu>
parents: 37116
diff changeset
36 # define _GL_EXTERN_INLINE_APPLE_BUG
c151363623ef extern-inline: do not always suppress extern inline on OS X
Paul Eggert <eggert@cs.ucla.edu>
parents: 37116
diff changeset
37 #endif
36896
7995aac33b4d extern-inline: avoid incompatibility with Darwin Libc
Paul Eggert <eggert@cs.ucla.edu>
parents: 36886
diff changeset
38 #if ((__GNUC__ \
7995aac33b4d extern-inline: avoid incompatibility with Darwin Libc
Paul Eggert <eggert@cs.ucla.edu>
parents: 36886
diff changeset
39 ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
37063
52e14abbb6d9 extern-inline: work around bug in Sun c99
Paul Eggert <eggert@cs.ucla.edu>
parents: 37021
diff changeset
40 : (199901L <= __STDC_VERSION__ \
52e14abbb6d9 extern-inline: work around bug in Sun c99
Paul Eggert <eggert@cs.ucla.edu>
parents: 37021
diff changeset
41 && !defined __HP_cc \
52e14abbb6d9 extern-inline: work around bug in Sun c99
Paul Eggert <eggert@cs.ucla.edu>
parents: 37021
diff changeset
42 && !(defined __SUNPRO_C && __STDC__))) \
37177
c151363623ef extern-inline: do not always suppress extern inline on OS X
Paul Eggert <eggert@cs.ucla.edu>
parents: 37116
diff changeset
43 && !defined _GL_EXTERN_INLINE_APPLE_BUG)
36713
266a805975d1 extern-inline: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
44 # define _GL_INLINE inline
266a805975d1 extern-inline: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
45 # define _GL_EXTERN_INLINE extern inline
37177
c151363623ef extern-inline: do not always suppress extern inline on OS X
Paul Eggert <eggert@cs.ucla.edu>
parents: 37116
diff changeset
46 # define _GL_EXTERN_INLINE_IN_USE
37116
f96eab549d7e extern-inline: port to gcc -std=c89
Paul Eggert <eggert@cs.ucla.edu>
parents: 37115
diff changeset
47 #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \
37177
c151363623ef extern-inline: do not always suppress extern inline on OS X
Paul Eggert <eggert@cs.ucla.edu>
parents: 37116
diff changeset
48 && !defined _GL_EXTERN_INLINE_APPLE_BUG)
37208
1eb5f45967c9 extern-inline: make safe for -Wundef usage
Eric Blake <eblake@redhat.com>
parents: 37177
diff changeset
49 # if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__
36747
116cab01ffef extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 36726
diff changeset
50 /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */
116cab01ffef extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 36726
diff changeset
51 # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
116cab01ffef extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 36726
diff changeset
52 # else
116cab01ffef extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 36726
diff changeset
53 # define _GL_INLINE extern inline
36713
266a805975d1 extern-inline: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
54 # endif
36747
116cab01ffef extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 36726
diff changeset
55 # define _GL_EXTERN_INLINE extern
37177
c151363623ef extern-inline: do not always suppress extern inline on OS X
Paul Eggert <eggert@cs.ucla.edu>
parents: 37116
diff changeset
56 # define _GL_EXTERN_INLINE_IN_USE
36713
266a805975d1 extern-inline: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
57 #else
36896
7995aac33b4d extern-inline: avoid incompatibility with Darwin Libc
Paul Eggert <eggert@cs.ucla.edu>
parents: 36886
diff changeset
58 # define _GL_INLINE static _GL_UNUSED
7995aac33b4d extern-inline: avoid incompatibility with Darwin Libc
Paul Eggert <eggert@cs.ucla.edu>
parents: 36886
diff changeset
59 # define _GL_EXTERN_INLINE static _GL_UNUSED
36713
266a805975d1 extern-inline: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
60 #endif
266a805975d1 extern-inline: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
61
36747
116cab01ffef extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 36726
diff changeset
62 #if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
36803
080439e75e22 extern-inline: provide a -Wundef safe config.h
Akim Demaille <akim@lrde.epita.fr>
parents: 36747
diff changeset
63 # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
36747
116cab01ffef extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 36726
diff changeset
64 # define _GL_INLINE_HEADER_CONST_PRAGMA
116cab01ffef extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 36726
diff changeset
65 # else
116cab01ffef extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 36726
diff changeset
66 # define _GL_INLINE_HEADER_CONST_PRAGMA \
116cab01ffef extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 36726
diff changeset
67 _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
116cab01ffef extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 36726
diff changeset
68 # endif
37115
02f222566fce doc: document extern-inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 37063
diff changeset
69 /* Suppress GCC's bogus "no previous prototype for 'FOO'"
02f222566fce doc: document extern-inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 37063
diff changeset
70 and "no previous declaration for 'FOO'" diagnostics,
02f222566fce doc: document extern-inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 37063
diff changeset
71 when FOO is an inline function in the header; see
02f222566fce doc: document extern-inline
Paul Eggert <eggert@cs.ucla.edu>
parents: 37063
diff changeset
72 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. */
36747
116cab01ffef extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 36726
diff changeset
73 # define _GL_INLINE_HEADER_BEGIN \
116cab01ffef extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 36726
diff changeset
74 _Pragma ("GCC diagnostic push") \
116cab01ffef extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 36726
diff changeset
75 _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
116cab01ffef extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 36726
diff changeset
76 _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \
116cab01ffef extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 36726
diff changeset
77 _GL_INLINE_HEADER_CONST_PRAGMA
116cab01ffef extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 36726
diff changeset
78 # define _GL_INLINE_HEADER_END \
116cab01ffef extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 36726
diff changeset
79 _Pragma ("GCC diagnostic pop")
116cab01ffef extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 36726
diff changeset
80 #else
36713
266a805975d1 extern-inline: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
81 # define _GL_INLINE_HEADER_BEGIN
266a805975d1 extern-inline: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
82 # define _GL_INLINE_HEADER_END
266a805975d1 extern-inline: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
83 #endif])
266a805975d1 extern-inline: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
84 ])