Mercurial > gnulib
annotate m4/extern-inline.m4 @ 17330:6f8d1926ece8
extern-inline: avoid compilation error with HP-UX cc
Reported by Richard Lloyd in
<http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>.
* m4/extern-inline.m4 (_GL_INLINE, _GL_EXTERN_INLINE):
Suppress extern inline with HP-UX cc. This should be safe,
though it may hurt performance. Perhaps someone with some HP-UX
experience can come up with a higher-performance fix.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Mon, 18 Feb 2013 17:16:30 -0800 |
parents | e542fd46ad6f |
children | f9ba1e745bd9 |
rev | line source |
---|---|
17022 | 1 dnl 'extern inline' a la ISO C99. |
2 | |
17249
e542fd46ad6f
maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents:
17205
diff
changeset
|
3 dnl Copyright 2012-2013 Free Software Foundation, Inc. |
17022 | 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 [/* _GL_INLINE is a portable alternative to ISO C99 plain 'inline'. | |
17029
a3c4b8128bde
Fix typo: 'linline' -> 'inline' (thanks to Eric Blake).
Paul Eggert <eggert@cs.ucla.edu>
parents:
17027
diff
changeset
|
12 _GL_EXTERN_INLINE is a portable alternative to 'extern inline'. |
17027 | 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 | |
17205
80b56d8fd2b7
extern-inline: avoid incompatibility with Darwin Libc
Paul Eggert <eggert@cs.ucla.edu>
parents:
17195
diff
changeset
|
19 in the same include file, after uses of _GL_INLINE. |
80b56d8fd2b7
extern-inline: avoid incompatibility with Darwin Libc
Paul Eggert <eggert@cs.ucla.edu>
parents:
17195
diff
changeset
|
20 |
17330
6f8d1926ece8
extern-inline: avoid compilation error with HP-UX cc
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
21 Suppress extern inline with HP-UX cc, as it appears to be broken; see |
6f8d1926ece8
extern-inline: avoid compilation error with HP-UX cc
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
22 <http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>. |
6f8d1926ece8
extern-inline: avoid compilation error with HP-UX cc
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
23 |
17205
80b56d8fd2b7
extern-inline: avoid incompatibility with Darwin Libc
Paul Eggert <eggert@cs.ucla.edu>
parents:
17195
diff
changeset
|
24 Suppress the use of extern inline on Apple's platforms, |
80b56d8fd2b7
extern-inline: avoid incompatibility with Darwin Libc
Paul Eggert <eggert@cs.ucla.edu>
parents:
17195
diff
changeset
|
25 as Libc-825.25 (2012-09-19) is incompatible with it; see |
80b56d8fd2b7
extern-inline: avoid incompatibility with Darwin Libc
Paul Eggert <eggert@cs.ucla.edu>
parents:
17195
diff
changeset
|
26 <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>. |
80b56d8fd2b7
extern-inline: avoid incompatibility with Darwin Libc
Paul Eggert <eggert@cs.ucla.edu>
parents:
17195
diff
changeset
|
27 Perhaps Apple will fix this some day. */ |
80b56d8fd2b7
extern-inline: avoid incompatibility with Darwin Libc
Paul Eggert <eggert@cs.ucla.edu>
parents:
17195
diff
changeset
|
28 #if ((__GNUC__ \ |
80b56d8fd2b7
extern-inline: avoid incompatibility with Darwin Libc
Paul Eggert <eggert@cs.ucla.edu>
parents:
17195
diff
changeset
|
29 ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ |
17330
6f8d1926ece8
extern-inline: avoid compilation error with HP-UX cc
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
30 : 199901L <= __STDC_VERSION__ && !defined __HP_cc) \ |
17205
80b56d8fd2b7
extern-inline: avoid incompatibility with Darwin Libc
Paul Eggert <eggert@cs.ucla.edu>
parents:
17195
diff
changeset
|
31 && !defined __APPLE__) |
17022 | 32 # define _GL_INLINE inline |
33 # define _GL_EXTERN_INLINE extern inline | |
17205
80b56d8fd2b7
extern-inline: avoid incompatibility with Darwin Libc
Paul Eggert <eggert@cs.ucla.edu>
parents:
17195
diff
changeset
|
34 #elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __APPLE__ |
17056
373b50f0c218
extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
17035
diff
changeset
|
35 # if __GNUC_GNU_INLINE__ |
373b50f0c218
extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
17035
diff
changeset
|
36 /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ |
373b50f0c218
extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
17035
diff
changeset
|
37 # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) |
373b50f0c218
extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
17035
diff
changeset
|
38 # else |
373b50f0c218
extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
17035
diff
changeset
|
39 # define _GL_INLINE extern inline |
17022 | 40 # endif |
17056
373b50f0c218
extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
17035
diff
changeset
|
41 # define _GL_EXTERN_INLINE extern |
17022 | 42 #else |
17205
80b56d8fd2b7
extern-inline: avoid incompatibility with Darwin Libc
Paul Eggert <eggert@cs.ucla.edu>
parents:
17195
diff
changeset
|
43 # define _GL_INLINE static _GL_UNUSED |
80b56d8fd2b7
extern-inline: avoid incompatibility with Darwin Libc
Paul Eggert <eggert@cs.ucla.edu>
parents:
17195
diff
changeset
|
44 # define _GL_EXTERN_INLINE static _GL_UNUSED |
17022 | 45 #endif |
46 | |
17056
373b50f0c218
extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
17035
diff
changeset
|
47 #if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) |
17112
03d96692c889
extern-inline: provide a -Wundef safe config.h
Akim Demaille <akim@lrde.epita.fr>
parents:
17056
diff
changeset
|
48 # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ |
17056
373b50f0c218
extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
17035
diff
changeset
|
49 # define _GL_INLINE_HEADER_CONST_PRAGMA |
373b50f0c218
extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
17035
diff
changeset
|
50 # else |
373b50f0c218
extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
17035
diff
changeset
|
51 # define _GL_INLINE_HEADER_CONST_PRAGMA \ |
373b50f0c218
extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
17035
diff
changeset
|
52 _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") |
373b50f0c218
extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
17035
diff
changeset
|
53 # endif |
373b50f0c218
extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
17035
diff
changeset
|
54 # define _GL_INLINE_HEADER_BEGIN \ |
373b50f0c218
extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
17035
diff
changeset
|
55 _Pragma ("GCC diagnostic push") \ |
373b50f0c218
extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
17035
diff
changeset
|
56 _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ |
373b50f0c218
extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
17035
diff
changeset
|
57 _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \ |
373b50f0c218
extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
17035
diff
changeset
|
58 _GL_INLINE_HEADER_CONST_PRAGMA |
373b50f0c218
extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
17035
diff
changeset
|
59 # define _GL_INLINE_HEADER_END \ |
373b50f0c218
extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
17035
diff
changeset
|
60 _Pragma ("GCC diagnostic pop") |
373b50f0c218
extern-inline: support old GCC 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
17035
diff
changeset
|
61 #else |
17022 | 62 # define _GL_INLINE_HEADER_BEGIN |
63 # define _GL_INLINE_HEADER_END | |
64 #endif]) | |
65 ]) |