diff options
author | Lorenz <12514511+RincewindsHat@users.noreply.github.com> | 2023-03-27 10:34:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-27 10:34:19 (GMT) |
commit | bbc97d57f7f9e0a49fea78c02861c444fe95d46a (patch) | |
tree | c8956bbbe9b73e37d261735699a82cccaacea0db /gl/m4/extern-inline.m4 | |
parent | 917dba07fded8ef04967183a4c0443b5cce2db82 (diff) | |
parent | 482aa6c7fe86d7a899e4888d14149f1ccd5401fd (diff) | |
download | monitoring-plugins-bbc97d57f7f9e0a49fea78c02861c444fe95d46a.tar.gz |
Merge branch 'master' into dev/check_ssh-patches
Diffstat (limited to 'gl/m4/extern-inline.m4')
-rw-r--r-- | gl/m4/extern-inline.m4 | 96 |
1 files changed, 78 insertions, 18 deletions
diff --git a/gl/m4/extern-inline.m4 b/gl/m4/extern-inline.m4 index c4c5e7f..c001b1c 100644 --- a/gl/m4/extern-inline.m4 +++ b/gl/m4/extern-inline.m4 | |||
@@ -1,61 +1,121 @@ | |||
1 | dnl 'extern inline' a la ISO C99. | 1 | dnl 'extern inline' a la ISO C99. |
2 | 2 | ||
3 | dnl Copyright 2012-2013 Free Software Foundation, Inc. | 3 | dnl Copyright 2012-2023 Free Software Foundation, Inc. |
4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
7 | 7 | ||
8 | AC_DEFUN([gl_EXTERN_INLINE], | 8 | AC_DEFUN([gl_EXTERN_INLINE], |
9 | [ | 9 | [ |
10 | AH_VERBATIM([extern_inline], | 10 | AC_CACHE_CHECK([whether ctype.h defines __header_inline], |
11 | [gl_cv_have___header_inline], | ||
12 | [AC_PREPROC_IFELSE( | ||
13 | [AC_LANG_SOURCE([[#include <ctype.h> | ||
14 | #ifndef __header_inline | ||
15 | #error "<ctype.h> does not define __header_inline" | ||
16 | #endif | ||
17 | ]])], | ||
18 | [gl_cv_have___header_inline=yes], | ||
19 | [gl_cv_have___header_inline=no])]) | ||
20 | if test "$gl_cv_have___header_inline" = yes; then | ||
21 | AC_DEFINE([HAVE___HEADER_INLINE], [1], | ||
22 | [Define to 1 if ctype.h defines __header_inline.]) | ||
23 | fi | ||
24 | |||
25 | AH_VERBATIM([HAVE___HEADER_INLINE_1], | ||
11 | [/* Please see the Gnulib manual for how to use these macros. | 26 | [/* Please see the Gnulib manual for how to use these macros. |
12 | 27 | ||
13 | Suppress extern inline with HP-UX cc, as it appears to be broken; see | 28 | 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>. | 29 | <https://lists.gnu.org/r/bug-texinfo/2013-02/msg00030.html>. |
15 | 30 | ||
16 | Suppress extern inline with Sun C in standards-conformance mode, as it | 31 | 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 | 32 | mishandles inline functions that call each other. E.g., for 'inline void f |
18 | (void) { } inline void g (void) { f (); }', c99 incorrectly complains | 33 | (void) { } inline void g (void) { f (); }', c99 incorrectly complains |
19 | 'reference to static identifier "f" in extern inline function'. | 34 | 'reference to static identifier "f" in extern inline function'. |
20 | This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. | 35 | This bug was observed with Oracle Developer Studio 12.6 |
36 | (Sun C 5.15 SunOS_sparc 2017/05/30). | ||
37 | |||
38 | Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) | ||
39 | on configurations that mistakenly use 'static inline' to implement | ||
40 | functions or macros in standard C headers like <ctype.h>. For example, | ||
41 | if isdigit is mistakenly implemented via a static inline function, | ||
42 | a program containing an extern inline function that calls isdigit | ||
43 | may not work since the C standard prohibits extern inline functions | ||
44 | from calling static functions (ISO C 99 section 6.7.4.(3). | ||
45 | This bug is known to occur on: | ||
46 | |||
47 | OS X 10.8 and earlier; see: | ||
48 | https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html | ||
49 | |||
50 | DragonFly; see | ||
51 | http://muscles.dragonflybsd.org/bulk/clang-master-potential/20141111_102002/logs/ah-tty-0.3.12.log | ||
21 | 52 | ||
22 | Suppress the use of extern inline on Apple's platforms, as Libc at least | 53 | FreeBSD; see: |
23 | through Libc-825.26 (2013-04-09) is incompatible with it; see, e.g., | 54 | https://lists.gnu.org/r/bug-gnulib/2014-07/msg00104.html |
24 | <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>. | 55 | |
25 | Perhaps Apple will fix this some day. */ | 56 | OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and |
57 | for clang but remains for g++; see <https://trac.macports.org/ticket/41033>. | ||
58 | Assume DragonFly and FreeBSD will be similar. | ||
59 | |||
60 | GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 | ||
61 | inline semantics, unless -fgnu89-inline is used. It defines a macro | ||
62 | __GNUC_STDC_INLINE__ to indicate this situation or a macro | ||
63 | __GNUC_GNU_INLINE__ to indicate the opposite situation. | ||
64 | GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline | ||
65 | semantics but warns, unless -fgnu89-inline is used: | ||
66 | warning: C99 inline functions are not supported; using GNU89 | ||
67 | warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute | ||
68 | It defines a macro __GNUC_GNU_INLINE__ to indicate this situation. | ||
69 | */ | ||
70 | #if (((defined __APPLE__ && defined __MACH__) \ | ||
71 | || defined __DragonFly__ || defined __FreeBSD__) \ | ||
72 | && (defined HAVE___HEADER_INLINE \ | ||
73 | ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \ | ||
74 | && ! defined __clang__) \ | ||
75 | : ((! defined _DONT_USE_CTYPE_INLINE_ \ | ||
76 | && (defined __GNUC__ || defined __cplusplus)) \ | ||
77 | || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ | ||
78 | && defined __GNUC__ && ! defined __cplusplus)))) | ||
79 | # define _GL_EXTERN_INLINE_STDHEADER_BUG | ||
80 | #endif | ||
26 | #if ((__GNUC__ \ | 81 | #if ((__GNUC__ \ |
27 | ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ | 82 | ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ |
28 | : (199901L <= __STDC_VERSION__ \ | 83 | : (199901L <= __STDC_VERSION__ \ |
29 | && !defined __HP_cc \ | 84 | && !defined __HP_cc \ |
85 | && !defined __PGI \ | ||
30 | && !(defined __SUNPRO_C && __STDC__))) \ | 86 | && !(defined __SUNPRO_C && __STDC__))) \ |
31 | && !defined __APPLE__) | 87 | && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) |
32 | # define _GL_INLINE inline | 88 | # define _GL_INLINE inline |
33 | # define _GL_EXTERN_INLINE extern inline | 89 | # define _GL_EXTERN_INLINE extern inline |
90 | # define _GL_EXTERN_INLINE_IN_USE | ||
34 | #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ | 91 | #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ |
35 | && !defined __APPLE__) | 92 | && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) |
36 | # if __GNUC_GNU_INLINE__ | 93 | # if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ |
37 | /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ | 94 | /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ |
38 | # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) | 95 | # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) |
39 | # else | 96 | # else |
40 | # define _GL_INLINE extern inline | 97 | # define _GL_INLINE extern inline |
41 | # endif | 98 | # endif |
42 | # define _GL_EXTERN_INLINE extern | 99 | # define _GL_EXTERN_INLINE extern |
100 | # define _GL_EXTERN_INLINE_IN_USE | ||
43 | #else | 101 | #else |
44 | # define _GL_INLINE static _GL_UNUSED | 102 | # define _GL_INLINE _GL_UNUSED static |
45 | # define _GL_EXTERN_INLINE static _GL_UNUSED | 103 | # define _GL_EXTERN_INLINE _GL_UNUSED static |
46 | #endif | 104 | #endif |
47 | 105 | ||
48 | #if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) | 106 | /* In GCC 4.6 (inclusive) to 5.1 (exclusive), |
107 | suppress bogus "no previous prototype for 'FOO'" | ||
108 | and "no previous declaration for 'FOO'" diagnostics, | ||
109 | when FOO is an inline function in the header; see | ||
110 | <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and | ||
111 | <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>. */ | ||
112 | #if __GNUC__ == 4 && 6 <= __GNUC_MINOR__ | ||
49 | # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ | 113 | # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ |
50 | # define _GL_INLINE_HEADER_CONST_PRAGMA | 114 | # define _GL_INLINE_HEADER_CONST_PRAGMA |
51 | # else | 115 | # else |
52 | # define _GL_INLINE_HEADER_CONST_PRAGMA \ | 116 | # define _GL_INLINE_HEADER_CONST_PRAGMA \ |
53 | _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") | 117 | _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") |
54 | # endif | 118 | # 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 \ | 119 | # define _GL_INLINE_HEADER_BEGIN \ |
60 | _Pragma ("GCC diagnostic push") \ | 120 | _Pragma ("GCC diagnostic push") \ |
61 | _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ | 121 | _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ |